@scality/data-browser-library 1.0.0-preview.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Editor.d.ts +12 -0
- package/dist/components/Editor.js +28 -0
- package/dist/components/__tests__/BucketCreate.test.d.ts +1 -0
- package/dist/components/__tests__/BucketCreate.test.js +408 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.js +618 -0
- package/dist/components/__tests__/BucketLifecycleList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketLifecycleList.test.js +325 -0
- package/dist/components/__tests__/BucketList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketList.test.js +415 -0
- package/dist/components/__tests__/BucketNotificationCreatePage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +316 -0
- package/dist/components/__tests__/BucketOverview.test.d.ts +1 -0
- package/dist/components/__tests__/BucketOverview.test.js +769 -0
- package/dist/components/__tests__/BucketPolicyPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketPolicyPage.test.js +268 -0
- package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketReplicationFormPage.test.js +1757 -0
- package/dist/components/__tests__/BucketReplicationList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketReplicationList.test.js +344 -0
- package/dist/components/__tests__/CreateFolderButton.test.d.ts +1 -0
- package/dist/components/__tests__/CreateFolderButton.test.js +147 -0
- package/dist/components/__tests__/DeleteBucketButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteBucketButton.test.js +272 -0
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +196 -0
- package/dist/components/__tests__/DeleteObjectButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteObjectButton.test.js +302 -0
- package/dist/components/__tests__/EmptyBucketButton.test.d.ts +1 -0
- package/dist/components/__tests__/EmptyBucketButton.test.js +302 -0
- package/dist/components/__tests__/MetadataSearch.test.d.ts +1 -0
- package/dist/components/__tests__/MetadataSearch.test.js +201 -0
- package/dist/components/__tests__/ObjectList.test.d.ts +1 -0
- package/dist/components/__tests__/ObjectList.test.js +283 -0
- package/dist/components/__tests__/UploadButton.test.d.ts +1 -0
- package/dist/components/__tests__/UploadButton.test.js +144 -0
- package/dist/components/buckets/BucketCreate.d.ts +49 -0
- package/dist/components/buckets/BucketCreate.js +237 -0
- package/dist/components/buckets/BucketDetails.d.ts +1 -0
- package/dist/components/buckets/BucketDetails.js +106 -0
- package/dist/components/buckets/BucketLifecycleFormPage.d.ts +15 -0
- package/dist/components/buckets/BucketLifecycleFormPage.js +1085 -0
- package/dist/components/buckets/BucketLifecycleList.d.ts +10 -0
- package/dist/components/buckets/BucketLifecycleList.js +270 -0
- package/dist/components/buckets/BucketList.d.ts +15 -0
- package/dist/components/buckets/BucketList.js +146 -0
- package/dist/components/buckets/BucketLocation.d.ts +3 -0
- package/dist/components/buckets/BucketLocation.js +16 -0
- package/dist/components/buckets/BucketOverview.d.ts +88 -0
- package/dist/components/buckets/BucketOverview.js +291 -0
- package/dist/components/buckets/BucketPage.d.ts +2 -0
- package/dist/components/buckets/BucketPage.js +47 -0
- package/dist/components/buckets/BucketPolicyButton.d.ts +7 -0
- package/dist/components/buckets/BucketPolicyButton.js +18 -0
- package/dist/components/buckets/BucketPolicyPage.d.ts +1 -0
- package/dist/components/buckets/BucketPolicyPage.js +236 -0
- package/dist/components/buckets/BucketReplicationFormPage.d.ts +1 -0
- package/dist/components/buckets/BucketReplicationFormPage.js +834 -0
- package/dist/components/buckets/BucketReplicationList.d.ts +11 -0
- package/dist/components/buckets/BucketReplicationList.js +189 -0
- package/dist/components/buckets/BucketVersioning.d.ts +4 -0
- package/dist/components/buckets/BucketVersioning.js +73 -0
- package/dist/components/buckets/DeleteBucketButton.d.ts +8 -0
- package/dist/components/buckets/DeleteBucketButton.js +78 -0
- package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +18 -0
- package/dist/components/buckets/DeleteBucketConfigRuleButton.js +53 -0
- package/dist/components/buckets/EmptyBucketButton.d.ts +5 -0
- package/dist/components/buckets/EmptyBucketButton.js +232 -0
- package/dist/components/buckets/EmptyBucketSummary.d.ts +9 -0
- package/dist/components/buckets/EmptyBucketSummary.js +60 -0
- package/dist/components/buckets/EmptyBucketSummaryList.d.ts +13 -0
- package/dist/components/buckets/EmptyBucketSummaryList.js +140 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.d.ts +1 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.js +163 -0
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.d.ts +1 -0
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +234 -0
- package/dist/components/buckets/notifications/EventsSection.d.ts +1 -0
- package/dist/components/buckets/notifications/EventsSection.js +123 -0
- package/dist/components/buckets/notifications/events.d.ts +12 -0
- package/dist/components/buckets/notifications/events.js +27 -0
- package/dist/components/index.d.ts +21 -0
- package/dist/components/index.js +22 -0
- package/dist/components/layouts/ArrowNavigation.d.ts +4 -0
- package/dist/components/layouts/ArrowNavigation.js +16 -0
- package/dist/components/layouts/BrowserPageLayout.d.ts +12 -0
- package/dist/components/layouts/BrowserPageLayout.js +51 -0
- package/dist/components/objects/CreateFolderButton.d.ts +29 -0
- package/dist/components/objects/CreateFolderButton.js +118 -0
- package/dist/components/objects/DeleteObjectButton.d.ts +8 -0
- package/dist/components/objects/DeleteObjectButton.js +191 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +2 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.js +356 -0
- package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +3 -0
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +241 -0
- package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +3 -0
- package/dist/components/objects/ObjectDetails/ObjectTags.js +272 -0
- package/dist/components/objects/ObjectDetails/index.d.ts +9 -0
- package/dist/components/objects/ObjectDetails/index.js +75 -0
- package/dist/components/objects/ObjectList.d.ts +40 -0
- package/dist/components/objects/ObjectList.js +453 -0
- package/dist/components/objects/ObjectLock/EditRetentionButton.d.ts +4 -0
- package/dist/components/objects/ObjectLock/EditRetentionButton.js +32 -0
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.d.ts +3 -0
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +211 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +9 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettings.js +158 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +8 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +39 -0
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.d.ts +1 -0
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +204 -0
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.d.ts +1 -0
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +374 -0
- package/dist/components/objects/ObjectPage.d.ts +1 -0
- package/dist/components/objects/ObjectPage.js +45 -0
- package/dist/components/objects/UploadButton.d.ts +34 -0
- package/dist/components/objects/UploadButton.js +229 -0
- package/dist/components/providers/DataBrowserProvider.d.ts +20 -0
- package/dist/components/providers/DataBrowserProvider.js +42 -0
- package/dist/components/search/MetadataSearch.d.ts +5 -0
- package/dist/components/search/MetadataSearch.js +162 -0
- package/dist/components/search/SearchHints.d.ts +8 -0
- package/dist/components/search/SearchHints.js +21 -0
- package/dist/components/ui/ArrayFieldActions.d.ts +36 -0
- package/dist/components/ui/ArrayFieldActions.js +43 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +16 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.js +43 -0
- package/dist/components/ui/DeleteObjectModalContent.d.ts +5 -0
- package/dist/components/ui/DeleteObjectModalContent.js +71 -0
- package/dist/components/ui/FilterFormSection.d.ts +44 -0
- package/dist/components/ui/FilterFormSection.js +159 -0
- package/dist/components/ui/Search.elements.d.ts +17 -0
- package/dist/components/ui/Search.elements.js +59 -0
- package/dist/components/ui/Table.elements.d.ts +36 -0
- package/dist/components/ui/Table.elements.js +87 -0
- package/dist/config/factory.d.ts +63 -0
- package/dist/config/factory.js +74 -0
- package/dist/config/types.d.ts +46 -0
- package/dist/config/types.js +0 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.d.ts +1 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.js +188 -0
- package/dist/hooks/__tests__/useIsBucketEmpty.test.d.ts +1 -0
- package/dist/hooks/__tests__/useIsBucketEmpty.test.js +122 -0
- package/dist/hooks/bucketConfiguration.d.ts +168 -0
- package/dist/hooks/bucketConfiguration.js +67 -0
- package/dist/hooks/bucketOperations.d.ts +36 -0
- package/dist/hooks/bucketOperations.js +12 -0
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +276 -0
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +259 -0
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +166 -0
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +200 -0
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +179 -0
- package/dist/hooks/factories/index.d.ts +18 -0
- package/dist/hooks/factories/index.js +5 -0
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +13 -0
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +76 -0
- package/dist/hooks/factories/useCreateS3LoginHook.d.ts +8 -0
- package/dist/hooks/factories/useCreateS3LoginHook.js +22 -0
- package/dist/hooks/factories/useCreateS3MutationHook.d.ts +5 -0
- package/dist/hooks/factories/useCreateS3MutationHook.js +50 -0
- package/dist/hooks/factories/useCreateS3QueryHook.d.ts +3 -0
- package/dist/hooks/factories/useCreateS3QueryHook.js +51 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/index.js +13 -0
- package/dist/hooks/loginOperations.d.ts +21 -0
- package/dist/hooks/loginOperations.js +9 -0
- package/dist/hooks/objectOperations.d.ts +190 -0
- package/dist/hooks/objectOperations.js +67 -0
- package/dist/hooks/presignedOperations.d.ts +73 -0
- package/dist/hooks/presignedOperations.js +72 -0
- package/dist/hooks/useBatchObjectLegalHold.d.ts +11 -0
- package/dist/hooks/useBatchObjectLegalHold.js +45 -0
- package/dist/hooks/useDeleteBucketConfigRule.d.ts +26 -0
- package/dist/hooks/useDeleteBucketConfigRule.js +46 -0
- package/dist/hooks/useEmptyBucket.d.ts +27 -0
- package/dist/hooks/useEmptyBucket.js +116 -0
- package/dist/hooks/useISVBucketDetection.d.ts +15 -0
- package/dist/hooks/useISVBucketDetection.js +27 -0
- package/dist/hooks/useIsBucketEmpty.d.ts +7 -0
- package/dist/hooks/useIsBucketEmpty.js +36 -0
- package/dist/hooks/useLoginMutation.d.ts +21 -0
- package/dist/hooks/useLoginMutation.js +9 -0
- package/dist/hooks/useS3Client.d.ts +1 -0
- package/dist/hooks/useS3Client.js +13 -0
- package/dist/hooks/useTableRowSelection.d.ts +9 -0
- package/dist/hooks/useTableRowSelection.js +45 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/schemas/bucketPolicySchema.json +321 -0
- package/dist/test/msw/handlers/deleteBucket.d.ts +1 -0
- package/dist/test/msw/handlers/deleteBucket.js +14 -0
- package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -0
- package/dist/test/msw/handlers/getBucketAcl.js +96 -0
- package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -0
- package/dist/test/msw/handlers/getBucketLocation.js +23 -0
- package/dist/test/msw/handlers/getBucketPolicy.d.ts +11 -0
- package/dist/test/msw/handlers/getBucketPolicy.js +72 -0
- package/dist/test/msw/handlers/headObject.d.ts +1 -0
- package/dist/test/msw/handlers/headObject.js +17 -0
- package/dist/test/msw/handlers/listBuckets.d.ts +1 -0
- package/dist/test/msw/handlers/listBuckets.js +24 -0
- package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -0
- package/dist/test/msw/handlers/listObjectVersions.js +83 -0
- package/dist/test/msw/handlers/listObjects.d.ts +1 -0
- package/dist/test/msw/handlers/listObjects.js +66 -0
- package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -0
- package/dist/test/msw/handlers/objectLegalHold.js +24 -0
- package/dist/test/msw/handlers/objectRetention.d.ts +1 -0
- package/dist/test/msw/handlers/objectRetention.js +27 -0
- package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -0
- package/dist/test/msw/handlers/putBucketAcl.js +18 -0
- package/dist/test/msw/handlers/putObject.d.ts +1 -0
- package/dist/test/msw/handlers/putObject.js +16 -0
- package/dist/test/msw/handlers.d.ts +4 -0
- package/dist/test/msw/handlers.js +109 -0
- package/dist/test/msw/index.d.ts +2 -0
- package/dist/test/msw/index.js +3 -0
- package/dist/test/msw/server.d.ts +4 -0
- package/dist/test/msw/server.js +20 -0
- package/dist/test/msw/utils.d.ts +2 -0
- package/dist/test/msw/utils.js +13 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.js +90 -0
- package/dist/test/testUtils.d.ts +181 -0
- package/dist/test/testUtils.js +310 -0
- package/dist/test/utils/errorHandling.test.d.ts +1 -0
- package/dist/test/utils/errorHandling.test.js +423 -0
- package/dist/types/index.d.ts +51 -0
- package/dist/types/index.js +0 -0
- package/dist/utils/constants.d.ts +12 -0
- package/dist/utils/constants.js +9 -0
- package/dist/utils/deletion/index.d.ts +2 -0
- package/dist/utils/deletion/index.js +2 -0
- package/dist/utils/deletion/messages.d.ts +5 -0
- package/dist/utils/deletion/messages.js +29 -0
- package/dist/utils/deletion/types.d.ts +11 -0
- package/dist/utils/deletion/types.js +0 -0
- package/dist/utils/errorHandling.d.ts +63 -0
- package/dist/utils/errorHandling.js +84 -0
- package/dist/utils/hooks.d.ts +2 -0
- package/dist/utils/hooks.js +26 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/proxyMiddleware.d.ts +18 -0
- package/dist/utils/proxyMiddleware.js +56 -0
- package/dist/utils/s3Client.d.ts +5 -0
- package/dist/utils/s3Client.js +36 -0
- package/dist/utils/s3RuleUtils.d.ts +53 -0
- package/dist/utils/s3RuleUtils.js +101 -0
- package/dist/utils/useFeatures.d.ts +1 -0
- package/dist/utils/useFeatures.js +7 -0
- package/package.json +84 -0
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ConstrainedText, FormattedDateTime, Icon, Loader, PrettyBytes, Toggle, spacing, useToast } from "@scality/core-ui";
|
|
3
|
+
import { useObjectLegalHold, useObjectMetadata, useObjectRetention, useSetObjectLegalHold } from "../../../hooks/index.js";
|
|
4
|
+
import { Body, ExtraCell, Group, GroupContent, GroupName, GroupValues, Key, Row, Table, TableContainer, Value } from "../../ui/Table.elements.js";
|
|
5
|
+
import { CopyButton } from "@scality/core-ui/dist/components/buttonv2/CopyButton.component";
|
|
6
|
+
import { Box } from "@scality/core-ui/dist/next";
|
|
7
|
+
const ObjectSummary = ({ bucketName, objectKey, versionId })=>{
|
|
8
|
+
const { data: metadata, status: metadataStatus } = useObjectMetadata({
|
|
9
|
+
Bucket: bucketName,
|
|
10
|
+
Key: objectKey,
|
|
11
|
+
...versionId && {
|
|
12
|
+
VersionId: versionId
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const { data: legalHoldData, status: legalHoldStatus } = useObjectLegalHold({
|
|
16
|
+
Bucket: bucketName,
|
|
17
|
+
Key: objectKey,
|
|
18
|
+
...versionId && {
|
|
19
|
+
VersionId: versionId
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
const { data: retentionData, status: retentionStatus } = useObjectRetention({
|
|
23
|
+
Bucket: bucketName,
|
|
24
|
+
Key: objectKey,
|
|
25
|
+
...versionId && {
|
|
26
|
+
VersionId: versionId
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const { mutate: setLegalHold, isPending: isUpdatingLegalHold } = useSetObjectLegalHold();
|
|
30
|
+
const { showToast } = useToast();
|
|
31
|
+
const isLegalHoldEnabled = legalHoldData?.LegalHold?.Status === "ON";
|
|
32
|
+
const hasRetention = retentionData?.Retention?.Mode;
|
|
33
|
+
const isObjectLockAvailable = hasRetention || "pending" === retentionStatus || "success" === legalHoldStatus;
|
|
34
|
+
const handleLegalHoldChange = ()=>{
|
|
35
|
+
setLegalHold({
|
|
36
|
+
Bucket: bucketName,
|
|
37
|
+
Key: objectKey,
|
|
38
|
+
...versionId && {
|
|
39
|
+
VersionId: versionId
|
|
40
|
+
},
|
|
41
|
+
LegalHold: {
|
|
42
|
+
Status: isLegalHoldEnabled ? "OFF" : "ON"
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
onSuccess: ()=>{
|
|
46
|
+
showToast({
|
|
47
|
+
open: true,
|
|
48
|
+
message: `Legal hold ${isLegalHoldEnabled ? "inactive" : "active"}`,
|
|
49
|
+
status: "success"
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
onError: (error)=>{
|
|
53
|
+
showToast({
|
|
54
|
+
open: true,
|
|
55
|
+
message: error instanceof Error ? error.message : "Failed to update legal hold",
|
|
56
|
+
status: "error"
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
return /*#__PURE__*/ jsx(TableContainer, {
|
|
62
|
+
children: /*#__PURE__*/ jsx(Table, {
|
|
63
|
+
children: /*#__PURE__*/ jsxs(Body, {
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ jsxs(Group, {
|
|
66
|
+
children: [
|
|
67
|
+
/*#__PURE__*/ jsx(GroupName, {
|
|
68
|
+
children: "Information"
|
|
69
|
+
}),
|
|
70
|
+
/*#__PURE__*/ jsxs(GroupContent, {
|
|
71
|
+
children: [
|
|
72
|
+
/*#__PURE__*/ jsxs(Row, {
|
|
73
|
+
children: [
|
|
74
|
+
/*#__PURE__*/ jsx(Key, {
|
|
75
|
+
children: "Name"
|
|
76
|
+
}),
|
|
77
|
+
/*#__PURE__*/ jsx(Value, {
|
|
78
|
+
width: "15rem",
|
|
79
|
+
children: /*#__PURE__*/ jsx(ConstrainedText, {
|
|
80
|
+
text: objectKey,
|
|
81
|
+
lineClamp: 2
|
|
82
|
+
})
|
|
83
|
+
})
|
|
84
|
+
]
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ jsxs(Row, {
|
|
87
|
+
children: [
|
|
88
|
+
/*#__PURE__*/ jsx(Key, {
|
|
89
|
+
children: "Version ID"
|
|
90
|
+
}),
|
|
91
|
+
/*#__PURE__*/ jsx(Value, {
|
|
92
|
+
children: "pending" === metadataStatus ? /*#__PURE__*/ jsx(Loader, {}) : "error" === metadataStatus ? "Error" : /*#__PURE__*/ jsxs(GroupValues, {
|
|
93
|
+
children: [
|
|
94
|
+
/*#__PURE__*/ jsx(Box, {
|
|
95
|
+
flex: "1",
|
|
96
|
+
minWidth: "0",
|
|
97
|
+
children: /*#__PURE__*/ jsx(ConstrainedText, {
|
|
98
|
+
text: metadata?.VersionId || versionId || "N/A",
|
|
99
|
+
lineClamp: 1
|
|
100
|
+
})
|
|
101
|
+
}),
|
|
102
|
+
/*#__PURE__*/ jsx(ExtraCell, {
|
|
103
|
+
marginLeft: spacing.f8,
|
|
104
|
+
children: /*#__PURE__*/ jsx(CopyButton, {
|
|
105
|
+
textToCopy: metadata?.VersionId || versionId || ""
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
})
|
|
110
|
+
})
|
|
111
|
+
]
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ jsxs(Row, {
|
|
114
|
+
children: [
|
|
115
|
+
/*#__PURE__*/ jsx(Key, {
|
|
116
|
+
children: "Size"
|
|
117
|
+
}),
|
|
118
|
+
/*#__PURE__*/ jsx(Value, {
|
|
119
|
+
children: "pending" === metadataStatus ? /*#__PURE__*/ jsx(Loader, {}) : "error" === metadataStatus ? "Error" : /*#__PURE__*/ jsx(PrettyBytes, {
|
|
120
|
+
bytes: metadata?.ContentLength || 0
|
|
121
|
+
})
|
|
122
|
+
})
|
|
123
|
+
]
|
|
124
|
+
}),
|
|
125
|
+
/*#__PURE__*/ jsxs(Row, {
|
|
126
|
+
children: [
|
|
127
|
+
/*#__PURE__*/ jsx(Key, {
|
|
128
|
+
children: "Modified On"
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ jsx(Value, {
|
|
131
|
+
children: "pending" === metadataStatus ? /*#__PURE__*/ jsx(Loader, {}) : "error" === metadataStatus ? "Error" : metadata?.LastModified ? /*#__PURE__*/ jsx(FormattedDateTime, {
|
|
132
|
+
value: metadata.LastModified,
|
|
133
|
+
format: "date-time-second"
|
|
134
|
+
}) : "N/A"
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
}),
|
|
138
|
+
/*#__PURE__*/ jsxs(Row, {
|
|
139
|
+
children: [
|
|
140
|
+
/*#__PURE__*/ jsx(Key, {
|
|
141
|
+
children: "ETag"
|
|
142
|
+
}),
|
|
143
|
+
/*#__PURE__*/ jsx(Value, {
|
|
144
|
+
children: "pending" === metadataStatus ? /*#__PURE__*/ jsx(Loader, {}) : "error" === metadataStatus ? "Error" : /*#__PURE__*/ jsxs(GroupValues, {
|
|
145
|
+
children: [
|
|
146
|
+
/*#__PURE__*/ jsx(Box, {
|
|
147
|
+
flex: "1",
|
|
148
|
+
minWidth: "0",
|
|
149
|
+
children: /*#__PURE__*/ jsx(ConstrainedText, {
|
|
150
|
+
text: metadata.ETag?.replace(/^"|"$/g, "") || "N/A",
|
|
151
|
+
lineClamp: 1
|
|
152
|
+
})
|
|
153
|
+
}),
|
|
154
|
+
/*#__PURE__*/ jsx(ExtraCell, {
|
|
155
|
+
marginLeft: spacing.f8,
|
|
156
|
+
children: /*#__PURE__*/ jsx(CopyButton, {
|
|
157
|
+
textToCopy: metadata.ETag?.replace(/^"|"$/g, "") || ""
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
})
|
|
163
|
+
]
|
|
164
|
+
}),
|
|
165
|
+
/*#__PURE__*/ jsxs(Row, {
|
|
166
|
+
children: [
|
|
167
|
+
/*#__PURE__*/ jsx(Key, {
|
|
168
|
+
children: "Location"
|
|
169
|
+
}),
|
|
170
|
+
/*#__PURE__*/ jsx(Value, {
|
|
171
|
+
children: "default"
|
|
172
|
+
})
|
|
173
|
+
]
|
|
174
|
+
})
|
|
175
|
+
]
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
}),
|
|
179
|
+
/*#__PURE__*/ jsxs(Group, {
|
|
180
|
+
children: [
|
|
181
|
+
/*#__PURE__*/ jsx(GroupName, {
|
|
182
|
+
children: "Data protection"
|
|
183
|
+
}),
|
|
184
|
+
/*#__PURE__*/ jsxs(GroupContent, {
|
|
185
|
+
children: [
|
|
186
|
+
/*#__PURE__*/ jsxs(Row, {
|
|
187
|
+
children: [
|
|
188
|
+
/*#__PURE__*/ jsx(Key, {
|
|
189
|
+
children: "Lock"
|
|
190
|
+
}),
|
|
191
|
+
/*#__PURE__*/ jsx(Value, {
|
|
192
|
+
children: "pending" === retentionStatus ? /*#__PURE__*/ jsx(Loader, {}) : "error" === retentionStatus ? "No Retention" : retentionData?.Retention?.Mode ? /*#__PURE__*/ jsxs(Fragment, {
|
|
193
|
+
children: [
|
|
194
|
+
retentionData.Retention.Mode,
|
|
195
|
+
" until",
|
|
196
|
+
" ",
|
|
197
|
+
retentionData.Retention.RetainUntilDate ? /*#__PURE__*/ jsx(FormattedDateTime, {
|
|
198
|
+
format: "date-time-second",
|
|
199
|
+
value: new Date(retentionData.Retention.RetainUntilDate)
|
|
200
|
+
}) : "N/A"
|
|
201
|
+
]
|
|
202
|
+
}) : "No Retention"
|
|
203
|
+
})
|
|
204
|
+
]
|
|
205
|
+
}),
|
|
206
|
+
/*#__PURE__*/ jsxs(Row, {
|
|
207
|
+
children: [
|
|
208
|
+
/*#__PURE__*/ jsx(Key, {
|
|
209
|
+
children: "Legal Hold"
|
|
210
|
+
}),
|
|
211
|
+
/*#__PURE__*/ jsx(Value, {
|
|
212
|
+
children: "pending" === legalHoldStatus ? /*#__PURE__*/ jsx(Loader, {}) : isObjectLockAvailable ? /*#__PURE__*/ jsxs(Box, {
|
|
213
|
+
display: "flex",
|
|
214
|
+
alignItems: "center",
|
|
215
|
+
gap: spacing.r8,
|
|
216
|
+
children: [
|
|
217
|
+
/*#__PURE__*/ jsx(Toggle, {
|
|
218
|
+
id: "legalHoldToggle",
|
|
219
|
+
disabled: isUpdatingLegalHold,
|
|
220
|
+
toggle: isLegalHoldEnabled,
|
|
221
|
+
label: isLegalHoldEnabled ? "Active" : "Inactive",
|
|
222
|
+
onChange: handleLegalHoldChange
|
|
223
|
+
}),
|
|
224
|
+
isLegalHoldEnabled && /*#__PURE__*/ jsx(Icon, {
|
|
225
|
+
name: "Rebalance"
|
|
226
|
+
})
|
|
227
|
+
]
|
|
228
|
+
}) : "N/A"
|
|
229
|
+
})
|
|
230
|
+
]
|
|
231
|
+
})
|
|
232
|
+
]
|
|
233
|
+
})
|
|
234
|
+
]
|
|
235
|
+
})
|
|
236
|
+
]
|
|
237
|
+
})
|
|
238
|
+
})
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
export { ObjectSummary };
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Icon, Loader, Text, spacing, useToast } from "@scality/core-ui";
|
|
4
|
+
import { Box, Button, Input } from "@scality/core-ui/dist/next";
|
|
5
|
+
import { Controller, useFieldArray, useForm } from "react-hook-form";
|
|
6
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
7
|
+
import { useDeleteObjectTagging, useObjectTagging, useSetObjectTagging } from "../../../hooks/index.js";
|
|
8
|
+
import { ArrayFieldActions } from "../../ui/ArrayFieldActions.js";
|
|
9
|
+
import { convertSizeToRem } from "@scality/core-ui/dist/components/inputv2/inputv2";
|
|
10
|
+
const MAX_TAGS_PER_OBJECT = 10;
|
|
11
|
+
const MAX_TAG_KEY_LENGTH = 128;
|
|
12
|
+
const MAX_TAG_VALUE_LENGTH = 256;
|
|
13
|
+
const ObjectTags = ({ bucketName, objectKey, versionId })=>{
|
|
14
|
+
const getVersionParams = ()=>versionId ? {
|
|
15
|
+
VersionId: versionId
|
|
16
|
+
} : {};
|
|
17
|
+
const { data: tagsData, status: tagsStatus } = useObjectTagging({
|
|
18
|
+
Bucket: bucketName,
|
|
19
|
+
Key: objectKey,
|
|
20
|
+
...getVersionParams()
|
|
21
|
+
});
|
|
22
|
+
const setTaggingMutation = useSetObjectTagging();
|
|
23
|
+
const deleteTaggingMutation = useDeleteObjectTagging();
|
|
24
|
+
const { showToast } = useToast();
|
|
25
|
+
const queryClient = useQueryClient();
|
|
26
|
+
const [isInitialized, setIsInitialized] = useState(false);
|
|
27
|
+
const { control, handleSubmit, setValue, watch, formState: { errors, isValid, isSubmitting } } = useForm({
|
|
28
|
+
mode: "onChange",
|
|
29
|
+
defaultValues: {
|
|
30
|
+
tags: []
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const { fields, append, remove } = useFieldArray({
|
|
34
|
+
control,
|
|
35
|
+
name: "tags"
|
|
36
|
+
});
|
|
37
|
+
useEffect(()=>{
|
|
38
|
+
setIsInitialized(false);
|
|
39
|
+
setTaggingMutation.reset();
|
|
40
|
+
deleteTaggingMutation.reset();
|
|
41
|
+
}, [
|
|
42
|
+
bucketName,
|
|
43
|
+
objectKey,
|
|
44
|
+
versionId
|
|
45
|
+
]);
|
|
46
|
+
useEffect(()=>{
|
|
47
|
+
if (tagsData && "success" === tagsStatus && !isInitialized) {
|
|
48
|
+
const tags = tagsData.TagSet || [];
|
|
49
|
+
const rows = tags.map((tag)=>({
|
|
50
|
+
key: tag.Key || "",
|
|
51
|
+
value: tag.Value || ""
|
|
52
|
+
}));
|
|
53
|
+
if (0 === rows.length) rows.push({
|
|
54
|
+
key: "",
|
|
55
|
+
value: ""
|
|
56
|
+
});
|
|
57
|
+
setValue("tags", rows);
|
|
58
|
+
setIsInitialized(true);
|
|
59
|
+
}
|
|
60
|
+
}, [
|
|
61
|
+
tagsData,
|
|
62
|
+
tagsStatus,
|
|
63
|
+
setValue,
|
|
64
|
+
isInitialized
|
|
65
|
+
]);
|
|
66
|
+
const onSubmit = async (data)=>{
|
|
67
|
+
try {
|
|
68
|
+
const validTags = data.tags.filter((tag)=>tag.key.trim() && tag.value.trim());
|
|
69
|
+
if (0 === validTags.length) await deleteTaggingMutation.mutateAsync({
|
|
70
|
+
Bucket: bucketName,
|
|
71
|
+
Key: objectKey,
|
|
72
|
+
...getVersionParams()
|
|
73
|
+
});
|
|
74
|
+
else await setTaggingMutation.mutateAsync({
|
|
75
|
+
Bucket: bucketName,
|
|
76
|
+
Key: objectKey,
|
|
77
|
+
...getVersionParams(),
|
|
78
|
+
Tagging: {
|
|
79
|
+
TagSet: validTags.map((row)=>({
|
|
80
|
+
Key: row.key.trim(),
|
|
81
|
+
Value: row.value.trim()
|
|
82
|
+
}))
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
await queryClient.invalidateQueries({
|
|
86
|
+
queryKey: [
|
|
87
|
+
"GetObjectTagging",
|
|
88
|
+
{
|
|
89
|
+
Bucket: bucketName,
|
|
90
|
+
Key: objectKey,
|
|
91
|
+
...getVersionParams()
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
showToast({
|
|
96
|
+
open: true,
|
|
97
|
+
message: "Tags saved successfully",
|
|
98
|
+
status: "success"
|
|
99
|
+
});
|
|
100
|
+
} catch (error) {
|
|
101
|
+
const errorMessage = error instanceof Error ? error.message : "Failed to save tags";
|
|
102
|
+
showToast({
|
|
103
|
+
open: true,
|
|
104
|
+
message: errorMessage,
|
|
105
|
+
status: "error"
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
if ("pending" === tagsStatus) return /*#__PURE__*/ jsx(Box, {
|
|
110
|
+
display: "flex",
|
|
111
|
+
justifyContent: "center",
|
|
112
|
+
padding: spacing.r32,
|
|
113
|
+
children: /*#__PURE__*/ jsx(Loader, {})
|
|
114
|
+
});
|
|
115
|
+
if ("error" === tagsStatus) return /*#__PURE__*/ jsx(Box, {
|
|
116
|
+
padding: spacing.r16,
|
|
117
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
118
|
+
color: "statusCritical",
|
|
119
|
+
children: "Error loading tags"
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
return /*#__PURE__*/ jsx(Box, {
|
|
123
|
+
children: /*#__PURE__*/ jsxs("form", {
|
|
124
|
+
onSubmit: handleSubmit(onSubmit),
|
|
125
|
+
children: [
|
|
126
|
+
/*#__PURE__*/ jsxs(Box, {
|
|
127
|
+
display: "flex",
|
|
128
|
+
justifyContent: "space-between",
|
|
129
|
+
alignItems: "center",
|
|
130
|
+
padding: spacing.r16,
|
|
131
|
+
borderBottom: "1px solid",
|
|
132
|
+
borderColor: "backgroundLevel3",
|
|
133
|
+
children: [
|
|
134
|
+
/*#__PURE__*/ jsx(Text, {
|
|
135
|
+
isEmphazed: true,
|
|
136
|
+
children: "Edit Tags"
|
|
137
|
+
}),
|
|
138
|
+
/*#__PURE__*/ jsx(Button, {
|
|
139
|
+
variant: "primary",
|
|
140
|
+
label: "Save",
|
|
141
|
+
disabled: !isValid || isSubmitting,
|
|
142
|
+
type: "submit",
|
|
143
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
144
|
+
name: "Save"
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
}),
|
|
149
|
+
/*#__PURE__*/ jsxs(Box, {
|
|
150
|
+
padding: spacing.r16,
|
|
151
|
+
display: "flex",
|
|
152
|
+
flexDirection: "column",
|
|
153
|
+
gap: spacing.r12,
|
|
154
|
+
children: [
|
|
155
|
+
/*#__PURE__*/ jsxs(Box, {
|
|
156
|
+
display: "flex",
|
|
157
|
+
gap: spacing.r8,
|
|
158
|
+
children: [
|
|
159
|
+
/*#__PURE__*/ jsx(Box, {
|
|
160
|
+
flex: "1",
|
|
161
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
162
|
+
color: "textSecondary",
|
|
163
|
+
isEmphazed: true,
|
|
164
|
+
children: "Key"
|
|
165
|
+
})
|
|
166
|
+
}),
|
|
167
|
+
/*#__PURE__*/ jsx(Box, {
|
|
168
|
+
flex: "1",
|
|
169
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
170
|
+
color: "textSecondary",
|
|
171
|
+
isEmphazed: true,
|
|
172
|
+
children: "Value"
|
|
173
|
+
})
|
|
174
|
+
}),
|
|
175
|
+
/*#__PURE__*/ jsx(Box, {
|
|
176
|
+
width: convertSizeToRem("1/3")
|
|
177
|
+
})
|
|
178
|
+
]
|
|
179
|
+
}),
|
|
180
|
+
fields.map((field, index)=>/*#__PURE__*/ jsxs(Box, {
|
|
181
|
+
children: [
|
|
182
|
+
/*#__PURE__*/ jsxs(Box, {
|
|
183
|
+
display: "flex",
|
|
184
|
+
gap: spacing.r8,
|
|
185
|
+
alignItems: "center",
|
|
186
|
+
children: [
|
|
187
|
+
/*#__PURE__*/ jsx(Controller, {
|
|
188
|
+
control: control,
|
|
189
|
+
name: `tags.${index}.key`,
|
|
190
|
+
rules: {
|
|
191
|
+
validate: (value, formValues)=>{
|
|
192
|
+
if (1 === formValues.tags.length && !value.trim() && !formValues.tags[0].value.trim()) return true;
|
|
193
|
+
if (!value.trim()) return "Key cannot be empty or whitespace only";
|
|
194
|
+
if (value.length > MAX_TAG_KEY_LENGTH) return `Key must be ${MAX_TAG_KEY_LENGTH} characters or less`;
|
|
195
|
+
const keys = formValues.tags.map((t)=>t.key.trim());
|
|
196
|
+
const duplicates = keys.filter((k)=>k === value.trim());
|
|
197
|
+
return duplicates.length > 1 ? `Duplicate key "${value.trim()}"` : true;
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
render: ({ field: { onChange, value } })=>/*#__PURE__*/ jsx(Input, {
|
|
201
|
+
id: `key-${field.id}`,
|
|
202
|
+
value: value,
|
|
203
|
+
onChange: onChange,
|
|
204
|
+
placeholder: "Key",
|
|
205
|
+
"aria-label": `Tag ${index + 1} key`
|
|
206
|
+
})
|
|
207
|
+
}),
|
|
208
|
+
/*#__PURE__*/ jsx(Text, {
|
|
209
|
+
color: "textSecondary",
|
|
210
|
+
children: ":"
|
|
211
|
+
}),
|
|
212
|
+
/*#__PURE__*/ jsx(Controller, {
|
|
213
|
+
control: control,
|
|
214
|
+
name: `tags.${index}.value`,
|
|
215
|
+
rules: {
|
|
216
|
+
validate: (value, formValues)=>{
|
|
217
|
+
if (1 === formValues.tags.length && !value.trim() && !formValues.tags[0].key.trim()) return true;
|
|
218
|
+
if (!value.trim()) return "Value cannot be empty or whitespace only";
|
|
219
|
+
if (value.length > MAX_TAG_VALUE_LENGTH) return `Value must be ${MAX_TAG_VALUE_LENGTH} characters or less`;
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
render: ({ field: { onChange, value } })=>/*#__PURE__*/ jsx(Input, {
|
|
224
|
+
id: `value-${field.id}`,
|
|
225
|
+
value: value,
|
|
226
|
+
onChange: onChange,
|
|
227
|
+
placeholder: "Value",
|
|
228
|
+
"aria-label": `Tag ${index + 1} value`
|
|
229
|
+
})
|
|
230
|
+
}),
|
|
231
|
+
/*#__PURE__*/ jsx(ArrayFieldActions, {
|
|
232
|
+
showAdd: index === fields.length - 1,
|
|
233
|
+
onRemove: ()=>{
|
|
234
|
+
remove(index);
|
|
235
|
+
if (1 === fields.length) append({
|
|
236
|
+
key: "",
|
|
237
|
+
value: ""
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
onAdd: ()=>append({
|
|
241
|
+
key: "",
|
|
242
|
+
value: ""
|
|
243
|
+
}),
|
|
244
|
+
canRemove: true,
|
|
245
|
+
canAdd: fields.length < MAX_TAGS_PER_OBJECT && !!watch(`tags.${index}.key`) && !!watch(`tags.${index}.value`),
|
|
246
|
+
removeLabel: "Remove tag",
|
|
247
|
+
addLabel: "Add tag"
|
|
248
|
+
})
|
|
249
|
+
]
|
|
250
|
+
}),
|
|
251
|
+
(errors.tags?.[index]?.key || errors.tags?.[index]?.value) && /*#__PURE__*/ jsxs(Box, {
|
|
252
|
+
paddingTop: spacing.r4,
|
|
253
|
+
children: [
|
|
254
|
+
errors.tags?.[index]?.key && /*#__PURE__*/ jsx(Text, {
|
|
255
|
+
color: "statusCritical",
|
|
256
|
+
children: errors.tags[index]?.key?.message
|
|
257
|
+
}),
|
|
258
|
+
errors.tags?.[index]?.value && /*#__PURE__*/ jsx(Text, {
|
|
259
|
+
color: "statusCritical",
|
|
260
|
+
children: errors.tags[index]?.value?.message
|
|
261
|
+
})
|
|
262
|
+
]
|
|
263
|
+
})
|
|
264
|
+
]
|
|
265
|
+
}, field.id))
|
|
266
|
+
]
|
|
267
|
+
})
|
|
268
|
+
]
|
|
269
|
+
})
|
|
270
|
+
});
|
|
271
|
+
};
|
|
272
|
+
export { ObjectTags };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TableItem } from "../ObjectList";
|
|
2
|
+
export interface ObjectCommonProps {
|
|
3
|
+
bucketName: string;
|
|
4
|
+
objectKey: string;
|
|
5
|
+
versionId?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const ObjectDetails: ({ item }: {
|
|
8
|
+
item: TableItem | null;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useParams } from "react-router-dom";
|
|
3
|
+
import { Text, spacing } from "@scality/core-ui";
|
|
4
|
+
import { Box, Tabs } from "@scality/core-ui/dist/next";
|
|
5
|
+
import { ObjectSummary } from "./ObjectSummary.js";
|
|
6
|
+
import { ObjectMetadata } from "./ObjectMetadata.js";
|
|
7
|
+
import { ObjectTags } from "./ObjectTags.js";
|
|
8
|
+
const ObjectDetails = ({ item })=>{
|
|
9
|
+
const { bucketName } = useParams();
|
|
10
|
+
const mainTabs = [
|
|
11
|
+
{
|
|
12
|
+
label: "Summary",
|
|
13
|
+
query: ""
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: "Metadata",
|
|
17
|
+
query: "metadata"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: "Tags",
|
|
21
|
+
query: "tags"
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
const getPlaceholderMessage = ()=>{
|
|
25
|
+
if (!bucketName || !item || !item.Key) return /*#__PURE__*/ jsx(Text, {
|
|
26
|
+
children: "Select an object to view details"
|
|
27
|
+
});
|
|
28
|
+
if ("deleteMarker" === item.type) return /*#__PURE__*/ jsx(Text, {
|
|
29
|
+
children: 'A "Delete Marker" is selected'
|
|
30
|
+
});
|
|
31
|
+
if ("folder" === item.type) return /*#__PURE__*/ jsx(Text, {
|
|
32
|
+
children: 'A "Folder" is selected'
|
|
33
|
+
});
|
|
34
|
+
return /*#__PURE__*/ jsx(Text, {
|
|
35
|
+
children: "Select an object to view details"
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
if (!bucketName || !item || !item.Key || "deleteMarker" === item.type || "folder" === item.type) {
|
|
39
|
+
const placeholderMessage = getPlaceholderMessage();
|
|
40
|
+
return /*#__PURE__*/ jsx(Tabs, {
|
|
41
|
+
children: mainTabs.map((tab)=>/*#__PURE__*/ jsx(Tabs.Tab, {
|
|
42
|
+
label: tab.label,
|
|
43
|
+
path: "",
|
|
44
|
+
query: {
|
|
45
|
+
tab: tab.query
|
|
46
|
+
},
|
|
47
|
+
children: /*#__PURE__*/ jsx(Box, {
|
|
48
|
+
padding: spacing.r16,
|
|
49
|
+
display: "flex",
|
|
50
|
+
justifyContent: "center",
|
|
51
|
+
children: placeholderMessage
|
|
52
|
+
})
|
|
53
|
+
}, tab.query || "summary"))
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
const versionId = "version" === item.type ? item.VersionId : void 0;
|
|
57
|
+
return /*#__PURE__*/ jsx(Tabs, {
|
|
58
|
+
children: mainTabs.map((tab)=>{
|
|
59
|
+
const Component = "Summary" === tab.label ? ObjectSummary : "Metadata" === tab.label ? ObjectMetadata : ObjectTags;
|
|
60
|
+
return /*#__PURE__*/ jsx(Tabs.Tab, {
|
|
61
|
+
label: tab.label,
|
|
62
|
+
path: "",
|
|
63
|
+
query: {
|
|
64
|
+
tab: tab.query
|
|
65
|
+
},
|
|
66
|
+
children: /*#__PURE__*/ jsx(Component, {
|
|
67
|
+
bucketName: bucketName,
|
|
68
|
+
objectKey: item.Key,
|
|
69
|
+
versionId: versionId
|
|
70
|
+
})
|
|
71
|
+
}, tab.query || "summary");
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
export { ObjectDetails };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { _Object, DeleteMarkerEntry, ObjectVersion } from "@aws-sdk/client-s3";
|
|
2
|
+
type FolderItem = {
|
|
3
|
+
Key: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
type: "folder";
|
|
6
|
+
LastModified?: undefined;
|
|
7
|
+
Size?: undefined;
|
|
8
|
+
StorageClass?: undefined;
|
|
9
|
+
VersionId?: undefined;
|
|
10
|
+
IsLatest?: undefined;
|
|
11
|
+
};
|
|
12
|
+
type ObjectItem = _Object & {
|
|
13
|
+
displayName: string;
|
|
14
|
+
type: "object";
|
|
15
|
+
IsLatest?: boolean;
|
|
16
|
+
VersionId?: string;
|
|
17
|
+
};
|
|
18
|
+
type VersionItem = ObjectVersion & {
|
|
19
|
+
displayName: string;
|
|
20
|
+
type: "version";
|
|
21
|
+
IsLatest?: boolean;
|
|
22
|
+
};
|
|
23
|
+
type DeleteMarkerItem = DeleteMarkerEntry & {
|
|
24
|
+
displayName: string;
|
|
25
|
+
type: "deleteMarker";
|
|
26
|
+
isDeleteMarker: true;
|
|
27
|
+
IsLatest?: boolean;
|
|
28
|
+
Size?: number;
|
|
29
|
+
};
|
|
30
|
+
export type TableItem = (FolderItem | ObjectItem | VersionItem | DeleteMarkerItem) & {
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
};
|
|
33
|
+
interface ObjectListProps {
|
|
34
|
+
bucketName: string;
|
|
35
|
+
prefix: string;
|
|
36
|
+
onObjectSelect: (object: TableItem) => void;
|
|
37
|
+
onPrefixChange: (newPrefix: string) => void;
|
|
38
|
+
}
|
|
39
|
+
export declare const ObjectList: ({ bucketName, prefix, onObjectSelect, onPrefixChange, }: ObjectListProps) => import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export {};
|