Skip to content

Commit

Permalink
fix(kms): fix UI post ods18 upgrade
Browse files Browse the repository at this point in the history
ref: MANAGER-16501

Signed-off-by: Romain Jamet <[email protected]>
  • Loading branch information
Romain Jamet committed Dec 20, 2024
1 parent 1e22147 commit 54ef711
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import {
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import { useNavigate } from 'react-router-dom';
import { ODS_ICON_NAME, ODS_SPINNER_SIZE } from '@ovhcloud/ods-components';
import {
ODS_BUTTON_VARIANT,
ODS_ICON_NAME,
ODS_SPINNER_SIZE,
} from '@ovhcloud/ods-components';
import { OdsSpinner } from '@ovhcloud/ods-components/react';
import { OKMS } from '@/types/okms.type';
import { OkmsAllServiceKeys } from '@/types/okmsServiceKey.type';
Expand Down Expand Up @@ -138,6 +142,7 @@ export const DatagridServiceKeyActionMenu = (props: OkmsAllServiceKeys) => {
id={`service-key-actions-${props.id}`}
isLoading={isPending}
isCompact
variant={ODS_BUTTON_VARIANT.ghost}
icon={ODS_ICON_NAME.ellipsisVertical}
items={actionList}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
PageLocation,
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import { ODS_BUTTON_COLOR } from '@ovhcloud/ods-components';
import { ODS_BUTTON_COLOR, ODS_BUTTON_VARIANT } from '@ovhcloud/ods-components';
import { OkmsCredential } from '@/types/okmsCredential.type';
import { useFormattedDate } from '@/hooks/useFormattedDate';
import { CredentialStatus } from '../credentialStatus/CredentialStatus.component';
Expand Down Expand Up @@ -140,6 +140,7 @@ export const DatagridCredentialCellActions = (credential: OkmsCredential) => {
<ActionMenu
id={`credentialsActions-${credential.id}`}
items={items}
variant={ODS_BUTTON_VARIANT.ghost}
isCompact
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
PageLocation,
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import { OdsText, OdsButton, OdsCard } from '@ovhcloud/ods-components/react';
import { OdsText, OdsButton } from '@ovhcloud/ods-components/react';
import {
ODS_TEXT_PRESET,
ODS_BUTTON_SIZE,
ODS_BUTTON_COLOR,
} from '@ovhcloud/ods-components';
import { LinkType, Links, Subtitle } from '@ovh-ux/manager-react-components';
import { LinkType, Links } from '@ovh-ux/manager-react-components';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { ROUTES_URLS } from '@/routes/routes.constants';
Expand All @@ -38,34 +38,32 @@ const OrderConfirmation = ({ region }: OrderConfirmationProps) => {
}, [orderLink]);

return (
<>
<OdsCard className="mb-6 p-4">
<div className="flex flex-col gap-6 mb-6">
<Subtitle>
{t('key_management_service_create_order_initiated_title')}
</Subtitle>
<OdsText preset={ODS_TEXT_PRESET.paragraph}>
{t('key_management_service_create_order_initiated_subtitle')}
</OdsText>
<Links
type={LinkType.external}
label={orderLink}
target="_blank"
href={orderLink}
onClickReturn={() =>
trackClick({
location: PageLocation.funnel,
buttonType: ButtonType.externalLink,
actionType: 'navigation',
actions: ['go-back-order'],
})
}
/>
<OdsText preset={ODS_TEXT_PRESET.paragraph}>
{t('key_management_service_create_order_initiated_info')}
</OdsText>
</div>
</OdsCard>
<div className="flex flex-col gap-8">
<div className="flex flex-col gap-4">
<OdsText preset={ODS_TEXT_PRESET.heading2}>
{t('key_management_service_create_order_initiated_title')}
</OdsText>
<OdsText preset={ODS_TEXT_PRESET.paragraph}>
{t('key_management_service_create_order_initiated_subtitle')}
</OdsText>
<Links
type={LinkType.external}
label={orderLink}
target="_blank"
href={orderLink}
onClickReturn={() =>
trackClick({
location: PageLocation.funnel,
buttonType: ButtonType.externalLink,
actionType: 'navigation',
actions: ['go-back-order'],
})
}
/>
<OdsText preset={ODS_TEXT_PRESET.paragraph}>
{t('key_management_service_create_order_initiated_info')}
</OdsText>
</div>
<OdsButton
size={ODS_BUTTON_SIZE.md}
color={ODS_BUTTON_COLOR.primary}
Expand All @@ -80,7 +78,7 @@ const OrderConfirmation = ({ region }: OrderConfirmationProps) => {
}}
label={t('key_management_service_create_order_initiated_cta_done')}
/>
</>
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { useTranslation } from 'react-i18next';
import {
OdsText,
OdsSelect,
OdsFormField,
OdsButton,
OdsSpinner,
} from '@ovhcloud/ods-components/react';
Expand Down Expand Up @@ -57,59 +56,53 @@ const RegionSelector = ({
);
}
return (
<>
<div className="flex flex-col gap-6">
<OdsFormField className="mb-5">
<div slot="label">
<OdsText className="block" preset={ODS_TEXT_PRESET.heading5}>
{t('key_management_service_create_region_title')}
</OdsText>
<OdsText preset={ODS_TEXT_PRESET.paragraph}>
{t('key_management_service_create_region_description')}
</OdsText>
{isLoading && (
<OdsSpinner className="mr-3" size={ODS_SPINNER_SIZE.sm} />
)}
</div>
{orderCatalogOKMS && !isLoading && (
<OdsSelect
className="md:w-[250px] sm:w-full"
name="select-region"
placeholder={t(
'key_management_service_create_select_placeholder',
)}
onOdsChange={(v) => {
const value = v.detail.value?.toString();
<div className="flex flex-col gap-8">
<div className="flex flex-col gap-4">
<OdsText preset={ODS_TEXT_PRESET.heading2}>
{t('key_management_service_create_region_title')}
</OdsText>
<OdsText preset={ODS_TEXT_PRESET.paragraph}>
{t('key_management_service_create_region_description')}
</OdsText>
{isLoading && (
<OdsSpinner className="mr-3" size={ODS_SPINNER_SIZE.sm} />
)}
{orderCatalogOKMS && !isLoading && (
<OdsSelect
className="md:w-[250px] sm:w-full"
name="select-region"
placeholder={t('key_management_service_create_select_placeholder')}
onOdsChange={(v) => {
const value = v.detail.value?.toString();

if (value) {
trackClick({
location: PageLocation.funnel,
buttonType: ButtonType.select,
actionType: 'action',
actions: ['select_location', value],
});
if (value) {
trackClick({
location: PageLocation.funnel,
buttonType: ButtonType.select,
actionType: 'action',
actions: ['select_location', value],
});

selectRegion(value);
}
}}
>
{orderCatalogOKMS.plans[0].configurations[0].values.map(
(region) => (
<option
key={region}
value={region}
data-testid={`select-region-option-${region}`}
>
<Region
mode="region"
name={region.toLowerCase().replaceAll('_', '-')}
/>
</option>
),
)}
</OdsSelect>
)}
</OdsFormField>
selectRegion(value);
}
}}
>
{orderCatalogOKMS.plans[0].configurations[0].values.map(
(region) => (
<option
key={region}
value={region}
data-testid={`select-region-option-${region}`}
>
<Region
mode="region"
name={region.toLowerCase().replaceAll('_', '-')}
/>
</option>
),
)}
</OdsSelect>
)}
</div>
<div className="flex flex-row gap-4">
<OdsButton
Expand Down Expand Up @@ -145,7 +138,7 @@ const RegionSelector = ({
label={t('key_management_service_create_cta_order')}
/>
</div>
</>
</div>
);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const BillingInformationsTile = ({
'key_management_service_dashboard_field_label_next_billing_date',
),
value: (
<div className="flex flex-row justify-between items-center">
<div className="flex flex-row justify-between items-center gap-2">
<TileValueDate
value={okmsService?.billing.nextBillingDate}
options={dateFormat}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
ODS_ICON_NAME,
ODS_TEXT_PRESET,
ODS_BUTTON_COLOR,
ODS_BUTTON_SIZE,
} from '@ovhcloud/ods-components';
import {
ButtonType,
Expand Down Expand Up @@ -46,7 +47,7 @@ const InformationsTile = ({
id: 'name',
label: t('key_management_service_dashboard_field_label_name'),
value: (
<div className="flex justify-between items-center">
<div className="flex justify-between items-center gap-2">
<OdsText
preset={ODS_TEXT_PRESET.paragraph}
className="break-all"
Expand All @@ -56,6 +57,7 @@ const InformationsTile = ({
<div className="min-w-fit">
<OdsButton
aria-label="edit"
size={ODS_BUTTON_SIZE.sm}
variant={ODS_BUTTON_VARIANT.outline}
color={ODS_BUTTON_COLOR.primary}
onClick={() => navigate(ROUTES_URLS.okmsUpdateName)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ import {
useOvhTracking,
} from '@ovh-ux/manager-react-shell-client';
import React from 'react';
import { ODS_BUTTON_COLOR, ODS_ICON_NAME } from '@ovhcloud/ods-components';
import {
ODS_BUTTON_COLOR,
ODS_BUTTON_VARIANT,
ODS_ICON_NAME,
} from '@ovhcloud/ods-components';
import { useTranslation } from 'react-i18next';
import { useNavigate } from 'react-router-dom';
import { OKMS } from '@/types/okms.type';
Expand Down Expand Up @@ -39,6 +43,7 @@ const KmsActionMenu = ({ id }: OKMS) => {
items={items}
isCompact
icon={ODS_ICON_NAME.ellipsisVertical}
variant={ODS_BUTTON_VARIANT.ghost}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default function Create() {
const { t } = useTranslation('key-management-service/create');
const [isOrderInitiated, setIsOrderInitiated] = useState(false);
const [selectedRegion, setSelectedRegion] = useState(undefined);

return (
<div className="m-10">
<Breadcrumb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import {
ODS_BUTTON_COLOR,
ODS_BUTTON_SIZE,
ODS_BUTTON_VARIANT,
ODS_ICON_NAME,
ODS_TEXT_PRESET,
} from '@ovhcloud/ods-components';
Expand All @@ -35,7 +34,7 @@ const CredentialList = () => {
);

return (
<div className="flex flex-col gap-8 mt-8">
<div className="flex flex-col gap-4">
<OdsText preset={ODS_TEXT_PRESET.paragraph}>
{t('key_management_service_credential_headline')}
</OdsText>
Expand All @@ -44,7 +43,6 @@ const CredentialList = () => {
isLoading={isLoadingIam}
size={ODS_BUTTON_SIZE.sm}
color={ODS_BUTTON_COLOR.primary}
variant={ODS_BUTTON_VARIANT.outline}
className="w-fit"
onClick={() => {
trackClick({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
ODS_MESSAGE_COLOR,
ODS_BUTTON_SIZE,
ODS_ICON_NAME,
ODS_BUTTON_VARIANT,
ODS_TEXT_PRESET,
ODS_BUTTON_ICON_ALIGNMENT,
ODS_BUTTON_COLOR,
Expand Down Expand Up @@ -102,7 +101,7 @@ export default function Keys() {
);

return (
<div className="flex flex-col gap-8">
<div className="flex flex-col gap-4">
<OdsText preset={ODS_TEXT_PRESET.paragraph}>
{t('key_management_service_service-keys_headline')}
</OdsText>
Expand All @@ -111,28 +110,25 @@ export default function Keys() {
{tError('manager_error_page_default')}
</OdsMessage>
)}
<div>
<ManagerButton
id="createEncryptionKey"
size={ODS_BUTTON_SIZE.sm}
color={ODS_BUTTON_COLOR.primary}
variant={ODS_BUTTON_VARIANT.outline}
onClick={() => {
trackClick({
location: PageLocation.page,
buttonType: ButtonType.button,
actionType: 'action',
actions: ['create_encryption_key'],
});
navigate(ROUTES_URLS.createKmsServiceKey);
}}
urn={okms.iam.urn}
iamActions={[kmsIamActions.serviceKeyCreate]}
label={t('key_management_service_service-keys_cta_create')}
icon={ODS_ICON_NAME.plus}
iconAlignment={ODS_BUTTON_ICON_ALIGNMENT.left}
/>
</div>
<ManagerButton
id="createEncryptionKey"
size={ODS_BUTTON_SIZE.sm}
color={ODS_BUTTON_COLOR.primary}
onClick={() => {
trackClick({
location: PageLocation.page,
buttonType: ButtonType.button,
actionType: 'action',
actions: ['create_encryption_key'],
});
navigate(ROUTES_URLS.createKmsServiceKey);
}}
urn={okms.iam.urn}
iamActions={[kmsIamActions.serviceKeyCreate]}
label={t('key_management_service_service-keys_cta_create')}
icon={ODS_ICON_NAME.plus}
iconAlignment={ODS_BUTTON_ICON_ALIGNMENT.left}
/>
<Datagrid
columns={columns}
items={okmsServiceKey || []}
Expand Down
Loading

0 comments on commit 54ef711

Please sign in to comment.