-
Notifications
You must be signed in to change notification settings - Fork 99
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
feat(manager-react-component): add service state badge component #15065
base: develop
Are you sure you want to change the base?
Conversation
packages/manager-react-components/src/components/ServiceStateBadge/ServiceStateBadge.tsx
Outdated
Show resolved
Hide resolved
packages/manager-react-components/src/components/ServiceStateBadge/ServiceStateBadge.spec.tsx
Outdated
Show resolved
Hide resolved
packages/manager-react-components/src/components/ServiceStateBadge/ServiceStateBadge.spec.tsx
Show resolved
Hide resolved
76c8b98
to
db435f1
Compare
@@ -0,0 +1,31 @@ | |||
import fr_FR from '@ovh-ux/manager-common-translations/dist/@ovh-ux/manager-common-translations/service/Messages_fr_FR.json'; |
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.
this seems risky and also the tests fails because of it, is it the way we should import it ? I don't think so but I'm not sure
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.
I think we need build the module before test.
Signed-off-by: Thibault Barske <[email protected]>
d8dc2f7
db435f1
to
d8dc2f7
Compare
|
@@ -0,0 +1,31 @@ | |||
import fr_FR from '@ovh-ux/manager-common-translations/dist/@ovh-ux/manager-common-translations/service/Messages_fr_FR.json'; |
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.
Dont import with relative paths as it is risky.
Use mock instead.
const stateConfig: Record< | ||
ResourceStatus, | ||
{ label: string; color: OdsBadgeColor } | ||
> = { | ||
active: { label: 'service_state_active', color: 'success' }, | ||
deleted: { label: 'service_state_deleted', color: 'critical' }, | ||
suspended: { label: 'service_state_suspended', color: 'warning' }, | ||
toActivate: { label: 'service_state_toActivate', color: 'information' }, | ||
toDelete: { label: 'service_state_toDelete', color: 'information' }, | ||
toSuspend: { label: 'service_state_toSuspend', color: 'information' }, | ||
}; |
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.
nitpick: You can also export the available states from the component so that developers can easily import the available state and have the typings suggest them available states and avoid misconfiguration.
const stateConfig: Record< | |
ResourceStatus, | |
{ label: string; color: OdsBadgeColor } | |
> = { | |
active: { label: 'service_state_active', color: 'success' }, | |
deleted: { label: 'service_state_deleted', color: 'critical' }, | |
suspended: { label: 'service_state_suspended', color: 'warning' }, | |
toActivate: { label: 'service_state_toActivate', color: 'information' }, | |
toDelete: { label: 'service_state_toDelete', color: 'information' }, | |
toSuspend: { label: 'service_state_toSuspend', color: 'information' }, | |
}; | |
export const STATES: Record< | |
ResourceStatus, | |
{ label: string; color: OdsBadgeColor } | |
> = { | |
ACTIVE: { label: 'service_state_active', color: 'success' }, | |
DELETED: { label: 'service_state_deleted', color: 'critical' }, | |
SUSPENDED: { label: 'service_state_suspended', color: 'warning' }, | |
TO_ACTIVATE: { label: 'service_state_toActivate', color: 'information' }, | |
TO_DELETE: { label: 'service_state_toDelete', color: 'information' }, | |
TO_SUSPEND: { label: 'service_state_toSuspend', color: 'information' }, | |
}; |
This Pull Request is stale due to inactivity since 30 days. If no activity happens for 15 more days from now, it will be closed. |
develop
Description
Related
#15061