-
Notifications
You must be signed in to change notification settings - Fork 3
feat: filter button for graph view #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 5 commits
71361cf
7ea7813
62a9f30
64bb08f
c1769c0
656f8a5
002625a
2338bd9
3dd532c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import React, { useState, useCallback, useMemo } from 'react'; | ||
| import { ReactFlow, Background, Controls, MarkerType, Node, Panel } from '@xyflow/react'; | ||
| import { ReactFlow, Background, Controls, MarkerType, Node } from '@xyflow/react'; | ||
| import { Button, Popover } from '@ui5/webcomponents-react'; | ||
| import type { NodeProps } from '@xyflow/react'; | ||
| import { RadioButton, FlexBox, FlexBoxAlignItems } from '@ui5/webcomponents-react'; | ||
| import styles from './Graph.module.css'; | ||
| import '@xyflow/react/dist/style.css'; | ||
| import { NodeData, ColorBy } from './types'; | ||
|
|
@@ -32,7 +32,8 @@ const Graph: React.FC = () => { | |
| const { t } = useTranslation(); | ||
| const { openInAside } = useSplitter(); | ||
| const { isDarkTheme } = useTheme(); | ||
| const [colorBy, setColorBy] = useState<ColorBy>('provider'); | ||
| const [colorBy, setColorBy] = useState<ColorBy>('source'); | ||
| const [filterPopoverOpen, setFilterPopoverOpen] = useState(false); | ||
|
|
||
| const handleYamlClick = useCallback( | ||
| (item: ManagedResourceItem) => { | ||
|
|
@@ -92,37 +93,56 @@ const Graph: React.FC = () => { | |
| > | ||
| <Controls showInteractive={false} /> | ||
| <Background /> | ||
| <Panel position="top-left"> | ||
| <FlexBox alignItems={FlexBoxAlignItems.Center} role="radiogroup"> | ||
| <fieldset className={styles.fieldsetReset}> | ||
| <div className={styles.graphHeader}> | ||
| <span className={styles.colorizedTitle}>{t('Graphs.colorizedTitle')}</span> | ||
| <RadioButton | ||
| name="colorBy" | ||
| text={t('Graphs.colorsProviderConfig')} | ||
| checked={colorBy === 'provider'} | ||
| onChange={() => setColorBy('provider')} | ||
| /> | ||
| <RadioButton | ||
| name="colorBy" | ||
| text={t('Graphs.colorsProvider')} | ||
| checked={colorBy === 'source'} | ||
| onChange={() => setColorBy('source')} | ||
| /> | ||
| <RadioButton | ||
| name="colorBy" | ||
| text={t('Graphs.colorsFlux')} | ||
| checked={colorBy === 'flux'} | ||
| onChange={() => setColorBy('flux')} | ||
| /> | ||
| </div> | ||
| </fieldset> | ||
| </FlexBox> | ||
| </Panel> | ||
| <Panel position="top-right"> | ||
| <Legend legendItems={legendItems} /> | ||
| </Panel> | ||
| </ReactFlow> | ||
|
|
||
| <div className={styles.topLegendContainer}> | ||
Lasserich marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <Legend legendItems={legendItems} /> | ||
| <Popover | ||
| opener="filter-button" | ||
| open={filterPopoverOpen} | ||
| placement="Bottom" | ||
| onClose={() => setFilterPopoverOpen(false)} | ||
| > | ||
| <div className={styles.popoverButtonContainer}> | ||
| <Button | ||
| design={colorBy === 'source' ? 'Emphasized' : 'Default'} | ||
| onClick={() => { | ||
| setColorBy('source'); | ||
| setFilterPopoverOpen(false); | ||
| }} | ||
| > | ||
| {t('Graphs.colorsProvider')} | ||
| </Button> | ||
| <Button | ||
| design={colorBy === 'provider' ? 'Emphasized' : 'Default'} | ||
| onClick={() => { | ||
| setColorBy('provider'); | ||
| setFilterPopoverOpen(false); | ||
| }} | ||
| > | ||
| {t('Graphs.colorsProviderConfig')} | ||
| </Button> | ||
| <Button | ||
| design={colorBy === 'flux' ? 'Emphasized' : 'Default'} | ||
| onClick={() => { | ||
| setColorBy('flux'); | ||
| setFilterPopoverOpen(false); | ||
| }} | ||
| > | ||
| {t('Graphs.colorsFlux')} | ||
| </Button> | ||
| </div> | ||
| </Popover> | ||
| <div className={styles.filterIcon}> | ||
| <Button | ||
| id="filter-button" | ||
Lasserich marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| design="Transparent" | ||
| icon="filter" | ||
| tooltip={t('Graphs.colorizedTitle')} | ||
|
||
| onClick={() => setFilterPopoverOpen(!filterPopoverOpen)} | ||
| /> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.