@scality/data-browser-library 1.0.0-preview.8 → 1.0.1
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/DataBrowserUI.d.ts +12 -0
- package/dist/components/DataBrowserUI.js +99 -0
- package/dist/components/Editor.d.ts +1 -1
- package/dist/components/Editor.js +3 -3
- package/dist/components/__tests__/BucketAccessor.test.js +214 -0
- package/dist/components/__tests__/BucketCorsPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketCorsPage.test.js +263 -0
- package/dist/components/__tests__/BucketCreate.test.d.ts +1 -0
- package/dist/components/__tests__/BucketCreate.test.js +574 -0
- package/dist/components/__tests__/BucketDetails.test.d.ts +1 -0
- package/dist/components/__tests__/BucketDetails.test.js +421 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +14 -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.js +495 -81
- package/dist/components/__tests__/BucketNotificationFormPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationFormPage.test.js +348 -0
- package/dist/components/__tests__/BucketNotificationList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationList.test.js +379 -0
- package/dist/components/__tests__/BucketOverview.test.js +484 -179
- package/dist/components/__tests__/BucketPolicyPage.test.js +151 -99
- package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +16 -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.js +56 -56
- package/dist/components/__tests__/DeleteBucketButton.test.js +64 -64
- 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.js +64 -64
- 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.js +65 -65
- package/dist/components/__tests__/ObjectList.test.js +741 -240
- package/dist/components/__tests__/UploadButton.test.js +45 -45
- package/dist/components/breadcrumb/Breadcrumb.d.ts +6 -0
- package/dist/components/breadcrumb/Breadcrumb.js +37 -0
- package/dist/components/breadcrumb/DataBrowserBreadcrumb.d.ts +1 -0
- package/dist/components/breadcrumb/DataBrowserBreadcrumb.js +10 -0
- package/dist/components/breadcrumb/__tests__/Breadcrumb.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/Breadcrumb.test.js +196 -0
- package/dist/components/breadcrumb/__tests__/DataBrowserBreadcrumb.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/DataBrowserBreadcrumb.test.js +153 -0
- package/dist/components/breadcrumb/__tests__/useBreadcrumbPaths.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/useBreadcrumbPaths.test.js +134 -0
- package/dist/components/breadcrumb/index.d.ts +8 -0
- package/dist/components/breadcrumb/index.js +4 -0
- package/dist/components/breadcrumb/useBreadcrumbPaths.d.ts +2 -0
- package/dist/components/breadcrumb/useBreadcrumbPaths.js +82 -0
- package/dist/components/buckets/BucketAccessor.d.ts +2 -0
- package/dist/components/buckets/BucketAccessor.js +125 -0
- package/dist/components/buckets/BucketConfigEditButton.d.ts +8 -0
- package/dist/components/buckets/{BucketPolicyButton.js → BucketConfigEditButton.js} +9 -5
- package/dist/components/buckets/BucketCorsPage.d.ts +1 -0
- package/dist/components/buckets/BucketCorsPage.js +234 -0
- package/dist/components/buckets/BucketCreate.d.ts +50 -0
- package/dist/components/buckets/BucketCreate.js +279 -0
- package/dist/components/buckets/BucketDetails.d.ts +42 -0
- package/dist/components/buckets/BucketDetails.js +256 -40
- package/dist/components/buckets/BucketLifecycleFormPage.d.ts +15 -0
- package/dist/components/buckets/BucketLifecycleFormPage.js +1086 -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 +6 -4
- package/dist/components/buckets/BucketList.js +161 -94
- package/dist/components/buckets/BucketLocation.js +4 -4
- package/dist/components/buckets/BucketOverview.d.ts +86 -5
- package/dist/components/buckets/BucketOverview.js +481 -192
- package/dist/components/buckets/BucketPage.js +44 -22
- package/dist/components/buckets/BucketPolicyPage.js +155 -127
- package/dist/components/buckets/BucketReplicationFormPage.d.ts +1 -0
- package/dist/components/buckets/BucketReplicationFormPage.js +835 -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 +76 -0
- package/dist/components/buckets/DeleteBucketButton.js +8 -8
- 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/BucketNotificationFormPage.d.ts +1 -0
- package/dist/components/buckets/notifications/BucketNotificationFormPage.js +316 -0
- package/dist/components/buckets/notifications/BucketNotificationList.d.ts +10 -0
- package/dist/components/buckets/notifications/BucketNotificationList.js +267 -0
- package/dist/components/buckets/notifications/EventsSection.js +145 -29
- package/dist/components/buckets/notifications/__tests__/events.test.d.ts +1 -0
- package/dist/components/buckets/notifications/__tests__/events.test.js +56 -0
- package/dist/components/buckets/notifications/events.d.ts +71 -7
- package/dist/components/buckets/notifications/events.js +98 -16
- package/dist/components/index.d.ts +27 -13
- package/dist/components/index.js +20 -6
- package/dist/components/layouts/ArrowNavigation.d.ts +3 -0
- package/dist/components/layouts/ArrowNavigation.js +28 -0
- package/dist/components/layouts/BrowserPageLayout.d.ts +5 -1
- package/dist/components/layouts/BrowserPageLayout.js +10 -5
- package/dist/components/objects/CreateFolderButton.d.ts +2 -2
- package/dist/components/objects/CreateFolderButton.js +12 -12
- package/dist/components/objects/DeleteObjectButton.d.ts +1 -1
- package/dist/components/objects/DeleteObjectButton.js +19 -21
- package/dist/components/objects/GetPresignedUrlButton.d.ts +7 -0
- package/dist/components/objects/GetPresignedUrlButton.js +255 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectMetadata.js +263 -230
- package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +540 -138
- package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectTags.js +95 -123
- package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.d.ts +1 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.js +516 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.d.ts +1 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.js +1064 -0
- package/dist/components/objects/ObjectDetails/index.d.ts +18 -2
- package/dist/components/objects/ObjectDetails/index.js +152 -40
- package/dist/components/objects/ObjectList.d.ts +12 -10
- package/dist/components/objects/ObjectList.js +590 -263
- 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 +159 -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.js +12 -8
- package/dist/components/objects/UploadButton.d.ts +3 -3
- package/dist/components/objects/UploadButton.js +10 -10
- package/dist/components/objects/__tests__/GetPresignedUrlButton.test.d.ts +1 -0
- package/dist/components/objects/__tests__/GetPresignedUrlButton.test.js +531 -0
- package/dist/components/providers/DataBrowserProvider.d.ts +23 -12
- package/dist/components/providers/DataBrowserProvider.js +60 -38
- package/dist/components/providers/QueryProvider.d.ts +9 -0
- package/dist/components/providers/QueryProvider.js +21 -0
- package/dist/components/search/MetadataSearch.js +29 -28
- package/dist/components/search/SearchHints.js +1 -1
- 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 +48 -0
- package/dist/components/ui/DeleteObjectModalContent.d.ts +1 -1
- package/dist/components/ui/DeleteObjectModalContent.js +12 -12
- 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 +2 -2
- package/dist/components/ui/Search.elements.js +7 -7
- package/dist/components/ui/Table.elements.d.ts +2 -1
- package/dist/components/ui/Table.elements.js +18 -12
- package/dist/config/__tests__/factory.test.d.ts +1 -0
- package/dist/config/__tests__/factory.test.js +311 -0
- package/dist/config/factory.d.ts +14 -49
- package/dist/config/factory.js +23 -68
- package/dist/config/types.d.ts +212 -34
- package/dist/contexts/DataBrowserUICustomizationContext.d.ts +27 -0
- package/dist/contexts/DataBrowserUICustomizationContext.js +13 -0
- package/dist/hooks/__tests__/useAccessibleBuckets.test.d.ts +1 -0
- package/dist/hooks/__tests__/useAccessibleBuckets.test.js +145 -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.js +27 -27
- package/dist/hooks/__tests__/useLoginMutation.test.d.ts +1 -0
- package/dist/hooks/__tests__/useLoginMutation.test.js +194 -0
- package/dist/hooks/bucketConfiguration.d.ts +8 -1
- package/dist/hooks/bucketConfiguration.js +52 -51
- package/dist/hooks/bucketOperations.d.ts +10 -1
- package/dist/hooks/bucketOperations.js +10 -9
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +80 -80
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +80 -80
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +44 -44
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +63 -63
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +95 -52
- package/dist/hooks/factories/index.d.ts +4 -4
- package/dist/hooks/factories/index.js +2 -2
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +16 -13
- package/dist/hooks/factories/useCreateS3LoginHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3LoginHook.js +1 -1
- package/dist/hooks/factories/useCreateS3MutationHook.d.ts +3 -3
- package/dist/hooks/factories/useCreateS3MutationHook.js +7 -2
- package/dist/hooks/factories/useCreateS3QueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3QueryHook.js +29 -3
- package/dist/hooks/index.d.ts +19 -8
- package/dist/hooks/index.js +16 -5
- package/dist/hooks/loginOperations.d.ts +1 -1
- package/dist/hooks/loginOperations.js +1 -1
- package/dist/hooks/objectOperations.d.ts +2 -2
- package/dist/hooks/objectOperations.js +50 -49
- package/dist/hooks/presignedOperations.d.ts +4 -4
- package/dist/hooks/presignedOperations.js +5 -5
- package/dist/hooks/useAccessibleBuckets.d.ts +11 -0
- package/dist/hooks/useAccessibleBuckets.js +115 -0
- package/dist/hooks/useBatchObjectLegalHold.d.ts +11 -0
- package/dist/hooks/useBatchObjectLegalHold.js +48 -0
- package/dist/hooks/useBucketConfigEditor.d.ts +31 -0
- package/dist/hooks/useBucketConfigEditor.js +82 -0
- package/dist/hooks/useDataBrowserNavigate.d.ts +28 -0
- package/dist/hooks/useDataBrowserNavigate.js +24 -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/useFeatures.d.ts +7 -0
- package/dist/hooks/useFeatures.js +8 -0
- package/dist/hooks/useISVBucketDetection.d.ts +15 -0
- package/dist/hooks/useISVBucketDetection.js +27 -0
- package/dist/hooks/useIsBucketEmpty.js +4 -4
- package/dist/hooks/useLimitedAccessFlow.d.ts +48 -0
- package/dist/hooks/useLimitedAccessFlow.js +23 -0
- package/dist/hooks/useS3Client.d.ts +6 -0
- package/dist/hooks/useS3Client.js +3 -2
- package/dist/hooks/useS3ConfigSwitch.d.ts +11 -0
- package/dist/hooks/useS3ConfigSwitch.js +37 -0
- package/dist/hooks/useSupportedNotificationEvents.d.ts +6 -0
- package/dist/hooks/useSupportedNotificationEvents.js +8 -0
- package/dist/hooks/useTableRowSelection.d.ts +9 -0
- package/dist/hooks/useTableRowSelection.js +45 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +2 -2
- package/dist/schemas/bucketPolicySchema.json +3 -13
- package/dist/test/msw/handlers/deleteBucket.d.ts +1 -1
- package/dist/test/msw/handlers/deleteBucket.js +20 -10
- package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketAcl.js +29 -17
- package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketLocation.js +29 -15
- package/dist/test/msw/handlers/getBucketPolicy.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketPolicy.js +52 -32
- package/dist/test/msw/handlers/headObject.d.ts +1 -1
- package/dist/test/msw/handlers/headObject.js +31 -13
- package/dist/test/msw/handlers/listBuckets.d.ts +1 -1
- package/dist/test/msw/handlers/listBuckets.js +5 -3
- package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -1
- package/dist/test/msw/handlers/listObjectVersions.js +38 -26
- package/dist/test/msw/handlers/listObjects.d.ts +1 -1
- package/dist/test/msw/handlers/listObjects.js +35 -23
- package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -1
- package/dist/test/msw/handlers/objectLegalHold.js +32 -17
- package/dist/test/msw/handlers/objectRetention.d.ts +1 -1
- package/dist/test/msw/handlers/objectRetention.js +31 -17
- package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -1
- package/dist/test/msw/handlers/putBucketAcl.js +29 -14
- package/dist/test/msw/handlers/putObject.d.ts +1 -1
- package/dist/test/msw/handlers/putObject.js +27 -12
- package/dist/test/msw/handlers.d.ts +3 -3
- package/dist/test/msw/handlers.js +77 -54
- package/dist/test/msw/index.d.ts +2 -2
- package/dist/test/msw/index.js +1 -1
- package/dist/test/msw/server.d.ts +1 -1
- package/dist/test/msw/server.js +1 -1
- package/dist/test/msw/utils.js +2 -2
- package/dist/test/setup.d.ts +1 -1
- package/dist/test/setup.js +13 -30
- package/dist/test/testUtils.d.ts +170 -36
- package/dist/test/testUtils.js +229 -116
- package/dist/test/utils/errorHandling.test.js +146 -108
- package/dist/types/index.d.ts +49 -36
- package/dist/types/monaco.d.ts +13 -0
- package/dist/types/monaco.js +0 -0
- package/dist/utils/__tests__/proxyMiddleware.test.d.ts +1 -0
- package/dist/utils/__tests__/proxyMiddleware.test.js +579 -0
- package/dist/utils/__tests__/s3Client.test.d.ts +1 -0
- package/dist/utils/__tests__/s3Client.test.js +340 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.d.ts +1 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.js +437 -0
- package/dist/utils/constants.d.ts +22 -0
- package/dist/utils/constants.js +19 -0
- package/dist/utils/deletion/index.d.ts +2 -2
- package/dist/utils/deletion/index.js +1 -1
- package/dist/utils/deletion/messages.d.ts +1 -1
- package/dist/utils/deletion/messages.js +4 -4
- package/dist/utils/errorHandling.d.ts +12 -3
- package/dist/utils/errorHandling.js +12 -7
- package/dist/utils/hooks.js +8 -8
- package/dist/utils/index.d.ts +5 -2
- package/dist/utils/index.js +5 -1
- package/dist/utils/proxyMiddleware.d.ts +32 -13
- package/dist/utils/proxyMiddleware.js +90 -36
- package/dist/utils/s3Client.d.ts +14 -4
- package/dist/utils/s3Client.js +5 -26
- package/dist/utils/s3ConfigIdentifier.d.ts +79 -0
- package/dist/utils/s3ConfigIdentifier.js +57 -0
- package/dist/utils/s3RuleUtils.d.ts +53 -0
- package/dist/utils/s3RuleUtils.js +101 -0
- package/package.json +10 -8
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +0 -316
- package/dist/components/buckets/BucketPolicyButton.d.ts +0 -7
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.d.ts +0 -1
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +0 -234
- package/dist/hooks/useLoginMutation.d.ts +0 -21
- package/dist/hooks/useLoginMutation.js +0 -9
- package/dist/utils/useFeatures.d.ts +0 -1
- package/dist/utils/useFeatures.js +0 -7
- /package/dist/components/__tests__/{BucketNotificationCreatePage.test.d.ts → BucketAccessor.test.d.ts} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReplicationRule } from '@aws-sdk/client-s3';
|
|
2
|
+
interface BucketReplicationListProps {
|
|
3
|
+
bucketName: string;
|
|
4
|
+
replicationRules: ReplicationRule[];
|
|
5
|
+
replicationRole: string;
|
|
6
|
+
replicationStatus?: 'idle' | 'loading' | 'error' | 'success';
|
|
7
|
+
onCreateRule?: () => void;
|
|
8
|
+
onEditRule?: (ruleId: string) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function BucketReplicationList({ bucketName, replicationRules, replicationRole, replicationStatus, onCreateRule, onEditRule, }: BucketReplicationListProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ConstrainedText, Icon, Wrap, spacing } from "@scality/core-ui";
|
|
3
|
+
import { Box, Button, Table } from "@scality/core-ui/dist/next";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
import { useDeleteBucketReplication, useSetBucketReplication } from "../../hooks/bucketConfiguration.js";
|
|
6
|
+
import { useTableRowSelection } from "../../hooks/useTableRowSelection.js";
|
|
7
|
+
import { DeleteBucketConfigRuleButton } from "./DeleteBucketConfigRuleButton.js";
|
|
8
|
+
function BucketReplicationList({ bucketName, replicationRules, replicationRole, replicationStatus, onCreateRule, onEditRule }) {
|
|
9
|
+
const updateReplicationMutation = useSetBucketReplication();
|
|
10
|
+
const deleteReplicationMutation = useDeleteBucketReplication();
|
|
11
|
+
const columns = useMemo(()=>[
|
|
12
|
+
{
|
|
13
|
+
Header: 'Rule ID',
|
|
14
|
+
accessor: 'ID',
|
|
15
|
+
id: 'id',
|
|
16
|
+
Cell: ({ value })=>/*#__PURE__*/ jsx(ConstrainedText, {
|
|
17
|
+
text: value || '-',
|
|
18
|
+
lineClamp: 2
|
|
19
|
+
}),
|
|
20
|
+
cellStyle: {
|
|
21
|
+
flex: '1',
|
|
22
|
+
width: 'unset'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
Header: 'Status',
|
|
27
|
+
accessor: 'Status',
|
|
28
|
+
id: 'status',
|
|
29
|
+
Cell: ({ value })=>{
|
|
30
|
+
const statusText = 'Enabled' === value ? 'Active' : 'Disabled' === value ? 'Inactive' : value;
|
|
31
|
+
return /*#__PURE__*/ jsx("span", {
|
|
32
|
+
children: statusText || '-'
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
cellStyle: {
|
|
36
|
+
width: 'unset',
|
|
37
|
+
flex: '0.5'
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
Header: 'Priority',
|
|
42
|
+
accessor: 'Priority',
|
|
43
|
+
id: 'priority',
|
|
44
|
+
Cell: ({ value })=>/*#__PURE__*/ jsx("span", {
|
|
45
|
+
children: void 0 !== value ? value : 'None'
|
|
46
|
+
}),
|
|
47
|
+
cellStyle: {
|
|
48
|
+
width: 'unset',
|
|
49
|
+
flex: '0.5',
|
|
50
|
+
textAlign: 'right',
|
|
51
|
+
paddingRight: spacing.r16
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
Header: 'Destination',
|
|
56
|
+
accessor: 'Destination',
|
|
57
|
+
id: 'destination',
|
|
58
|
+
Cell: ({ row })=>{
|
|
59
|
+
const rule = row.original.Rule;
|
|
60
|
+
const destination = rule.Destination;
|
|
61
|
+
const bucketArn = destination?.Bucket || '';
|
|
62
|
+
const accountMatch = bucketArn.match(/arn:aws:s3:::([^:]+):([^:]+)/);
|
|
63
|
+
let bucketName;
|
|
64
|
+
let accountId;
|
|
65
|
+
if (accountMatch) {
|
|
66
|
+
accountId = accountMatch[1];
|
|
67
|
+
bucketName = accountMatch[2];
|
|
68
|
+
} else {
|
|
69
|
+
const parts = bucketArn.split(':::');
|
|
70
|
+
bucketName = parts[parts.length - 1] || bucketArn;
|
|
71
|
+
accountId = null;
|
|
72
|
+
}
|
|
73
|
+
const shortAccountId = accountId ? `${accountId.slice(0, 3)}...${accountId.slice(-3)}` : null;
|
|
74
|
+
const storageClass = destination?.StorageClass;
|
|
75
|
+
let displayText = `Replicate to ${bucketName}`;
|
|
76
|
+
const details = [];
|
|
77
|
+
if (shortAccountId) details.push(`account: ${shortAccountId}`);
|
|
78
|
+
if (storageClass) details.push(storageClass);
|
|
79
|
+
if (details.length > 0) displayText += ` (${details.join(', ')})`;
|
|
80
|
+
return /*#__PURE__*/ jsx(ConstrainedText, {
|
|
81
|
+
text: displayText || '-',
|
|
82
|
+
lineClamp: 2
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
cellStyle: {
|
|
86
|
+
width: 'unset',
|
|
87
|
+
flex: '1.5'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
Header: '',
|
|
92
|
+
accessor: 'ID',
|
|
93
|
+
id: 'operations',
|
|
94
|
+
cellStyle: {
|
|
95
|
+
flex: '0.5',
|
|
96
|
+
textAlign: 'right',
|
|
97
|
+
paddingRight: spacing.r16,
|
|
98
|
+
width: 'unset'
|
|
99
|
+
},
|
|
100
|
+
Cell: ({ value })=>/*#__PURE__*/ jsxs(Box, {
|
|
101
|
+
display: "flex",
|
|
102
|
+
gap: spacing.r8,
|
|
103
|
+
justifyContent: "flex-end",
|
|
104
|
+
children: [
|
|
105
|
+
/*#__PURE__*/ jsx(Button, {
|
|
106
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
107
|
+
name: "Edit"
|
|
108
|
+
}),
|
|
109
|
+
variant: "secondary",
|
|
110
|
+
type: "button",
|
|
111
|
+
onClick: (e)=>{
|
|
112
|
+
e.stopPropagation();
|
|
113
|
+
onEditRule?.(value);
|
|
114
|
+
},
|
|
115
|
+
"aria-label": "Edit rule",
|
|
116
|
+
tooltip: {
|
|
117
|
+
overlay: 'Edit rule'
|
|
118
|
+
}
|
|
119
|
+
}),
|
|
120
|
+
/*#__PURE__*/ jsx(DeleteBucketConfigRuleButton, {
|
|
121
|
+
bucketName: bucketName,
|
|
122
|
+
ruleId: value,
|
|
123
|
+
rules: replicationRules,
|
|
124
|
+
ruleType: "replication",
|
|
125
|
+
updateMutation: updateReplicationMutation,
|
|
126
|
+
deleteMutation: deleteReplicationMutation,
|
|
127
|
+
buildUpdateInput: (remainingRules)=>({
|
|
128
|
+
ReplicationConfiguration: {
|
|
129
|
+
Role: replicationRole,
|
|
130
|
+
Rules: remainingRules
|
|
131
|
+
}
|
|
132
|
+
}),
|
|
133
|
+
successMessage: "Replication rule deleted successfully",
|
|
134
|
+
errorMessage: "Failed to delete replication rule"
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
], [
|
|
140
|
+
bucketName,
|
|
141
|
+
replicationRules,
|
|
142
|
+
replicationRole,
|
|
143
|
+
onEditRule,
|
|
144
|
+
updateReplicationMutation,
|
|
145
|
+
deleteReplicationMutation
|
|
146
|
+
]);
|
|
147
|
+
const tableData = useMemo(()=>replicationRules.map((rule)=>({
|
|
148
|
+
ID: rule.ID || '-',
|
|
149
|
+
Status: rule.Status || '-',
|
|
150
|
+
Priority: rule.Priority,
|
|
151
|
+
Destination: rule.Destination?.Bucket || '-',
|
|
152
|
+
Rule: rule
|
|
153
|
+
})), [
|
|
154
|
+
replicationRules
|
|
155
|
+
]);
|
|
156
|
+
const { selectedId, onRowSelected } = useTableRowSelection(tableData);
|
|
157
|
+
return /*#__PURE__*/ jsxs(Table, {
|
|
158
|
+
columns: columns,
|
|
159
|
+
data: tableData,
|
|
160
|
+
status: replicationStatus,
|
|
161
|
+
defaultSortingKey: "priority",
|
|
162
|
+
entityName: {
|
|
163
|
+
en: {
|
|
164
|
+
singular: 'replication rule',
|
|
165
|
+
plural: 'replication rules'
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
children: [
|
|
169
|
+
/*#__PURE__*/ jsx(Wrap, {
|
|
170
|
+
padding: spacing.r16,
|
|
171
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
172
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
173
|
+
name: "Create-add"
|
|
174
|
+
}),
|
|
175
|
+
label: "Create Rule",
|
|
176
|
+
variant: "primary",
|
|
177
|
+
onClick: onCreateRule
|
|
178
|
+
})
|
|
179
|
+
}),
|
|
180
|
+
/*#__PURE__*/ jsx(Table.SingleSelectableContent, {
|
|
181
|
+
rowHeight: "h48",
|
|
182
|
+
separationLineVariant: "backgroundLevel1",
|
|
183
|
+
selectedId: selectedId?.toString(),
|
|
184
|
+
onRowSelected: onRowSelected
|
|
185
|
+
})
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
export { BucketReplicationList };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { SmallerText, Toggle, Tooltip, useToast } from "@scality/core-ui";
|
|
3
|
+
import { useCallback } from "react";
|
|
4
|
+
import { useGetBucketObjectLockConfiguration, useGetBucketVersioning, useISVBucketStatus, useSetBucketVersioning } from "../../hooks/index.js";
|
|
5
|
+
import { useBucketOverviewContext } from "./BucketOverview.js";
|
|
6
|
+
function BucketVersioning({ tooltipOverlay }) {
|
|
7
|
+
const { bucketName } = useBucketOverviewContext();
|
|
8
|
+
const { data: versioningData, status: versioningStatus, error: versioningError } = useGetBucketVersioning({
|
|
9
|
+
Bucket: bucketName
|
|
10
|
+
});
|
|
11
|
+
const { data: objectLockData, status: objectLockStatus } = useGetBucketObjectLockConfiguration({
|
|
12
|
+
Bucket: bucketName
|
|
13
|
+
});
|
|
14
|
+
const { isVeeamBucket } = useISVBucketStatus(bucketName);
|
|
15
|
+
const { mutate: changeBucketVersioning } = useSetBucketVersioning();
|
|
16
|
+
const { showToast } = useToast();
|
|
17
|
+
const isObjectLockEnabled = objectLockData?.ObjectLockConfiguration?.ObjectLockEnabled === 'Enabled';
|
|
18
|
+
const isVersioningEnabled = versioningData?.Status === 'Enabled';
|
|
19
|
+
const updateBucketVersioning = useCallback((isVersioning)=>{
|
|
20
|
+
changeBucketVersioning({
|
|
21
|
+
Bucket: bucketName,
|
|
22
|
+
VersioningConfiguration: {
|
|
23
|
+
Status: isVersioning ? 'Enabled' : 'Suspended'
|
|
24
|
+
}
|
|
25
|
+
}, {
|
|
26
|
+
onSuccess: ()=>{
|
|
27
|
+
showToast({
|
|
28
|
+
open: true,
|
|
29
|
+
message: isVersioning ? 'Bucket versioning enabled' : 'Bucket versioning suspended',
|
|
30
|
+
status: 'success'
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
onError: (error)=>{
|
|
34
|
+
showToast({
|
|
35
|
+
open: true,
|
|
36
|
+
message: error instanceof Error ? error.message : 'Failed to update bucket versioning',
|
|
37
|
+
status: 'error'
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}, [
|
|
42
|
+
bucketName,
|
|
43
|
+
changeBucketVersioning,
|
|
44
|
+
showToast
|
|
45
|
+
]);
|
|
46
|
+
if (isObjectLockEnabled) return /*#__PURE__*/ jsxs(Fragment, {
|
|
47
|
+
children: [
|
|
48
|
+
"Enabled",
|
|
49
|
+
/*#__PURE__*/ jsx("br", {}),
|
|
50
|
+
/*#__PURE__*/ jsx(SmallerText, {
|
|
51
|
+
children: "Versioning cannot be suspended because Object-lock is enabled for this bucket."
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
return /*#__PURE__*/ jsx(Tooltip, {
|
|
56
|
+
overlay: tooltipOverlay ? tooltipOverlay : isVeeamBucket ? /*#__PURE__*/ jsx(Fragment, {
|
|
57
|
+
children: "Enabling versioning is not possible due to the bucket being managed by Veeam."
|
|
58
|
+
}) : 'error' === versioningStatus ? /*#__PURE__*/ jsx(Fragment, {
|
|
59
|
+
children: versioningError?.message
|
|
60
|
+
}) : null,
|
|
61
|
+
overlayStyle: {
|
|
62
|
+
maxWidth: '16.5rem'
|
|
63
|
+
},
|
|
64
|
+
children: /*#__PURE__*/ jsx(Toggle, {
|
|
65
|
+
id: "versioningToggle",
|
|
66
|
+
disabled: 'pending' === versioningStatus || 'pending' === objectLockStatus || 'error' === versioningStatus || isVeeamBucket,
|
|
67
|
+
toggle: isVersioningEnabled,
|
|
68
|
+
label: isVersioningEnabled ? 'Active' : 'Inactive',
|
|
69
|
+
onChange: ()=>{
|
|
70
|
+
updateBucketVersioning(!isVersioningEnabled);
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
const buckets_BucketVersioning = BucketVersioning;
|
|
76
|
+
export { BucketVersioning, buckets_BucketVersioning as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { useIsBucketEmpty } from "../../hooks/useIsBucketEmpty.js";
|
|
4
|
-
import { useDeleteBucket } from "../../hooks/bucketOperations.js";
|
|
5
2
|
import { Icon, Loader, Modal, Stack, Tooltip, Wrap } from "@scality/core-ui";
|
|
6
3
|
import { Button } from "@scality/core-ui/dist/next";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { useDeleteBucket } from "../../hooks/bucketOperations.js";
|
|
6
|
+
import { useIsBucketEmpty } from "../../hooks/useIsBucketEmpty.js";
|
|
7
7
|
const DeleteBucketButton = ({ bucketName, onDeleteSuccess, onDeleteError, disabled = false })=>{
|
|
8
8
|
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
|
|
9
9
|
const { isEmpty, isLoading } = useIsBucketEmpty(bucketName);
|
|
@@ -20,7 +20,7 @@ const DeleteBucketButton = ({ bucketName, onDeleteSuccess, onDeleteError, disabl
|
|
|
20
20
|
onDeleteSuccess?.(bucketName);
|
|
21
21
|
},
|
|
22
22
|
onError: (error)=>{
|
|
23
|
-
onDeleteError?.(error instanceof Error ? error : new Error(
|
|
23
|
+
onDeleteError?.(error instanceof Error ? error : new Error('Delete failed'));
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
};
|
|
@@ -28,9 +28,9 @@ const DeleteBucketButton = ({ bucketName, onDeleteSuccess, onDeleteError, disabl
|
|
|
28
28
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
29
29
|
children: [
|
|
30
30
|
/*#__PURE__*/ jsx(Tooltip, {
|
|
31
|
-
overlay: isLoading ?
|
|
31
|
+
overlay: isLoading ? 'Checking bucket...' : 'Bucket is not empty',
|
|
32
32
|
overlayStyle: {
|
|
33
|
-
display: isEmpty ?
|
|
33
|
+
display: isEmpty ? 'none' : void 0
|
|
34
34
|
},
|
|
35
35
|
children: /*#__PURE__*/ jsx(Button, {
|
|
36
36
|
icon: /*#__PURE__*/ jsx(Icon, {
|
|
@@ -56,10 +56,10 @@ const DeleteBucketButton = ({ bucketName, onDeleteSuccess, onDeleteError, disabl
|
|
|
56
56
|
label: "Cancel"
|
|
57
57
|
}),
|
|
58
58
|
/*#__PURE__*/ jsx(Button, {
|
|
59
|
-
disabled:
|
|
59
|
+
disabled: 'pending' === status,
|
|
60
60
|
variant: "danger",
|
|
61
61
|
onClick: approve,
|
|
62
|
-
icon:
|
|
62
|
+
icon: 'pending' === status && /*#__PURE__*/ jsx(Loader, {
|
|
63
63
|
size: "larger"
|
|
64
64
|
}),
|
|
65
65
|
label: "Delete"
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { UseMutationResult } from '@tanstack/react-query';
|
|
2
|
+
interface DeleteBucketConfigRuleButtonProps<TRule extends {
|
|
3
|
+
ID?: string;
|
|
4
|
+
}> {
|
|
5
|
+
bucketName: string;
|
|
6
|
+
ruleId: string;
|
|
7
|
+
rules: TRule[];
|
|
8
|
+
ruleType: 'lifecycle' | 'replication' | 'notification';
|
|
9
|
+
updateMutation: UseMutationResult<any, any, any, unknown>;
|
|
10
|
+
deleteMutation: UseMutationResult<any, any, any, unknown>;
|
|
11
|
+
buildUpdateInput: (remainingRules: TRule[]) => Record<string, any>;
|
|
12
|
+
successMessage: string;
|
|
13
|
+
errorMessage: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function DeleteBucketConfigRuleButton<TRule extends {
|
|
16
|
+
ID?: string;
|
|
17
|
+
}>({ bucketName, ruleId, rules, ruleType, updateMutation, deleteMutation, buildUpdateInput, successMessage, errorMessage, }: DeleteBucketConfigRuleButtonProps<TRule>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon } from "@scality/core-ui";
|
|
3
|
+
import { Button } from "@scality/core-ui/dist/next";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { useDeleteBucketConfigRule } from "../../hooks/useDeleteBucketConfigRule.js";
|
|
6
|
+
import { ConfirmDeleteRuleModal } from "../ui/ConfirmDeleteRuleModal.js";
|
|
7
|
+
function DeleteBucketConfigRuleButton({ bucketName, ruleId, rules, ruleType, updateMutation, deleteMutation, buildUpdateInput, successMessage, errorMessage }) {
|
|
8
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
9
|
+
const { isDeleting, deleteRule } = useDeleteBucketConfigRule({
|
|
10
|
+
bucketName,
|
|
11
|
+
ruleId,
|
|
12
|
+
rules,
|
|
13
|
+
updateMutation,
|
|
14
|
+
deleteMutation,
|
|
15
|
+
buildUpdateInput,
|
|
16
|
+
successMessage,
|
|
17
|
+
errorMessage,
|
|
18
|
+
onSuccess: ()=>{
|
|
19
|
+
setIsModalOpen(false);
|
|
20
|
+
},
|
|
21
|
+
onError: ()=>{
|
|
22
|
+
setIsModalOpen(false);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
26
|
+
children: [
|
|
27
|
+
/*#__PURE__*/ jsx(Button, {
|
|
28
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
29
|
+
name: "Delete"
|
|
30
|
+
}),
|
|
31
|
+
variant: "secondary",
|
|
32
|
+
type: "button",
|
|
33
|
+
onClick: (e)=>{
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
setIsModalOpen(true);
|
|
36
|
+
},
|
|
37
|
+
"aria-label": "Delete rule",
|
|
38
|
+
tooltip: {
|
|
39
|
+
overlay: 'Delete rule'
|
|
40
|
+
}
|
|
41
|
+
}),
|
|
42
|
+
/*#__PURE__*/ jsx(ConfirmDeleteRuleModal, {
|
|
43
|
+
isOpen: isModalOpen,
|
|
44
|
+
ruleId: ruleId,
|
|
45
|
+
ruleType: ruleType,
|
|
46
|
+
isDeleting: isDeleting,
|
|
47
|
+
onConfirm: deleteRule,
|
|
48
|
+
onCancel: ()=>setIsModalOpen(false)
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export { DeleteBucketConfigRuleButton };
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Banner, Icon, Loader, Modal, Stack, Text, Tooltip, Wrap } from "@scality/core-ui";
|
|
3
|
+
import { Input } from "@scality/core-ui/dist/components/inputv2/inputv2";
|
|
4
|
+
import { Box, Button } from "@scality/core-ui/dist/next";
|
|
5
|
+
import { useMemo, useState } from "react";
|
|
6
|
+
import styled_components from "styled-components";
|
|
7
|
+
import { useGetBucketObjectLockConfiguration } from "../../hooks/bucketConfiguration.js";
|
|
8
|
+
import { useEmptyBucket } from "../../hooks/useEmptyBucket.js";
|
|
9
|
+
import { useIsBucketEmpty } from "../../hooks/useIsBucketEmpty.js";
|
|
10
|
+
import { EmptyBucketSummary } from "./EmptyBucketSummary.js";
|
|
11
|
+
const MAX_OBJECTS_TO_DELETE = 20000;
|
|
12
|
+
const CustomListItem = styled_components.li`
|
|
13
|
+
padding: 0.5rem;
|
|
14
|
+
`;
|
|
15
|
+
const emptyBucketInfosList = [
|
|
16
|
+
'Emptying a bucket removes all contents and cannot be reversed.',
|
|
17
|
+
'New objects added during the empty action may also be removed.',
|
|
18
|
+
'Adjust workflows linked to this bucket to avoid adding objects during the emptying action.'
|
|
19
|
+
];
|
|
20
|
+
const RetentionText = ()=>/*#__PURE__*/ jsx(Text, {
|
|
21
|
+
children: "If some of the objects you are trying to delete are locked in governance mode, confirming the deletion will effectively delete them as the governance retention will be bypassed."
|
|
22
|
+
});
|
|
23
|
+
const LifecycleText = ()=>/*#__PURE__*/ jsx(Text, {
|
|
24
|
+
children: "The action of emptying can erase a maximum of 20 000 objects. For buckets with a substantial number of objects, an expiration workflow (lifecycle rule) could provide an effective alternative to emptying the bucket."
|
|
25
|
+
});
|
|
26
|
+
const EmptyBucketButton = ({ bucketName })=>{
|
|
27
|
+
const [confirmText, setConfirmText] = useState('');
|
|
28
|
+
const [isEmptyModalOpen, setIsEmptyModalOpen] = useState(false);
|
|
29
|
+
const [showSummary, setShowSummary] = useState(false);
|
|
30
|
+
const { isEmpty, isLoading: isCheckingEmpty } = useIsBucketEmpty(bucketName);
|
|
31
|
+
const { data: objectLockData } = useGetBucketObjectLockConfiguration({
|
|
32
|
+
Bucket: bucketName
|
|
33
|
+
});
|
|
34
|
+
const isObjectLockEnabled = objectLockData?.ObjectLockConfiguration?.ObjectLockEnabled === 'Enabled';
|
|
35
|
+
const { emptyBucket, isEmptying, error, result, reset } = useEmptyBucket({
|
|
36
|
+
maxObjects: MAX_OBJECTS_TO_DELETE,
|
|
37
|
+
bypassGovernanceRetention: true
|
|
38
|
+
});
|
|
39
|
+
const isConfirmed = confirmText === bucketName;
|
|
40
|
+
const deleteResultForSummary = useMemo(()=>{
|
|
41
|
+
if (!result) return;
|
|
42
|
+
return {
|
|
43
|
+
$metadata: {},
|
|
44
|
+
Deleted: Array.from({
|
|
45
|
+
length: result.deletedCount
|
|
46
|
+
}, (_, i)=>({
|
|
47
|
+
Key: `object-${i}`,
|
|
48
|
+
VersionId: void 0
|
|
49
|
+
})),
|
|
50
|
+
Errors: result.errors.map((error)=>({
|
|
51
|
+
Key: error.key,
|
|
52
|
+
Code: error.code,
|
|
53
|
+
Message: error.message
|
|
54
|
+
}))
|
|
55
|
+
};
|
|
56
|
+
}, [
|
|
57
|
+
result
|
|
58
|
+
]);
|
|
59
|
+
const handleEmptyBucket = async ()=>{
|
|
60
|
+
const bucketResult = await emptyBucket(bucketName);
|
|
61
|
+
if (bucketResult) {
|
|
62
|
+
setIsEmptyModalOpen(false);
|
|
63
|
+
setShowSummary(true);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const handleCloseSummary = ()=>{
|
|
67
|
+
setShowSummary(false);
|
|
68
|
+
setConfirmText('');
|
|
69
|
+
reset();
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
72
|
+
children: [
|
|
73
|
+
/*#__PURE__*/ jsx(Tooltip, {
|
|
74
|
+
overlay: isCheckingEmpty ? 'Checking if bucket is empty' : 'Bucket is already empty',
|
|
75
|
+
overlayStyle: {
|
|
76
|
+
width: '9rem',
|
|
77
|
+
display: isEmpty ? void 0 : 'none'
|
|
78
|
+
},
|
|
79
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
80
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
81
|
+
name: "Eraser"
|
|
82
|
+
}),
|
|
83
|
+
disabled: Boolean(isEmpty) || isCheckingEmpty,
|
|
84
|
+
variant: "danger",
|
|
85
|
+
onClick: ()=>setIsEmptyModalOpen(true),
|
|
86
|
+
label: "Empty Bucket",
|
|
87
|
+
style: {
|
|
88
|
+
marginRight: '1rem'
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ jsx(Modal, {
|
|
93
|
+
isOpen: isEmptyModalOpen,
|
|
94
|
+
title: `Empty Bucket '${bucketName}'?`,
|
|
95
|
+
close: ()=>{
|
|
96
|
+
if (!isEmptying) {
|
|
97
|
+
setIsEmptyModalOpen(false);
|
|
98
|
+
setConfirmText('');
|
|
99
|
+
reset();
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
footer: /*#__PURE__*/ jsxs(Wrap, {
|
|
103
|
+
children: [
|
|
104
|
+
isEmptying && /*#__PURE__*/ jsx(Text, {
|
|
105
|
+
variant: "Larger",
|
|
106
|
+
children: result?.deletedCount ? `${result?.deletedCount} deletion attempts...` : 'Deletion in progress...'
|
|
107
|
+
}),
|
|
108
|
+
/*#__PURE__*/ jsx("p", {}),
|
|
109
|
+
/*#__PURE__*/ jsxs(Stack, {
|
|
110
|
+
children: [
|
|
111
|
+
/*#__PURE__*/ jsx(Button, {
|
|
112
|
+
variant: "outline",
|
|
113
|
+
onClick: ()=>{
|
|
114
|
+
setIsEmptyModalOpen(false);
|
|
115
|
+
setConfirmText('');
|
|
116
|
+
reset();
|
|
117
|
+
},
|
|
118
|
+
label: "Cancel",
|
|
119
|
+
disabled: isEmptying
|
|
120
|
+
}),
|
|
121
|
+
/*#__PURE__*/ jsx(Button, {
|
|
122
|
+
disabled: !isConfirmed || isEmptying,
|
|
123
|
+
variant: "danger",
|
|
124
|
+
onClick: handleEmptyBucket,
|
|
125
|
+
icon: isEmptying ? /*#__PURE__*/ jsx(Loader, {
|
|
126
|
+
size: "larger"
|
|
127
|
+
}) : /*#__PURE__*/ jsx(Icon, {
|
|
128
|
+
name: "Eraser"
|
|
129
|
+
}),
|
|
130
|
+
label: "Empty"
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})
|
|
134
|
+
]
|
|
135
|
+
}),
|
|
136
|
+
children: /*#__PURE__*/ jsxs(Box, {
|
|
137
|
+
maxWidth: "35rem",
|
|
138
|
+
children: [
|
|
139
|
+
error && /*#__PURE__*/ jsxs(Fragment, {
|
|
140
|
+
children: [
|
|
141
|
+
/*#__PURE__*/ jsx(Banner, {
|
|
142
|
+
variant: "danger",
|
|
143
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
144
|
+
name: "Exclamation-circle",
|
|
145
|
+
color: "statusCritical"
|
|
146
|
+
}),
|
|
147
|
+
title: "Error",
|
|
148
|
+
children: error.message
|
|
149
|
+
}),
|
|
150
|
+
/*#__PURE__*/ jsx("br", {})
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
153
|
+
isObjectLockEnabled && /*#__PURE__*/ jsxs(Fragment, {
|
|
154
|
+
children: [
|
|
155
|
+
/*#__PURE__*/ jsx(Banner, {
|
|
156
|
+
icon: /*#__PURE__*/ jsx(Box, {
|
|
157
|
+
display: "flex",
|
|
158
|
+
alignItems: "center",
|
|
159
|
+
marginLeft: "0.571rem",
|
|
160
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
161
|
+
name: "Exclamation-circle",
|
|
162
|
+
color: "statusWarning",
|
|
163
|
+
size: "lg"
|
|
164
|
+
})
|
|
165
|
+
}),
|
|
166
|
+
variant: "warning",
|
|
167
|
+
children: /*#__PURE__*/ jsx(RetentionText, {})
|
|
168
|
+
}),
|
|
169
|
+
/*#__PURE__*/ jsx("br", {})
|
|
170
|
+
]
|
|
171
|
+
}),
|
|
172
|
+
/*#__PURE__*/ jsx("ul", {
|
|
173
|
+
style: {
|
|
174
|
+
padding: '2rem'
|
|
175
|
+
},
|
|
176
|
+
children: emptyBucketInfosList.map((listInfo, i)=>/*#__PURE__*/ jsx(CustomListItem, {
|
|
177
|
+
children: listInfo
|
|
178
|
+
}, i))
|
|
179
|
+
}),
|
|
180
|
+
/*#__PURE__*/ jsx(Banner, {
|
|
181
|
+
icon: /*#__PURE__*/ jsx("div", {
|
|
182
|
+
style: {
|
|
183
|
+
display: 'flex',
|
|
184
|
+
alignItems: 'center',
|
|
185
|
+
marginLeft: '0.571rem'
|
|
186
|
+
},
|
|
187
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
188
|
+
name: "Info-circle",
|
|
189
|
+
size: "lg"
|
|
190
|
+
})
|
|
191
|
+
}),
|
|
192
|
+
variant: "base",
|
|
193
|
+
children: /*#__PURE__*/ jsx(LifecycleText, {})
|
|
194
|
+
}),
|
|
195
|
+
/*#__PURE__*/ jsx("br", {}),
|
|
196
|
+
/*#__PURE__*/ jsxs(Box, {
|
|
197
|
+
display: "flex",
|
|
198
|
+
alignItems: "center",
|
|
199
|
+
paddingTop: "1rem",
|
|
200
|
+
children: [
|
|
201
|
+
/*#__PURE__*/ jsx("label", {
|
|
202
|
+
style: {
|
|
203
|
+
float: 'left',
|
|
204
|
+
marginRight: '1rem'
|
|
205
|
+
},
|
|
206
|
+
children: "Type the name of the bucket to delete all its content."
|
|
207
|
+
}),
|
|
208
|
+
/*#__PURE__*/ jsx(Input, {
|
|
209
|
+
id: "confirm-input",
|
|
210
|
+
"aria-label": "confirm",
|
|
211
|
+
autoFocus: isEmptyModalOpen,
|
|
212
|
+
placeholder: bucketName,
|
|
213
|
+
type: "text",
|
|
214
|
+
value: confirmText,
|
|
215
|
+
onChange: (e)=>setConfirmText(e.target.value),
|
|
216
|
+
disabled: isEmptying
|
|
217
|
+
})
|
|
218
|
+
]
|
|
219
|
+
})
|
|
220
|
+
]
|
|
221
|
+
})
|
|
222
|
+
}),
|
|
223
|
+
deleteResultForSummary && /*#__PURE__*/ jsx(EmptyBucketSummary, {
|
|
224
|
+
deleteResult: deleteResultForSummary,
|
|
225
|
+
close: handleCloseSummary,
|
|
226
|
+
open: showSummary,
|
|
227
|
+
isFetchNextPage: !result?.limitReached
|
|
228
|
+
})
|
|
229
|
+
]
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
export { EmptyBucketButton };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DeleteObjectsCommandOutput } from '@aws-sdk/client-s3';
|
|
2
|
+
interface EmptyBucketSummaryProps {
|
|
3
|
+
deleteResult: DeleteObjectsCommandOutput;
|
|
4
|
+
close: () => void;
|
|
5
|
+
open: boolean;
|
|
6
|
+
isFetchNextPage: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare const EmptyBucketSummary: ({ deleteResult, close, open, isFetchNextPage }: EmptyBucketSummaryProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|