From eefb3b6248af5d7aebd20d64ce5e830ac2d7e860 Mon Sep 17 00:00:00 2001 From: Patrick Ear Date: Thu, 19 Sep 2024 16:35:10 +0200 Subject: [PATCH] fix types --- .../__tests__/ObjectLockSetting.test.tsx | 4 +- .../objects/details/Properties.tsx | 77 ++++++++----------- .../details/__tests__/Properties.test.tsx | 4 +- 3 files changed, 39 insertions(+), 46 deletions(-) diff --git a/src/react/databrowser/objects/__tests__/ObjectLockSetting.test.tsx b/src/react/databrowser/objects/__tests__/ObjectLockSetting.test.tsx index f4c7bc834..86d5f1304 100644 --- a/src/react/databrowser/objects/__tests__/ObjectLockSetting.test.tsx +++ b/src/react/databrowser/objects/__tests__/ObjectLockSetting.test.tsx @@ -42,7 +42,7 @@ describe('ObjectLockSetting', () => { bucketName: 'test-bucket', objectRetention: { mode: 'GOVERNANCE', - retainUntilDate: '2022-01-31 00:00:00"', + retainUntilDate: new Date('2022-01-31 00:00:00'), }, }, }, @@ -72,7 +72,7 @@ describe('ObjectLockSetting', () => { bucketName: 'test-bucket', objectRetention: { mode: 'COMPLIANCE', - retainUntilDate: '2022-01-31 00:00:00"', + retainUntilDate: new Date('2022-01-31 00:00:00'), }, }, }, diff --git a/src/react/databrowser/objects/details/Properties.tsx b/src/react/databrowser/objects/details/Properties.tsx index 269856c12..ed57106e8 100644 --- a/src/react/databrowser/objects/details/Properties.tsx +++ b/src/react/databrowser/objects/details/Properties.tsx @@ -2,7 +2,7 @@ import Table, * as T from '../../../ui-elements/TableKeyValue2'; import { Clipboard } from '../../../ui-elements/Clipboard'; import MiddleEllipsis from '../../../ui-elements/MiddleEllipsis'; -import type { ObjectMetadata } from '../../../../types/s3'; +import type { ObjectEntity, ObjectMetadata } from '../../../../types/s3'; import { FormattedDateTime, Icon, @@ -31,7 +31,7 @@ import { } from '../../../ui-elements/Veeam/VeeamConstants'; type Props = { - objectMetadata: ObjectMetadata; + objectMetadata: ObjectMetadata & { lockStatus?: ObjectEntity['lockStatus'] }; }; const TruncatedValue = styled.div` max-width: 18rem; @@ -203,47 +203,38 @@ function Properties({ objectMetadata }: Props) { Lock
- { - //@ts-expect-error fix this when you are working on it - objectMetadata.lockStatus === 'LOCKED' && ( - <> - Locked ( - {objectMetadata.objectRetention.mode.toLowerCase()}) -
- until{' '} - - - ) - } - { - //@ts-expect-error fix this when you are working on it - objectMetadata.lockStatus === 'RELEASED' && ( - <> - Released -
- since{' '} - - - ) - } - { - //@ts-expect-error fix this when you are working on it - objectMetadata.lockStatus === 'NONE' && 'No retention' - } + {objectMetadata.lockStatus === 'LOCKED' && ( + <> + Locked ( + {objectMetadata.objectRetention.mode.toLowerCase()}) +
+ until{' '} + + + )} + {objectMetadata.lockStatus === 'RELEASED' && ( + <> + Released +
+ since{' '} + + + )} + {objectMetadata.lockStatus === 'NONE' && 'No retention'}
{isObjectLockEnabled && (