generated from openmcp-project/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add hint section to MCP overview page
#251
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 25 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
97d852d
feat: add hint object to guide users in quality management
Lasserich e5d5796
feat: populate crossplane and flux with data
Lasserich 319d67d
fix: make linitii happii
Lasserich 8263c6f
feat: use new types
Lasserich 81a95ec
fix: I love AI sometimes
Lasserich 5f5620d
feat: expand radar chart
Lasserich 0a15232
Merge branch 'main' into pr/251
lucasgoral ba9de76
Update listManagedResources.ts
lucasgoral 4ad9302
Update Hints.tsx
lucasgoral 1cc1189
fix: smaller stuff
Lasserich e0cb0ef
Merge branch 'ft/hints' of https://github.com/Lasserich/ui-frontend i…
Lasserich 26001d9
feat: fix darkmode
Lasserich 4939d67
Merge branch 'main' into ft/hints
Lasserich 82a4341
feat: nice bars!!
Lasserich 79b952c
feat: generify
Lasserich 7fbd8cd
fix: cleanup
Lasserich ccf9035
feat: cleanup
Lasserich ccc3686
test: added some
Lasserich fee5f26
fix: darkmode
Lasserich fadf3ac
fix: linting
Lasserich 5dace2d
fix: on activate
Lasserich 291c54e
feat: re-usable hover
Lasserich b2f9f93
feat: crossplane and flux component ready for review
Lasserich 8b89e31
fix: disable vault for now since it does not have stats yet
Lasserich 2b45192
Merge branch 'main' into ft/hints
lucasgoral bd550d9
feat: incorporate feedback
Lasserich 874a80b
Merge branch 'ft/hints' of https://github.com/Lasserich/ui-frontend i…
Lasserich aa745ad
fix: npm run lint:fix :)(:
Lasserich 530a862
fix: zIndex
Lasserich 9bdb8b2
fix: remove info, coming soon, downsize vault
Lasserich 4978b76
fix: build
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| import React, { useState } from 'react'; | ||
| import { Card, CardHeader, MessageViewButton } from '@ui5/webcomponents-react'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import cx from 'clsx'; | ||
| import { MultiPercentageBar } from './MultiPercentageBar'; | ||
| import { GenericHintProps } from './types'; | ||
| import { styles } from './Hints'; | ||
| import { HoverContent } from './HoverContent'; | ||
|
|
||
| export const GenericHint: React.FC<GenericHintProps> = ({ | ||
Lasserich marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| enabled = false, | ||
| version, | ||
| onActivate, | ||
| allItems = [], | ||
| isLoading, | ||
| error, | ||
| config, | ||
| }) => { | ||
| const { t } = useTranslation(); | ||
| const [hovered, setHovered] = useState(false); | ||
|
|
||
| // Calculate segments and state using the provided calculator | ||
| const hintState = config.calculateSegments(allItems, isLoading || false, error, enabled, t); | ||
|
|
||
| // Handle click navigation if scroll target is provided | ||
| const handleClick = | ||
| enabled && config.scrollTarget | ||
| ? () => { | ||
| const el = document.querySelector(config.scrollTarget!); | ||
| if (el) { | ||
| el.scrollIntoView({ behavior: 'smooth', block: 'start' }); | ||
| } | ||
| } | ||
| : undefined; | ||
|
|
||
| return ( | ||
| <div style={{ position: 'relative', width: '100%' }}> | ||
| <Card | ||
| header={ | ||
| <CardHeader | ||
| additionalText={enabled ? `v${version ?? ''}` : undefined} | ||
| avatar={ | ||
| <img | ||
| src={config.iconSrc} | ||
| alt={config.iconAlt} | ||
| style={{ | ||
| width: 50, | ||
| height: 50, | ||
| borderRadius: '50%', | ||
| background: 'transparent', | ||
| objectFit: 'cover', | ||
| ...config.iconStyle, | ||
| }} | ||
| /> | ||
| } | ||
| titleText={config.title} | ||
| subtitleText={config.subtitle} | ||
| interactive={enabled} | ||
| /> | ||
| } | ||
| className={cx({ | ||
| [styles['disabled']]: !enabled, | ||
| })} | ||
| onClick={handleClick} | ||
| onMouseEnter={enabled ? () => setHovered(true) : undefined} | ||
| onMouseLeave={enabled ? () => setHovered(false) : undefined} | ||
| > | ||
| {/* Disabled overlay */} | ||
| {!enabled && <div className={styles.disabledOverlay} />} | ||
|
|
||
| <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center', padding: '0.5rem 0' }}> | ||
| <div | ||
| style={{ | ||
| display: 'flex', | ||
| gap: '8px', | ||
| width: '100%', | ||
| maxWidth: 500, | ||
| padding: '0 0.5rem', | ||
| }} | ||
| > | ||
| <MultiPercentageBar | ||
| segments={hintState.segments} | ||
| style={{ width: '100%' }} | ||
| label={hintState.label} | ||
| showPercentage={hintState.showPercentage} | ||
| isHealthy={hintState.isHealthy} | ||
| showOnlyNonZero={hintState.showOnlyNonZero ?? true} | ||
| /> | ||
| </div> | ||
| </div> | ||
|
|
||
| {/* Hover content (e.g., RadarChart for Crossplane) */} | ||
Lasserich marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| {enabled && | ||
| hovered && | ||
| config.calculateHoverData && | ||
| (() => { | ||
| const hoverData = config.calculateHoverData(allItems, enabled, t); | ||
| return hoverData ? <HoverContent enabled={enabled} isLoading={isLoading} {...hoverData} /> : null; | ||
| })()} | ||
|
|
||
| {/* Legacy hover content support */} | ||
Lasserich marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| {enabled && | ||
| hovered && | ||
| !config.calculateHoverData && | ||
| config.renderHoverContent && | ||
| config.renderHoverContent(allItems, enabled)} | ||
|
|
||
| {/* Activate button for disabled state */} | ||
| {!enabled && ( | ||
| <div | ||
| style={{ | ||
| position: 'absolute', | ||
| top: '16px', | ||
| right: '16px', | ||
| zIndex: 2, | ||
| pointerEvents: 'auto', | ||
| }} | ||
| > | ||
| <MessageViewButton | ||
| type={'Information'} | ||
| style={{ cursor: onActivate ? 'pointer' : 'default' }} | ||
| onClick={onActivate} | ||
| /> | ||
| </div> | ||
| )} | ||
| </Card> | ||
| </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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| .disabled { | ||
| position: relative; | ||
| } | ||
|
|
||
| .disabledOverlay { | ||
| position: absolute; | ||
| top: 0; | ||
| left: 0; | ||
| right: 0; | ||
| bottom: 0; | ||
| background: rgba(255, 255, 255, 0.6); | ||
| backdrop-filter: grayscale(0.9) blur(0.5px); | ||
| border-radius: inherit; | ||
| z-index: 1; | ||
| pointer-events: none; | ||
| } | ||
|
|
||
| /* Legend Styles */ | ||
| .legendSection { | ||
| color: var(--sapTextColor, #374151); | ||
| } | ||
|
|
||
| .legendTitle { | ||
| color: var(--sapTitleColor, var(--sapTextColor, #374151)); | ||
| } | ||
|
|
||
| .legendItem { | ||
| color: var(--sapContent_LabelColor, #6b7280); | ||
| } | ||
|
|
||
| /* Dark mode support */ | ||
| @media (prefers-color-scheme: dark) { | ||
| .disabledOverlay { | ||
| background: rgba(0, 0, 0, 0.4); | ||
| } | ||
|
|
||
| .chartBackground { | ||
| background-color: #2a2a2a; | ||
| } | ||
|
|
||
| .chartLabel { | ||
| color: #ffffff; | ||
| } | ||
|
|
||
| .legendSection { | ||
| color: #ffffff; | ||
| } | ||
|
|
||
| .legendTitle { | ||
| color: #ffffff; | ||
| } | ||
|
|
||
| .legendItem { | ||
| color: #cccccc; | ||
| } | ||
| } | ||
|
|
||
| /* Also check for UI5 theme variables for dark themes */ | ||
| [data-ui5-theme-root*="dark"] .disabledOverlay, | ||
| [data-ui5-theme*="dark"] .disabledOverlay { | ||
| background: rgba(0, 0, 0, 0.4); | ||
| } | ||
|
|
||
| [data-ui5-theme-root*="dark"] .legendSection, | ||
| [data-ui5-theme*="dark"] .legendSection { | ||
| color: #ffffff; | ||
| } | ||
|
|
||
| [data-ui5-theme-root*="dark"] .legendTitle, | ||
| [data-ui5-theme*="dark"] .legendTitle { | ||
| color: #ffffff; | ||
| } | ||
|
|
||
| [data-ui5-theme-root*="dark"] .legendItem, | ||
| [data-ui5-theme*="dark"] .legendItem { | ||
| color: #cccccc; | ||
| } | ||
|
|
||
| /* Hover Content Animation */ | ||
| .hoverContent { | ||
| overflow: hidden; | ||
| transition: all 0.3s ease-in-out; | ||
| animation: expandIn 0.3s ease-in-out; | ||
| } | ||
|
|
||
| @keyframes expandIn { | ||
| from { | ||
| max-height: 0; | ||
| opacity: 0; | ||
| transform: scaleY(0); | ||
| transform-origin: top; | ||
| } | ||
| to { | ||
| max-height: 500px; | ||
| opacity: 1; | ||
| transform: scaleY(1); | ||
| transform-origin: top; | ||
| } | ||
| } | ||
|
|
||
| .hoverContentLoading { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| height: 300px; | ||
| } |
Oops, something went wrong.
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.