generated from openmcp-project/repository-template
-
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
71361cf
feat: filter button + tinted nodes
Lasserich 7ea7813
Merge branch 'main' into ft/graphstyle
Lasserich 62a9f30
fix: linting
Lasserich 64bb08f
Merge branch 'ft/graphstyle' of https://github.com/openmcp-project/ui…
Lasserich c1769c0
fix: darkmode
Lasserich 656f8a5
feat: review changes
Lasserich 002625a
feat: review changes
Lasserich 2338bd9
fix: linting
Lasserich 3dd532c
Merge branch 'main' into ft/graphstyle
Lasserich e69e7cd
Merge branch 'main' into ft/graphstyle
Lasserich dc863bc
fix: review changes
Lasserich 15ba047
Merge branch 'ft/graphstyle' of https://github.com/openmcp-project/ui…
Lasserich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,23 +1,83 @@ | ||
| import React from 'react'; | ||
| import React, { useId, useState } from 'react'; | ||
| import { Button, Popover } from '@ui5/webcomponents-react'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import { ColorBy } from './types'; | ||
| import styles from './Legend.module.css'; | ||
|
|
||
| export interface LegendItem { | ||
| name: string; | ||
| color: string; | ||
| } | ||
|
|
||
| interface LegendProps { | ||
| legendItems: LegendItem[]; | ||
| colorBy: ColorBy; | ||
| onColorByChange: (colorBy: ColorBy) => void; | ||
| } | ||
|
|
||
| export const Legend: React.FC<LegendProps> = ({ legendItems }) => { | ||
| export const Legend: React.FC<LegendProps> = ({ legendItems, colorBy, onColorByChange }) => { | ||
| const { t } = useTranslation(); | ||
| const [colorPopoverOpen, setColorPopoverOpen] = useState(false); | ||
| const colorButtonId = useId(); | ||
|
|
||
| return ( | ||
| <div className={styles.legendContainer}> | ||
| {legendItems.map(({ name, color }) => ( | ||
| <div key={name} className={styles.legendRow}> | ||
| <div className={styles.legendColorBox} style={{ backgroundColor: color }} /> | ||
| <span>{name}</span> | ||
| </div> | ||
| ))} | ||
| <div className={styles.legendWrapper}> | ||
| <div className={styles.legendContainer}> | ||
| {legendItems.map(({ name, color }) => ( | ||
| <div key={name} className={styles.legendRow}> | ||
| <div className={styles.legendColorBox} style={{ backgroundColor: color }} /> | ||
| <span>{name}</span> | ||
| </div> | ||
| ))} | ||
| </div> | ||
| <div className={styles.colorFilterContainer}> | ||
| <Popover | ||
| opener={colorButtonId} | ||
| open={colorPopoverOpen} | ||
| placement="Bottom" | ||
| onClose={() => setColorPopoverOpen(false)} | ||
| > | ||
| <div className={styles.popoverContent}> | ||
| <h4 className={styles.popoverHeader}>{t('Graphs.colorBy')}</h4> | ||
| <div className={styles.popoverButtonContainer}> | ||
| <Button | ||
| design={colorBy === 'source' ? 'Emphasized' : 'Default'} | ||
| onClick={() => { | ||
| onColorByChange('source'); | ||
| setColorPopoverOpen(false); | ||
| }} | ||
| > | ||
| {t('Graphs.colorsProvider')} | ||
| </Button> | ||
| <Button | ||
| design={colorBy === 'provider' ? 'Emphasized' : 'Default'} | ||
| onClick={() => { | ||
| onColorByChange('provider'); | ||
| setColorPopoverOpen(false); | ||
| }} | ||
| > | ||
| {t('Graphs.colorsProviderConfig')} | ||
| </Button> | ||
| <Button | ||
| design={colorBy === 'flux' ? 'Emphasized' : 'Default'} | ||
| onClick={() => { | ||
| onColorByChange('flux'); | ||
| setColorPopoverOpen(false); | ||
| }} | ||
| > | ||
| {t('Graphs.colorsFlux')} | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| </Popover> | ||
| <Button | ||
| id={colorButtonId} | ||
| design="Transparent" | ||
| icon="palette" | ||
| tooltip={t('Graphs.colorBy')} | ||
| onClick={() => setColorPopoverOpen(!colorPopoverOpen)} | ||
| /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.