Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
MonPote committed Sep 20, 2024
1 parent 37a7e48 commit 70699f0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
},
},
},
Expand Down Expand Up @@ -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'),
},
},
},
Expand Down
77 changes: 34 additions & 43 deletions src/react/databrowser/objects/details/Properties.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -203,47 +203,38 @@ function Properties({ objectMetadata }: Props) {
<T.Key> Lock </T.Key>
<T.GroupValues>
<div>
{
//@ts-expect-error fix this when you are working on it
objectMetadata.lockStatus === 'LOCKED' && (
<>
Locked <Icon name="Lock" /> (
{objectMetadata.objectRetention.mode.toLowerCase()})
<br />
until{' '}
<FormattedDateTime
format="date-time-second"
value={
new Date(
objectMetadata.objectRetention.retainUntilDate,
)
}
/>
</>
)
}
{
//@ts-expect-error fix this when you are working on it
objectMetadata.lockStatus === 'RELEASED' && (
<>
Released <Icon name="Lock-open" />
<br />
since{' '}
<FormattedDateTime
format="date-time-second"
value={
new Date(
objectMetadata.objectRetention.retainUntilDate,
)
}
/>
</>
)
}
{
//@ts-expect-error fix this when you are working on it
objectMetadata.lockStatus === 'NONE' && 'No retention'
}
{objectMetadata.lockStatus === 'LOCKED' && (
<>
Locked <Icon name="Lock" /> (
{objectMetadata.objectRetention.mode.toLowerCase()})
<br />
until{' '}
<FormattedDateTime
format="date-time-second"
value={
new Date(
objectMetadata.objectRetention.retainUntilDate,
)
}
/>
</>
)}
{objectMetadata.lockStatus === 'RELEASED' && (
<>
Released <Icon name="Lock-open" />
<br />
since{' '}
<FormattedDateTime
format="date-time-second"
value={
new Date(
objectMetadata.objectRetention.retainUntilDate,
)
}
/>
</>
)}
{objectMetadata.lockStatus === 'NONE' && 'No retention'}
</div>
{isObjectLockEnabled && (
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import Properties from '../Properties';
import { getConfigOverlay } from '../../../../../js/mock/managementClientMSWHandlers';

const renderProperties = (
component: React.ReactNode = <Properties objectMetadata={OBJECT_METADATA} />,
component: React.ReactNode = (
<Properties objectMetadata={{ ...OBJECT_METADATA, lockStatus: 'NONE' }} />
),
state = {},
) => {
return renderWithRouterMatch(
Expand Down

0 comments on commit 70699f0

Please sign in to comment.