-
Notifications
You must be signed in to change notification settings - Fork 593
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add graph view to project overview workloads tab
- Loading branch information
1 parent
913992f
commit 79f5f26
Showing
9 changed files
with
273 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
frontend/packages/dev-console/src/components/topology/TopologyPageToolbar.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as React from 'react'; | ||
import { observer } from '@patternfly/react-topology'; | ||
import { Tooltip, Popover, Button } from '@patternfly/react-core'; | ||
import { ListIcon, TopologyIcon, QuestionCircleIcon } from '@patternfly/react-icons'; | ||
import TopologyShortcuts from './TopologyShortcuts'; | ||
import ModelContext, { ExtensibleModel } from './data-transforms/ModelContext'; | ||
|
||
interface TopologyPageToolbarProps { | ||
showGraphView: boolean; | ||
onViewChange: (graphView: boolean) => void; | ||
} | ||
|
||
export const TopologyPageToolbar: React.FC<TopologyPageToolbarProps> = observer( | ||
({ showGraphView, onViewChange }) => { | ||
const dataModelContext = React.useContext<ExtensibleModel>(ModelContext); | ||
const { namespace, isEmptyModel } = dataModelContext; | ||
|
||
if (!namespace || isEmptyModel) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
{showGraphView ? ( | ||
<Popover | ||
aria-label="Shortcuts" | ||
bodyContent={TopologyShortcuts} | ||
position="left" | ||
maxWidth="100vw" | ||
> | ||
<Button | ||
type="button" | ||
variant="link" | ||
className="odc-topology__shortcuts-button" | ||
icon={<QuestionCircleIcon />} | ||
data-test-id="topology-view-shortcuts" | ||
> | ||
View shortcuts | ||
</Button> | ||
</Popover> | ||
) : null} | ||
<Tooltip position="left" content={showGraphView ? 'List View' : 'Topology View'}> | ||
<Button | ||
variant="link" | ||
className="pf-m-plain odc-topology__view-switcher" | ||
onClick={() => onViewChange(!showGraphView)} | ||
> | ||
{showGraphView ? <ListIcon size="md" /> : <TopologyIcon size="md" />} | ||
</Button> | ||
</Tooltip> | ||
</> | ||
); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.