-
Notifications
You must be signed in to change notification settings - Fork 11
feat(Cluster): redesign cluster dashboard #2176
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
Open
Raubzeug
wants to merge
1
commit into
main
Choose a base branch
from
cluster-redesign
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
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
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,10 @@ | ||
.ydb-entity-status-new { | ||
.g-help-mark__button { | ||
color: inherit; | ||
} | ||
|
||
&_orange.g-label { | ||
color: var(--g-color-private-orange-500); | ||
background-color: var(--g-color-private-orange-100); | ||
} | ||
} |
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,95 @@ | ||
import React from 'react'; | ||
|
||
import type {LabelProps} from '@gravity-ui/uikit'; | ||
import {ActionTooltip, Flex, HelpMark, Label} from '@gravity-ui/uikit'; | ||
|
||
import {EFlag} from '../../types/api/enums'; | ||
import {cn} from '../../utils/cn'; | ||
import {StatusIcon} from '../StatusIconNew/StatusIcon'; | ||
|
||
import i18n from './i18n'; | ||
import {EFlagToDescription} from './utils'; | ||
|
||
import './EntityStatus.scss'; | ||
|
||
const b = cn('ydb-entity-status-new'); | ||
|
||
const EFlagToLabelTheme: Record<EFlag, LabelProps['theme'] | 'orange'> = { | ||
[EFlag.Red]: 'danger', | ||
[EFlag.Blue]: 'info', | ||
[EFlag.Green]: 'success', | ||
[EFlag.Grey]: 'unknown', | ||
[EFlag.Orange]: 'orange', | ||
[EFlag.Yellow]: 'warning', | ||
}; | ||
|
||
const EFlagToStatusName: Record<EFlag, string> = { | ||
get [EFlag.Red]() { | ||
return i18n('title_red'); | ||
}, | ||
get [EFlag.Yellow]() { | ||
return i18n('title_yellow'); | ||
}, | ||
get [EFlag.Orange]() { | ||
return i18n('title_orange'); | ||
}, | ||
get [EFlag.Green]() { | ||
return i18n('title_green'); | ||
}, | ||
get [EFlag.Grey]() { | ||
return i18n('title_grey'); | ||
}, | ||
get [EFlag.Blue]() { | ||
return i18n('title_blue'); | ||
}, | ||
}; | ||
|
||
interface EntityStatusLabelProps { | ||
status: EFlag; | ||
note?: React.ReactNode; | ||
children?: React.ReactNode; | ||
withStatusName?: boolean; | ||
size?: LabelProps['size']; | ||
} | ||
|
||
function EntityStatusLabel({ | ||
children, | ||
status, | ||
withStatusName = true, | ||
note, | ||
size = 'm', | ||
}: EntityStatusLabelProps) { | ||
const theme = EFlagToLabelTheme[status]; | ||
return ( | ||
<ActionTooltip title={EFlagToDescription[status]} disabled={Boolean(note)}> | ||
<Label | ||
theme={theme === 'orange' ? undefined : theme} | ||
icon={<StatusIcon status={status} />} | ||
size={size} | ||
className={b({orange: theme === 'orange'})} | ||
> | ||
<Flex gap="2" wrap="nowrap"> | ||
{children} | ||
{withStatusName ? EFlagToStatusName[status] : null} | ||
{note && <HelpMark>{note}</HelpMark>} | ||
</Flex> | ||
</Label> | ||
</ActionTooltip> | ||
); | ||
} | ||
|
||
interface EntityStatusProps { | ||
children?: React.ReactNode; | ||
className?: string; | ||
} | ||
|
||
export function EntityStatus({className, children}: EntityStatusProps) { | ||
return ( | ||
<Flex gap="2" wrap="nowrap" alignItems="center" className={b(null, className)}> | ||
{children} | ||
</Flex> | ||
); | ||
} | ||
|
||
EntityStatus.Label = EntityStatusLabel; | ||
EntityStatus.displayName = 'EntityStatus'; |
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,14 @@ | ||
{ | ||
"title_red": "Failed", | ||
"title_blue": "Normal", | ||
"title_green": "Good", | ||
"title_grey": "Unknown", | ||
"title_orange": "Caution", | ||
"title_yellow": "Warning", | ||
"context_red": "Some systems are failed and not available", | ||
"context_yellow": "There are minor issues", | ||
"context_orange": "Critical state, requires immediate attention", | ||
"context_green": "Everything is working as expected", | ||
"context_grey": "The condition cannot be determined", | ||
"context_blue": "All good, some parts of the system are restoring" | ||
} |
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,7 @@ | ||
import {registerKeysets} from '../../../utils/i18n'; | ||
|
||
import en from './en.json'; | ||
|
||
const COMPONENT = 'ydb-entity-status'; | ||
|
||
export default registerKeysets(COMPONENT, {en}); |
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,6 @@ | ||
{ | ||
"403.title": "Доступ запрещен", | ||
"403.description": "У вас недостаточно прав для просмотра данной страницы.", | ||
"responseError.defaultMessage": "Ошибка запроса", | ||
"error.title": "Ошибка" | ||
} | ||
Comment on lines
+1
to
+6
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These keys don't correspond to |
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,24 @@ | ||
import {EFlag} from '../../types/api/enums'; | ||
|
||
import i18n from './i18n'; | ||
|
||
export const EFlagToDescription: Record<EFlag, string> = { | ||
get [EFlag.Red]() { | ||
return i18n('context_red'); | ||
}, | ||
get [EFlag.Yellow]() { | ||
return i18n('context_yellow'); | ||
}, | ||
get [EFlag.Orange]() { | ||
return i18n('context_orange'); | ||
}, | ||
get [EFlag.Green]() { | ||
return i18n('context_green'); | ||
}, | ||
get [EFlag.Grey]() { | ||
return i18n('context_grey'); | ||
}, | ||
get [EFlag.Blue]() { | ||
return i18n('context_blue'); | ||
}, | ||
}; |
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,31 @@ | ||
import { | ||
CircleCheck, | ||
CircleExclamation, | ||
CircleInfo, | ||
PlugConnection, | ||
TriangleExclamation, | ||
} from '@gravity-ui/icons'; | ||
import type {IconProps} from '@gravity-ui/uikit'; | ||
import {Icon} from '@gravity-ui/uikit'; | ||
|
||
import {EFlag} from '../../types/api/enums'; | ||
|
||
const EFlagToIcon: Record<EFlag, (props: React.SVGProps<SVGSVGElement>) => React.JSX.Element> = { | ||
[EFlag.Blue]: CircleInfo, | ||
[EFlag.Yellow]: CircleExclamation, | ||
[EFlag.Orange]: TriangleExclamation, | ||
[EFlag.Red]: CircleExclamation, | ||
[EFlag.Green]: CircleCheck, | ||
[EFlag.Grey]: PlugConnection, | ||
}; | ||
|
||
interface StatusIconProps extends Omit<IconProps, 'data'> { | ||
status?: EFlag; | ||
} | ||
|
||
export function StatusIcon({status, ...props}: StatusIconProps) { | ||
if (!status) { | ||
return null; | ||
} | ||
return <Icon {...props} data={EFlagToIcon[status]} />; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,18 @@ | ||
import React from 'react'; | ||
|
||
import type {FlexProps} from '@gravity-ui/uikit'; | ||
import {Flex} from '@gravity-ui/uikit'; | ||
|
||
import type {TagType} from '../Tag'; | ||
import {Tag} from '../Tag'; | ||
import {Flex, Label} from '@gravity-ui/uikit'; | ||
|
||
interface TagsProps { | ||
tags: React.ReactNode[]; | ||
tagsType?: TagType; | ||
className?: string; | ||
gap?: FlexProps['gap']; | ||
} | ||
|
||
export const Tags = ({tags, tagsType, className = '', gap = 1}: TagsProps) => { | ||
export const Tags = ({tags, className = '', gap = 1}: TagsProps) => { | ||
return ( | ||
<Flex className={className} gap={gap} wrap="wrap" alignItems="center"> | ||
{tags && | ||
tags.map((tag, tagIndex) => <Tag text={tag} key={tagIndex} type={tagsType}></Tag>)} | ||
{tags && tags.map((tag, tagIndex) => <Label key={tagIndex}>{tag}</Label>)} | ||
</Flex> | ||
); | ||
}; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be moved to utils so it will be together with
EFlagToDescription