@scality/data-browser-library 1.0.0-preview.9 → 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.js +271 -105
- 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 +13 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.js +178 -178
- package/dist/components/__tests__/BucketLifecycleList.test.js +85 -85
- package/dist/components/__tests__/BucketList.test.js +463 -239
- 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 +281 -266
- package/dist/components/__tests__/BucketPolicyPage.test.js +151 -99
- package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +15 -0
- package/dist/components/__tests__/BucketReplicationFormPage.test.js +544 -544
- package/dist/components/__tests__/BucketReplicationList.test.js +106 -106
- package/dist/components/__tests__/CreateFolderButton.test.js +56 -56
- package/dist/components/__tests__/DeleteBucketButton.test.js +64 -64
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +47 -47
- package/dist/components/__tests__/DeleteObjectButton.test.js +64 -64
- package/dist/components/__tests__/EmptyBucketButton.test.js +59 -59
- 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 +3 -2
- package/dist/components/buckets/BucketCreate.js +89 -47
- package/dist/components/buckets/BucketDetails.d.ts +42 -0
- package/dist/components/buckets/BucketDetails.js +249 -85
- package/dist/components/buckets/BucketLifecycleFormPage.js +206 -190
- package/dist/components/buckets/BucketLifecycleList.d.ts +2 -2
- package/dist/components/buckets/BucketLifecycleList.js +47 -47
- package/dist/components/buckets/BucketList.d.ts +7 -8
- package/dist/components/buckets/BucketList.js +158 -101
- package/dist/components/buckets/BucketLocation.js +4 -4
- package/dist/components/buckets/BucketOverview.d.ts +22 -2
- package/dist/components/buckets/BucketOverview.js +394 -187
- package/dist/components/buckets/BucketPage.js +43 -21
- package/dist/components/buckets/BucketPolicyPage.js +155 -127
- package/dist/components/buckets/BucketReplicationFormPage.js +134 -133
- package/dist/components/buckets/BucketReplicationList.d.ts +2 -2
- package/dist/components/buckets/BucketReplicationList.js +42 -42
- 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 +2 -2
- package/dist/components/buckets/DeleteBucketConfigRuleButton.js +2 -2
- package/dist/components/buckets/EmptyBucketButton.js +24 -24
- package/dist/components/buckets/EmptyBucketSummary.d.ts +2 -2
- package/dist/components/buckets/EmptyBucketSummary.js +1 -1
- package/dist/components/buckets/EmptyBucketSummaryList.d.ts +1 -1
- package/dist/components/buckets/EmptyBucketSummaryList.js +22 -22
- 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 -20
- package/dist/components/index.js +17 -10
- 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.js +4 -4
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +15 -15
- package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +1 -1
- package/dist/components/objects/ObjectLock/ObjectLockSettings.js +32 -31
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +1 -1
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +6 -6
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +51 -51
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +78 -78
- 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.js +12 -7
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +2 -2
- package/dist/components/ui/ConfirmDeleteRuleModal.js +6 -1
- package/dist/components/ui/DeleteObjectModalContent.d.ts +1 -1
- package/dist/components/ui/DeleteObjectModalContent.js +12 -12
- package/dist/components/ui/FilterFormSection.d.ts +2 -2
- package/dist/components/ui/FilterFormSection.js +29 -29
- 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 +10 -56
- package/dist/config/factory.js +23 -71
- 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.js +45 -45
- 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 +65 -65
- 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 +11 -6
- package/dist/hooks/index.d.ts +19 -12
- package/dist/hooks/index.js +16 -9
- 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 +2 -2
- package/dist/hooks/useDeleteBucketConfigRule.js +4 -4
- package/dist/hooks/useEmptyBucket.js +11 -11
- package/dist/hooks/useFeatures.d.ts +7 -0
- package/dist/hooks/useFeatures.js +8 -0
- package/dist/hooks/useISVBucketDetection.js +6 -6
- 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/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 +85 -33
- package/dist/test/testUtils.js +176 -111
- package/dist/test/utils/errorHandling.test.js +119 -119
- 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 +10 -0
- package/dist/utils/constants.js +19 -9
- 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 +3 -3
- package/dist/utils/errorHandling.js +6 -6
- package/dist/utils/hooks.js +8 -8
- package/dist/utils/index.d.ts +5 -4
- package/dist/utils/index.js +4 -2
- 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 +5 -5
- package/dist/utils/s3RuleUtils.js +17 -17
- 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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useISVBucketStatus } from "../../../hooks/index.js";
|
|
3
2
|
import { Icon } from "@scality/core-ui";
|
|
4
3
|
import { Button } from "@scality/core-ui/dist/next";
|
|
5
|
-
import {
|
|
4
|
+
import { useISVBucketStatus } from "../../../hooks/index.js";
|
|
5
|
+
import { useDataBrowserNavigate } from "../../../hooks/useDataBrowserNavigate.js";
|
|
6
6
|
const EditRetentionButton = ({ bucketName })=>{
|
|
7
|
-
const navigate =
|
|
7
|
+
const navigate = useDataBrowserNavigate();
|
|
8
8
|
const { isVeeamBucket, isCommvaultBucket, isISVManaged, isLoading } = useISVBucketStatus(bucketName);
|
|
9
|
-
const tooltipOverlay = isCommvaultBucket ?
|
|
9
|
+
const tooltipOverlay = isCommvaultBucket ? 'Edition is disabled as it is managed by Commvault.' : isVeeamBucket ? 'Edition is disabled as it is managed by Veeam.' : void 0;
|
|
10
10
|
return /*#__PURE__*/ jsx(Button, {
|
|
11
11
|
id: "edit-retention-btn",
|
|
12
12
|
variant: "outline",
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Checkbox, FormGroup, FormSection, Stack, Text } from "@scality/core-ui";
|
|
3
3
|
import { convertRemToPixels } from "@scality/core-ui/dist/components/tablev2/TableUtils";
|
|
4
|
-
import { Controller, useFormContext } from "react-hook-form";
|
|
5
4
|
import { Input, Select } from "@scality/core-ui/dist/next";
|
|
5
|
+
import { Controller, useFormContext } from "react-hook-form";
|
|
6
6
|
function ObjectLockRetentionSettings({ isEditRetentionSettings = false }) {
|
|
7
7
|
const { control, register, watch, formState: { errors }, setValue } = useFormContext();
|
|
8
|
-
const isDefaultRetentionEnabled = watch(
|
|
9
|
-
const isObjectLockEnabled = watch(
|
|
8
|
+
const isDefaultRetentionEnabled = watch('isDefaultRetentionEnabled');
|
|
9
|
+
const isObjectLockEnabled = watch('isObjectLockEnabled');
|
|
10
10
|
const matchVersioning = (checked)=>{
|
|
11
|
-
if (checked) setValue(
|
|
11
|
+
if (checked) setValue('isVersioning', true);
|
|
12
12
|
};
|
|
13
13
|
return /*#__PURE__*/ jsxs(FormSection, {
|
|
14
14
|
title: isEditRetentionSettings ? void 0 : {
|
|
15
|
-
name:
|
|
15
|
+
name: 'Object-lock'
|
|
16
16
|
},
|
|
17
17
|
forceLabelWidth: convertRemToPixels(17.5),
|
|
18
18
|
children: [
|
|
@@ -21,9 +21,9 @@ function ObjectLockRetentionSettings({ isEditRetentionSettings = false }) {
|
|
|
21
21
|
label: "Object-lock",
|
|
22
22
|
content: /*#__PURE__*/ jsx(Checkbox, {
|
|
23
23
|
id: "isObjectLockEnabled",
|
|
24
|
-
label: isObjectLockEnabled ?
|
|
24
|
+
label: isObjectLockEnabled ? 'Enabled' : 'Disabled',
|
|
25
25
|
disabled: isEditRetentionSettings && isObjectLockEnabled,
|
|
26
|
-
...register(
|
|
26
|
+
...register('isObjectLockEnabled', {
|
|
27
27
|
onChange (e) {
|
|
28
28
|
matchVersioning(e.target.checked);
|
|
29
29
|
}
|
|
@@ -84,8 +84,8 @@ function ObjectLockRetentionSettings({ isEditRetentionSettings = false }) {
|
|
|
84
84
|
}),
|
|
85
85
|
content: /*#__PURE__*/ jsx(Checkbox, {
|
|
86
86
|
id: "isDefaultRetentionEnabled",
|
|
87
|
-
label: isDefaultRetentionEnabled ?
|
|
88
|
-
...register(
|
|
87
|
+
label: isDefaultRetentionEnabled ? 'Active' : 'Inactive',
|
|
88
|
+
...register('isDefaultRetentionEnabled')
|
|
89
89
|
})
|
|
90
90
|
}),
|
|
91
91
|
/*#__PURE__*/ jsx(FormGroup, {
|
|
@@ -111,7 +111,7 @@ function ObjectLockRetentionSettings({ isEditRetentionSettings = false }) {
|
|
|
111
111
|
type: "radio",
|
|
112
112
|
value: "GOVERNANCE",
|
|
113
113
|
disabled: !isDefaultRetentionEnabled,
|
|
114
|
-
...register(
|
|
114
|
+
...register('retentionMode')
|
|
115
115
|
}),
|
|
116
116
|
/*#__PURE__*/ jsx("label", {
|
|
117
117
|
htmlFor: "locktype-governance",
|
|
@@ -134,7 +134,7 @@ function ObjectLockRetentionSettings({ isEditRetentionSettings = false }) {
|
|
|
134
134
|
type: "radio",
|
|
135
135
|
value: "COMPLIANCE",
|
|
136
136
|
disabled: !isDefaultRetentionEnabled,
|
|
137
|
-
...register(
|
|
137
|
+
...register('retentionMode')
|
|
138
138
|
}),
|
|
139
139
|
/*#__PURE__*/ jsx("label", {
|
|
140
140
|
htmlFor: "locktype-compliance",
|
|
@@ -180,21 +180,21 @@ function ObjectLockRetentionSettings({ isEditRetentionSettings = false }) {
|
|
|
180
180
|
/*#__PURE__*/ jsx(Controller, {
|
|
181
181
|
control: control,
|
|
182
182
|
name: "retentionPeriodFrequencyChoice",
|
|
183
|
-
defaultValue:
|
|
183
|
+
defaultValue: 'DAYS',
|
|
184
184
|
render: ({ field: { onChange, value: retentionPeriodFrequencyChoice } })=>/*#__PURE__*/ jsxs(Select, {
|
|
185
185
|
id: "retentionPeriodFrequencyChoice",
|
|
186
186
|
onChange: onChange,
|
|
187
187
|
placeholder: "retentionPeriodFrequencyChoice",
|
|
188
188
|
value: retentionPeriodFrequencyChoice,
|
|
189
189
|
disabled: !isDefaultRetentionEnabled,
|
|
190
|
-
size:
|
|
190
|
+
size: '1/3',
|
|
191
191
|
children: [
|
|
192
192
|
/*#__PURE__*/ jsx(Select.Option, {
|
|
193
|
-
value:
|
|
193
|
+
value: 'DAYS',
|
|
194
194
|
children: "Days"
|
|
195
195
|
}),
|
|
196
196
|
/*#__PURE__*/ jsx(Select.Option, {
|
|
197
|
-
value:
|
|
197
|
+
value: 'YEARS',
|
|
198
198
|
children: "Years"
|
|
199
199
|
})
|
|
200
200
|
]
|
|
@@ -1,67 +1,68 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
3
|
-
import { useNavigate, useParams } from "react-router-dom";
|
|
4
|
-
import { FormProvider, useForm } from "react-hook-form";
|
|
5
2
|
import { joiResolver } from "@hookform/resolvers/joi";
|
|
6
|
-
import joi from "joi";
|
|
7
3
|
import { Form, Icon, Loader, Stack, Text, useToast } from "@scality/core-ui";
|
|
8
4
|
import { Button } from "@scality/core-ui/dist/next";
|
|
5
|
+
import joi from "joi";
|
|
6
|
+
import { useEffect, useRef } from "react";
|
|
7
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
8
|
+
import { useParams } from "react-router";
|
|
9
9
|
import { useGetBucketObjectLockConfiguration, useSetBucketObjectLockConfiguration } from "../../../hooks/index.js";
|
|
10
|
+
import { useDataBrowserNavigate } from "../../../hooks/useDataBrowserNavigate.js";
|
|
10
11
|
import ObjectLockRetentionSettings from "./ObjectLockRetentionSettings.js";
|
|
11
12
|
const objectLockRetentionSettingsValidationRules = {
|
|
12
13
|
isObjectLockEnabled: joi.boolean(),
|
|
13
14
|
isDefaultRetentionEnabled: joi.boolean().default(false),
|
|
14
|
-
retentionMode: joi.when(
|
|
15
|
+
retentionMode: joi.when('isDefaultRetentionEnabled', {
|
|
15
16
|
is: joi.equal(true),
|
|
16
|
-
then: joi.string().valid(
|
|
17
|
+
then: joi.string().valid('GOVERNANCE', 'COMPLIANCE').required(),
|
|
17
18
|
otherwise: joi.any()
|
|
18
19
|
}),
|
|
19
|
-
retentionPeriod: joi.when(
|
|
20
|
+
retentionPeriod: joi.when('isDefaultRetentionEnabled', {
|
|
20
21
|
is: joi.equal(true),
|
|
21
22
|
then: joi.number().integer().min(1).required(),
|
|
22
23
|
otherwise: joi.any()
|
|
23
24
|
}),
|
|
24
|
-
retentionPeriodFrequencyChoice: joi.when(
|
|
25
|
+
retentionPeriodFrequencyChoice: joi.when('isDefaultRetentionEnabled', {
|
|
25
26
|
is: joi.equal(true),
|
|
26
|
-
then: joi.string().valid(
|
|
27
|
+
then: joi.string().valid('DAYS', 'YEARS').required(),
|
|
27
28
|
otherwise: joi.any()
|
|
28
29
|
})
|
|
29
30
|
};
|
|
30
31
|
const schema = joi.object(objectLockRetentionSettingsValidationRules);
|
|
31
32
|
function ObjectLockSettings() {
|
|
32
33
|
const { bucketName } = useParams();
|
|
33
|
-
const navigate =
|
|
34
|
+
const navigate = useDataBrowserNavigate();
|
|
34
35
|
const { showToast } = useToast();
|
|
35
36
|
const { data: objectLockData, status: objectLockStatus } = useGetBucketObjectLockConfiguration({
|
|
36
37
|
Bucket: bucketName
|
|
37
38
|
});
|
|
38
39
|
const setBucketObjectLockMutation = useSetBucketObjectLockConfiguration();
|
|
39
|
-
const isObjectLockEnabled = objectLockData?.ObjectLockConfiguration?.ObjectLockEnabled ===
|
|
40
|
+
const isObjectLockEnabled = objectLockData?.ObjectLockConfiguration?.ObjectLockEnabled === 'Enabled';
|
|
40
41
|
const defaultRetention = objectLockData?.ObjectLockConfiguration?.Rule?.DefaultRetention;
|
|
41
42
|
const useFormMethods = useForm({
|
|
42
|
-
mode:
|
|
43
|
+
mode: 'all',
|
|
43
44
|
resolver: joiResolver(schema),
|
|
44
45
|
defaultValues: {
|
|
45
46
|
isObjectLockEnabled: isObjectLockEnabled,
|
|
46
47
|
isDefaultRetentionEnabled: !!defaultRetention,
|
|
47
|
-
retentionMode: defaultRetention?.Mode ||
|
|
48
|
+
retentionMode: defaultRetention?.Mode || 'GOVERNANCE',
|
|
48
49
|
retentionPeriod: defaultRetention?.Days || defaultRetention?.Years || 1,
|
|
49
|
-
retentionPeriodFrequencyChoice: defaultRetention ? defaultRetention?.Days ?
|
|
50
|
+
retentionPeriodFrequencyChoice: defaultRetention ? defaultRetention?.Days ? 'DAYS' : 'YEARS' : 'DAYS'
|
|
50
51
|
}
|
|
51
52
|
});
|
|
52
53
|
const { watch, setValue, handleSubmit, formState: { isValid } } = useFormMethods;
|
|
53
|
-
const isObjectLockEnabledValue = watch(
|
|
54
|
+
const isObjectLockEnabledValue = watch('isObjectLockEnabled');
|
|
54
55
|
const isFormInitialized = useRef(false);
|
|
55
56
|
useEffect(()=>{
|
|
56
|
-
if (
|
|
57
|
-
const isEnabled = objectLockData.ObjectLockConfiguration?.ObjectLockEnabled ===
|
|
57
|
+
if ('success' === objectLockStatus && objectLockData && !isFormInitialized.current) {
|
|
58
|
+
const isEnabled = objectLockData.ObjectLockConfiguration?.ObjectLockEnabled === 'Enabled';
|
|
58
59
|
const defaultRet = objectLockData.ObjectLockConfiguration?.Rule?.DefaultRetention;
|
|
59
|
-
setValue(
|
|
60
|
-
setValue(
|
|
60
|
+
setValue('isObjectLockEnabled', isEnabled);
|
|
61
|
+
setValue('isDefaultRetentionEnabled', !!defaultRet);
|
|
61
62
|
if (defaultRet) {
|
|
62
|
-
setValue(
|
|
63
|
-
setValue(
|
|
64
|
-
setValue(
|
|
63
|
+
setValue('retentionMode', defaultRet.Mode);
|
|
64
|
+
setValue('retentionPeriod', defaultRet.Days || defaultRet.Years || 1);
|
|
65
|
+
setValue('retentionPeriodFrequencyChoice', defaultRet.Days ? 'DAYS' : 'YEARS');
|
|
65
66
|
}
|
|
66
67
|
isFormInitialized.current = true;
|
|
67
68
|
}
|
|
@@ -77,12 +78,12 @@ function ObjectLockSettings() {
|
|
|
77
78
|
setBucketObjectLockMutation.mutate({
|
|
78
79
|
Bucket: bucketName,
|
|
79
80
|
ObjectLockConfiguration: data.isObjectLockEnabled ? {
|
|
80
|
-
ObjectLockEnabled:
|
|
81
|
+
ObjectLockEnabled: 'Enabled',
|
|
81
82
|
...data.isDefaultRetentionEnabled && {
|
|
82
83
|
Rule: {
|
|
83
84
|
DefaultRetention: {
|
|
84
85
|
Mode: data.retentionMode,
|
|
85
|
-
...
|
|
86
|
+
...'DAYS' === data.retentionPeriodFrequencyChoice ? {
|
|
86
87
|
Days: data.retentionPeriod
|
|
87
88
|
} : {
|
|
88
89
|
Years: data.retentionPeriod
|
|
@@ -95,22 +96,22 @@ function ObjectLockSettings() {
|
|
|
95
96
|
onSuccess: ()=>{
|
|
96
97
|
showToast({
|
|
97
98
|
open: true,
|
|
98
|
-
message:
|
|
99
|
-
status:
|
|
99
|
+
message: 'Object Lock settings saved successfully',
|
|
100
|
+
status: 'success'
|
|
100
101
|
});
|
|
101
102
|
navigate(`/buckets/${bucketName}`);
|
|
102
103
|
},
|
|
103
104
|
onError: (error)=>{
|
|
104
|
-
const errorMessage = error instanceof Error ? error.message :
|
|
105
|
+
const errorMessage = error instanceof Error ? error.message : 'Failed to save Object Lock settings';
|
|
105
106
|
showToast({
|
|
106
107
|
open: true,
|
|
107
108
|
message: errorMessage,
|
|
108
|
-
status:
|
|
109
|
+
status: 'error'
|
|
109
110
|
});
|
|
110
111
|
}
|
|
111
112
|
});
|
|
112
113
|
};
|
|
113
|
-
if (
|
|
114
|
+
if ('pending' === objectLockStatus) return /*#__PURE__*/ jsx(Loader, {
|
|
114
115
|
centered: true,
|
|
115
116
|
children: /*#__PURE__*/ jsx(Text, {
|
|
116
117
|
children: "Loading retention settings..."
|
|
@@ -122,8 +123,8 @@ function ObjectLockSettings() {
|
|
|
122
123
|
onSubmit: handleSubmit(onSubmit),
|
|
123
124
|
requireMode: "partial",
|
|
124
125
|
layout: {
|
|
125
|
-
kind:
|
|
126
|
-
title:
|
|
126
|
+
kind: 'page',
|
|
127
|
+
title: 'Object-lock settings'
|
|
127
128
|
},
|
|
128
129
|
rightActions: /*#__PURE__*/ jsxs(Stack, {
|
|
129
130
|
gap: "r16",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetObjectRetentionCommandOutput } from
|
|
1
|
+
import type { GetObjectRetentionCommandOutput } from '@aws-sdk/client-s3';
|
|
2
2
|
export declare function getDefaultRetention(retentionData: GetObjectRetentionCommandOutput | null | undefined): {
|
|
3
3
|
isDefaultRetentionEnabled: boolean;
|
|
4
4
|
defaultRetentionUntilDate: Date;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
function getDefaultRetention(retentionData) {
|
|
2
2
|
const isDefaultRetentionEnabled = retentionData?.Retention !== void 0 && null !== retentionData.Retention;
|
|
3
3
|
const defaultRetentionUntilDate = retentionData?.Retention?.RetainUntilDate ? new Date(retentionData.Retention.RetainUntilDate) : new Date();
|
|
4
|
-
const defaultRetentionMode = retentionData?.Retention?.Mode ||
|
|
4
|
+
const defaultRetentionMode = retentionData?.Retention?.Mode || 'GOVERNANCE';
|
|
5
5
|
return {
|
|
6
6
|
isDefaultRetentionEnabled,
|
|
7
7
|
defaultRetentionUntilDate,
|
|
@@ -13,13 +13,13 @@ function getDefaultMinRetainUntilDate(d, mode) {
|
|
|
13
13
|
tomorrow.setDate(tomorrow.getDate() + 1);
|
|
14
14
|
const futureDate = formatDateForInput(tomorrow);
|
|
15
15
|
if (!d) return futureDate;
|
|
16
|
-
const previousRetainUntilDate =
|
|
16
|
+
const previousRetainUntilDate = 'GOVERNANCE' === mode ? formatDateForInput(d) : formatDateForInput(addDays(d, 1));
|
|
17
17
|
return previousRetainUntilDate > futureDate ? previousRetainUntilDate : futureDate;
|
|
18
18
|
}
|
|
19
19
|
function formatDateForInput(date) {
|
|
20
20
|
const year = date.getFullYear();
|
|
21
|
-
const month = String(date.getMonth() + 1).padStart(2,
|
|
22
|
-
const day = String(date.getDate()).padStart(2,
|
|
21
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
22
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
23
23
|
return `${year}-${month}-${day}`;
|
|
24
24
|
}
|
|
25
25
|
function addDays(date, days) {
|
|
@@ -32,8 +32,8 @@ function getRetainUntilDateHint(dateString) {
|
|
|
32
32
|
const retainUntilDate = new Date(dateString);
|
|
33
33
|
const diffInMs = retainUntilDate.getTime() - now.getTime();
|
|
34
34
|
const diffInDays = Math.floor(diffInMs / 86400000);
|
|
35
|
-
if (diffInDays < 1) return
|
|
36
|
-
if (1 === diffInDays) return
|
|
35
|
+
if (diffInDays < 1) return '(within 24 hours from now)';
|
|
36
|
+
if (1 === diffInDays) return '(1 day from now)';
|
|
37
37
|
return `(${diffInDays} days from now)`;
|
|
38
38
|
}
|
|
39
39
|
export { getDefaultMinRetainUntilDate, getDefaultRetention, getRetainUntilDateHint };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { fireEvent, render, screen } from "@testing-library/react";
|
|
3
|
-
import { MemoryRouter, useNavigate } from "react-router
|
|
3
|
+
import { MemoryRouter, useNavigate } from "react-router";
|
|
4
|
+
import { useISVBucketStatus } from "../../../../hooks/index.js";
|
|
4
5
|
import { createTestWrapper } from "../../../../test/testUtils.js";
|
|
5
6
|
import { EditRetentionButton } from "../EditRetentionButton.js";
|
|
6
|
-
|
|
7
|
-
jest.mock(
|
|
8
|
-
jest.
|
|
9
|
-
...jest.requireActual("react-router-dom"),
|
|
7
|
+
jest.mock('../../../../hooks');
|
|
8
|
+
jest.mock('react-router', ()=>({
|
|
9
|
+
...jest.requireActual('react-router'),
|
|
10
10
|
useNavigate: jest.fn()
|
|
11
11
|
}));
|
|
12
12
|
const mockUseISVBucketStatus = jest.mocked(useISVBucketStatus);
|
|
@@ -36,168 +36,168 @@ beforeEach(()=>{
|
|
|
36
36
|
isISVManaged: false,
|
|
37
37
|
isvApplication: void 0,
|
|
38
38
|
isLoading: false,
|
|
39
|
-
bucketTagsStatus:
|
|
39
|
+
bucketTagsStatus: 'success'
|
|
40
40
|
});
|
|
41
41
|
});
|
|
42
|
-
it(
|
|
42
|
+
it('renders edit button', ()=>{
|
|
43
43
|
renderEditRetentionButton();
|
|
44
|
-
const editButton = screen.getByRole(
|
|
44
|
+
const editButton = screen.getByRole('button', {
|
|
45
45
|
name: /edit default retention/i
|
|
46
46
|
});
|
|
47
47
|
expect(editButton).toBeInTheDocument();
|
|
48
48
|
});
|
|
49
|
-
it(
|
|
49
|
+
it('navigates to object lock settings page when clicked', ()=>{
|
|
50
50
|
const { navigate } = renderEditRetentionButton();
|
|
51
|
-
const editButton = screen.getByRole(
|
|
51
|
+
const editButton = screen.getByRole('button', {
|
|
52
52
|
name: /edit default retention/i
|
|
53
53
|
});
|
|
54
54
|
fireEvent.click(editButton);
|
|
55
|
-
expect(navigate).toHaveBeenCalledWith(
|
|
55
|
+
expect(navigate).toHaveBeenCalledWith('/buckets/test-bucket/objects/object-lock-settings');
|
|
56
56
|
});
|
|
57
|
-
it(
|
|
57
|
+
it('navigates with correct bucket name', ()=>{
|
|
58
58
|
const { navigate } = renderEditRetentionButton();
|
|
59
|
-
const editButton = screen.getByRole(
|
|
59
|
+
const editButton = screen.getByRole('button', {
|
|
60
60
|
name: /edit default retention/i
|
|
61
61
|
});
|
|
62
62
|
fireEvent.click(editButton);
|
|
63
|
-
expect(navigate).toHaveBeenCalledWith(
|
|
63
|
+
expect(navigate).toHaveBeenCalledWith('/buckets/test-bucket/objects/object-lock-settings');
|
|
64
64
|
});
|
|
65
|
-
it(
|
|
65
|
+
it('is enabled for regular buckets without ISV tags', ()=>{
|
|
66
66
|
renderEditRetentionButton();
|
|
67
|
-
const editButton = screen.getByRole(
|
|
67
|
+
const editButton = screen.getByRole('button', {
|
|
68
68
|
name: /edit default retention/i
|
|
69
69
|
});
|
|
70
70
|
expect(editButton).not.toBeDisabled();
|
|
71
71
|
});
|
|
72
|
-
it(
|
|
72
|
+
it('is disabled for Veeam Backup & Replication buckets', ()=>{
|
|
73
73
|
mockUseISVBucketStatus.mockReturnValue({
|
|
74
74
|
isVeeamBucket: true,
|
|
75
75
|
isCommvaultBucket: false,
|
|
76
76
|
isISVManaged: true,
|
|
77
|
-
isvApplication:
|
|
77
|
+
isvApplication: 'Veeam',
|
|
78
78
|
isLoading: false,
|
|
79
|
-
bucketTagsStatus:
|
|
79
|
+
bucketTagsStatus: 'success'
|
|
80
80
|
});
|
|
81
81
|
renderEditRetentionButton();
|
|
82
|
-
const editButton = screen.getByRole(
|
|
82
|
+
const editButton = screen.getByRole('button', {
|
|
83
83
|
name: /edit default retention/i
|
|
84
84
|
});
|
|
85
85
|
expect(editButton).toBeDisabled();
|
|
86
86
|
});
|
|
87
|
-
it(
|
|
87
|
+
it('is disabled for Veeam Office 365 v6/v7 buckets', ()=>{
|
|
88
88
|
mockUseISVBucketStatus.mockReturnValue({
|
|
89
89
|
isVeeamBucket: true,
|
|
90
90
|
isCommvaultBucket: false,
|
|
91
91
|
isISVManaged: true,
|
|
92
|
-
isvApplication:
|
|
92
|
+
isvApplication: 'Veeam',
|
|
93
93
|
isLoading: false,
|
|
94
|
-
bucketTagsStatus:
|
|
94
|
+
bucketTagsStatus: 'success'
|
|
95
95
|
});
|
|
96
96
|
renderEditRetentionButton();
|
|
97
|
-
const editButton = screen.getByRole(
|
|
97
|
+
const editButton = screen.getByRole('button', {
|
|
98
98
|
name: /edit default retention/i
|
|
99
99
|
});
|
|
100
100
|
expect(editButton).toBeDisabled();
|
|
101
101
|
});
|
|
102
|
-
it(
|
|
102
|
+
it('is disabled for Veeam Office 365 v8+ buckets', ()=>{
|
|
103
103
|
mockUseISVBucketStatus.mockReturnValue({
|
|
104
104
|
isVeeamBucket: true,
|
|
105
105
|
isCommvaultBucket: false,
|
|
106
106
|
isISVManaged: true,
|
|
107
|
-
isvApplication:
|
|
107
|
+
isvApplication: 'Veeam',
|
|
108
108
|
isLoading: false,
|
|
109
|
-
bucketTagsStatus:
|
|
109
|
+
bucketTagsStatus: 'success'
|
|
110
110
|
});
|
|
111
111
|
renderEditRetentionButton();
|
|
112
|
-
const editButton = screen.getByRole(
|
|
112
|
+
const editButton = screen.getByRole('button', {
|
|
113
113
|
name: /edit default retention/i
|
|
114
114
|
});
|
|
115
115
|
expect(editButton).toBeDisabled();
|
|
116
116
|
});
|
|
117
|
-
it(
|
|
117
|
+
it('is disabled for Commvault buckets', ()=>{
|
|
118
118
|
mockUseISVBucketStatus.mockReturnValue({
|
|
119
119
|
isVeeamBucket: false,
|
|
120
120
|
isCommvaultBucket: true,
|
|
121
121
|
isISVManaged: true,
|
|
122
|
-
isvApplication:
|
|
122
|
+
isvApplication: 'Commvault',
|
|
123
123
|
isLoading: false,
|
|
124
|
-
bucketTagsStatus:
|
|
124
|
+
bucketTagsStatus: 'success'
|
|
125
125
|
});
|
|
126
126
|
renderEditRetentionButton();
|
|
127
|
-
const editButton = screen.getByRole(
|
|
127
|
+
const editButton = screen.getByRole('button', {
|
|
128
128
|
name: /edit default retention/i
|
|
129
129
|
});
|
|
130
130
|
expect(editButton).toBeDisabled();
|
|
131
131
|
});
|
|
132
|
-
it(
|
|
132
|
+
it('is disabled for ISV buckets tagged as Veeam Backup for Microsoft 365', ()=>{
|
|
133
133
|
mockUseISVBucketStatus.mockReturnValue({
|
|
134
134
|
isVeeamBucket: true,
|
|
135
135
|
isCommvaultBucket: false,
|
|
136
136
|
isISVManaged: true,
|
|
137
|
-
isvApplication:
|
|
137
|
+
isvApplication: 'Veeam',
|
|
138
138
|
isLoading: false,
|
|
139
|
-
bucketTagsStatus:
|
|
139
|
+
bucketTagsStatus: 'success'
|
|
140
140
|
});
|
|
141
141
|
renderEditRetentionButton();
|
|
142
|
-
const editButton = screen.getByRole(
|
|
142
|
+
const editButton = screen.getByRole('button', {
|
|
143
143
|
name: /edit default retention/i
|
|
144
144
|
});
|
|
145
145
|
expect(editButton).toBeDisabled();
|
|
146
146
|
});
|
|
147
|
-
it(
|
|
147
|
+
it('is disabled for ISV buckets tagged as Veeam Backup & Replication', ()=>{
|
|
148
148
|
mockUseISVBucketStatus.mockReturnValue({
|
|
149
149
|
isVeeamBucket: true,
|
|
150
150
|
isCommvaultBucket: false,
|
|
151
151
|
isISVManaged: true,
|
|
152
|
-
isvApplication:
|
|
152
|
+
isvApplication: 'Veeam',
|
|
153
153
|
isLoading: false,
|
|
154
|
-
bucketTagsStatus:
|
|
154
|
+
bucketTagsStatus: 'success'
|
|
155
155
|
});
|
|
156
156
|
renderEditRetentionButton();
|
|
157
|
-
const editButton = screen.getByRole(
|
|
157
|
+
const editButton = screen.getByRole('button', {
|
|
158
158
|
name: /edit default retention/i
|
|
159
159
|
});
|
|
160
160
|
expect(editButton).toBeDisabled();
|
|
161
161
|
});
|
|
162
|
-
it(
|
|
162
|
+
it('handles missing bucket tags gracefully', ()=>{
|
|
163
163
|
renderEditRetentionButton();
|
|
164
|
-
const editButton = screen.getByRole(
|
|
164
|
+
const editButton = screen.getByRole('button', {
|
|
165
165
|
name: /edit default retention/i
|
|
166
166
|
});
|
|
167
167
|
expect(editButton).not.toBeDisabled();
|
|
168
168
|
});
|
|
169
|
-
it(
|
|
169
|
+
it('handles empty TagSet gracefully', ()=>{
|
|
170
170
|
renderEditRetentionButton();
|
|
171
|
-
const editButton = screen.getByRole(
|
|
171
|
+
const editButton = screen.getByRole('button', {
|
|
172
172
|
name: /edit default retention/i
|
|
173
173
|
});
|
|
174
174
|
expect(editButton).not.toBeDisabled();
|
|
175
175
|
});
|
|
176
|
-
it(
|
|
176
|
+
it('is enabled for buckets with non-ISV tags', ()=>{
|
|
177
177
|
renderEditRetentionButton();
|
|
178
|
-
const editButton = screen.getByRole(
|
|
178
|
+
const editButton = screen.getByRole('button', {
|
|
179
179
|
name: /edit default retention/i
|
|
180
180
|
});
|
|
181
181
|
expect(editButton).not.toBeDisabled();
|
|
182
182
|
});
|
|
183
|
-
it(
|
|
183
|
+
it('handles bucket tagging query error gracefully', ()=>{
|
|
184
184
|
renderEditRetentionButton();
|
|
185
|
-
const editButton = screen.getByRole(
|
|
185
|
+
const editButton = screen.getByRole('button', {
|
|
186
186
|
name: /edit default retention/i
|
|
187
187
|
});
|
|
188
188
|
expect(editButton).not.toBeDisabled();
|
|
189
189
|
});
|
|
190
|
-
it(
|
|
190
|
+
it('shows loading state when fetching bucket tags', ()=>{
|
|
191
191
|
mockUseISVBucketStatus.mockReturnValue({
|
|
192
192
|
isVeeamBucket: false,
|
|
193
193
|
isCommvaultBucket: false,
|
|
194
194
|
isISVManaged: false,
|
|
195
195
|
isvApplication: void 0,
|
|
196
196
|
isLoading: true,
|
|
197
|
-
bucketTagsStatus:
|
|
197
|
+
bucketTagsStatus: 'pending'
|
|
198
198
|
});
|
|
199
199
|
renderEditRetentionButton();
|
|
200
|
-
const editButton = screen.getByRole(
|
|
200
|
+
const editButton = screen.getByRole('button', {
|
|
201
201
|
name: /edit default retention/i
|
|
202
202
|
});
|
|
203
203
|
expect(editButton).toBeInTheDocument();
|