@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,50 @@
|
|
|
1
|
+
import type { ObjectLockRetentionMode } from '@aws-sdk/client-s3';
|
|
2
|
+
import Joi from 'joi';
|
|
3
|
+
export declare const bucketErrorMessage = "Bucket names can include only lowercase letters, numbers, dots (.), and hyphens (-)";
|
|
4
|
+
export declare const bucketNameValidationSchema: Joi.StringSchema<string>;
|
|
5
|
+
export declare const baseBucketCreateSchema: Joi.ObjectSchema<any>;
|
|
6
|
+
export type BucketCreateFormData = {
|
|
7
|
+
name: string;
|
|
8
|
+
isVersioning: boolean;
|
|
9
|
+
isEncryptionEnabled: boolean;
|
|
10
|
+
isObjectLockEnabled: boolean;
|
|
11
|
+
isDefaultRetentionEnabled: boolean;
|
|
12
|
+
retentionMode: ObjectLockRetentionMode;
|
|
13
|
+
retentionPeriod: number;
|
|
14
|
+
retentionPeriodFrequencyChoice: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
};
|
|
17
|
+
type BucketCreateProps = {
|
|
18
|
+
subTitle?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Custom validation schema - if not provided, uses baseBucketCreateSchema
|
|
21
|
+
*
|
|
22
|
+
* To enable uniqueness validation, provide context with existing bucket names:
|
|
23
|
+
* ```ts
|
|
24
|
+
* const schema = baseBucketCreateSchema.append({...});
|
|
25
|
+
* <BucketCreate
|
|
26
|
+
* validationSchema={schema}
|
|
27
|
+
* validationContext={{ existingBuckets: ['bucket1', 'bucket2'] }}
|
|
28
|
+
* />
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
validationSchema?: Joi.ObjectSchema;
|
|
32
|
+
/**
|
|
33
|
+
* Validation context passed to Joi schema
|
|
34
|
+
* Use this to provide existing bucket names for uniqueness validation
|
|
35
|
+
*/
|
|
36
|
+
validationContext?: {
|
|
37
|
+
existingBuckets?: string[];
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
};
|
|
40
|
+
/** Default form values - merged with base defaults */
|
|
41
|
+
defaultValues?: Partial<BucketCreateFormData>;
|
|
42
|
+
/** Children rendered between bucket name and versioning sections */
|
|
43
|
+
children?: React.ReactNode;
|
|
44
|
+
/** Callback when form is submitted with valid data */
|
|
45
|
+
onSubmit?: (data: BucketCreateFormData) => void;
|
|
46
|
+
/** Callback when cancel is clicked */
|
|
47
|
+
onCancel?: () => void;
|
|
48
|
+
};
|
|
49
|
+
export declare const BucketCreate: ({ subTitle, validationSchema, validationContext, defaultValues: customDefaultValues, children, onSubmit: onSubmitProp, onCancel: onCancelProp, }: BucketCreateProps) => import("react/jsx-runtime").JSX.Element;
|
|
50
|
+
export default BucketCreate;
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { joiResolver } from "@hookform/resolvers/joi";
|
|
3
|
+
import { Checkbox, Form, FormGroup, FormSection, Stack, useToast } from "@scality/core-ui";
|
|
4
|
+
import { Button, Input } from "@scality/core-ui/dist/next";
|
|
5
|
+
import { convertRemToPixels } from "@scality/core-ui/dist/utils";
|
|
6
|
+
import joi from "joi";
|
|
7
|
+
import { FormProvider, useForm } from "react-hook-form";
|
|
8
|
+
import { useCreateBucket, useSetBucketEncryption, useSetBucketObjectLockConfiguration, useSetBucketVersioning } from "../../hooks/index.js";
|
|
9
|
+
import { useDataBrowserNavigate } from "../../hooks/useDataBrowserNavigate.js";
|
|
10
|
+
import ObjectLockRetentionSettings from "../objects/ObjectLock/ObjectLockRetentionSettings.js";
|
|
11
|
+
import { objectLockRetentionSettingsValidationRules } from "../objects/ObjectLock/ObjectLockSettings.js";
|
|
12
|
+
import { useDataBrowserConfig } from "../providers/DataBrowserProvider.js";
|
|
13
|
+
const bucketErrorMessage = 'Bucket names can include only lowercase letters, numbers, dots (.), and hyphens (-)';
|
|
14
|
+
const bucketNameValidationSchema = joi.string().label('Bucket Name').required().min(3).max(63).pattern(/^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$/, {
|
|
15
|
+
name: 'bucketName',
|
|
16
|
+
invert: false
|
|
17
|
+
}).messages({
|
|
18
|
+
'string.pattern.name': bucketErrorMessage
|
|
19
|
+
}).custom((value, helpers)=>{
|
|
20
|
+
if (value.includes('..')) return helpers.message({
|
|
21
|
+
custom: 'Bucket names cannot contain two adjacent periods'
|
|
22
|
+
});
|
|
23
|
+
if (/^(\d{1,3}\.){3}\d{1,3}$/.test(value)) return helpers.message({
|
|
24
|
+
custom: 'Bucket names must not be formatted as an IP address'
|
|
25
|
+
});
|
|
26
|
+
const forbiddenPrefixes = [
|
|
27
|
+
'xn--',
|
|
28
|
+
'sthree-',
|
|
29
|
+
'amzn-s3-demo-'
|
|
30
|
+
];
|
|
31
|
+
if (forbiddenPrefixes.some((prefix)=>value.startsWith(prefix))) return helpers.message({
|
|
32
|
+
custom: `Bucket names must not start with ${forbiddenPrefixes.join(', ')}`
|
|
33
|
+
});
|
|
34
|
+
const forbiddenSuffixes = [
|
|
35
|
+
'-s3alias',
|
|
36
|
+
'--ol-s3',
|
|
37
|
+
'--x-s3',
|
|
38
|
+
'.mrap'
|
|
39
|
+
];
|
|
40
|
+
if (forbiddenSuffixes.some((suffix)=>value.endsWith(suffix))) return helpers.message({
|
|
41
|
+
custom: `Bucket names must not end with ${forbiddenSuffixes.join(', ')}`
|
|
42
|
+
});
|
|
43
|
+
const existingBuckets = helpers.prefs.context?.existingBuckets;
|
|
44
|
+
if (Array.isArray(existingBuckets)) {
|
|
45
|
+
const isDuplicate = existingBuckets.some((bucketName)=>bucketName.toLowerCase() === value.toLowerCase());
|
|
46
|
+
if (isDuplicate) return helpers.message({
|
|
47
|
+
custom: 'A bucket with this name already exists'
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return value;
|
|
51
|
+
}, 'AWS S3 bucket naming rules');
|
|
52
|
+
const baseBucketCreateSchema = joi.object({
|
|
53
|
+
name: bucketNameValidationSchema,
|
|
54
|
+
isVersioning: joi.boolean(),
|
|
55
|
+
isEncryptionEnabled: joi.boolean(),
|
|
56
|
+
...objectLockRetentionSettingsValidationRules
|
|
57
|
+
});
|
|
58
|
+
const BucketCreate = ({ subTitle, validationSchema, validationContext, defaultValues: customDefaultValues, children, onSubmit: onSubmitProp, onCancel: onCancelProp })=>{
|
|
59
|
+
const navigate = useDataBrowserNavigate();
|
|
60
|
+
const { showToast } = useToast();
|
|
61
|
+
const baseDefaultValues = {
|
|
62
|
+
name: '',
|
|
63
|
+
isVersioning: false,
|
|
64
|
+
isEncryptionEnabled: false,
|
|
65
|
+
isObjectLockEnabled: false,
|
|
66
|
+
isDefaultRetentionEnabled: false,
|
|
67
|
+
retentionMode: 'GOVERNANCE',
|
|
68
|
+
retentionPeriod: 1,
|
|
69
|
+
retentionPeriodFrequencyChoice: 'DAYS',
|
|
70
|
+
...customDefaultValues
|
|
71
|
+
};
|
|
72
|
+
const useFormMethods = useForm({
|
|
73
|
+
mode: 'all',
|
|
74
|
+
resolver: joiResolver(validationSchema || baseBucketCreateSchema, {
|
|
75
|
+
context: validationContext || {}
|
|
76
|
+
}),
|
|
77
|
+
defaultValues: baseDefaultValues,
|
|
78
|
+
context: validationContext
|
|
79
|
+
});
|
|
80
|
+
const { register, handleSubmit, formState, watch } = useFormMethods;
|
|
81
|
+
const { isValid, errors } = formState;
|
|
82
|
+
const isObjectLockEnabled = watch('isObjectLockEnabled');
|
|
83
|
+
const { s3Capabilities } = useDataBrowserConfig();
|
|
84
|
+
const { mutate: createBucket, isPending: isCreatingBucket } = useCreateBucket();
|
|
85
|
+
const { mutate: setBucketVersioning } = useSetBucketVersioning();
|
|
86
|
+
const { mutate: setObjectLockConfig } = useSetBucketObjectLockConfiguration();
|
|
87
|
+
const { mutate: setBucketEncryption } = useSetBucketEncryption();
|
|
88
|
+
const handleCancel = ()=>{
|
|
89
|
+
if (onCancelProp) onCancelProp();
|
|
90
|
+
else navigate('/buckets');
|
|
91
|
+
};
|
|
92
|
+
const handleSuccess = (bucketName)=>{
|
|
93
|
+
showToast({
|
|
94
|
+
open: true,
|
|
95
|
+
message: `Bucket "${bucketName}" created successfully`,
|
|
96
|
+
status: 'success'
|
|
97
|
+
});
|
|
98
|
+
navigate(`/buckets/${bucketName}`);
|
|
99
|
+
};
|
|
100
|
+
const handleError = (error, operation)=>{
|
|
101
|
+
showToast({
|
|
102
|
+
open: true,
|
|
103
|
+
message: error instanceof Error ? error.message : `Failed to ${operation}`,
|
|
104
|
+
status: 'error'
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
const onSubmit = (data)=>{
|
|
108
|
+
if (onSubmitProp) return void onSubmitProp(data);
|
|
109
|
+
const bucketName = data.name;
|
|
110
|
+
const needsExplicitVersioning = data.isVersioning && !data.isObjectLockEnabled;
|
|
111
|
+
const needsRetentionConfig = data.isObjectLockEnabled && data.isDefaultRetentionEnabled;
|
|
112
|
+
const needsEncryption = data.isEncryptionEnabled;
|
|
113
|
+
createBucket({
|
|
114
|
+
Bucket: bucketName,
|
|
115
|
+
ObjectLockEnabledForBucket: data.isObjectLockEnabled || void 0
|
|
116
|
+
}, {
|
|
117
|
+
onSuccess: ()=>{
|
|
118
|
+
if (needsExplicitVersioning) setBucketVersioning({
|
|
119
|
+
Bucket: bucketName,
|
|
120
|
+
VersioningConfiguration: {
|
|
121
|
+
Status: 'Enabled'
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
onSuccess: ()=>{
|
|
125
|
+
if (needsEncryption) applyEncryption(bucketName);
|
|
126
|
+
else handleSuccess(bucketName);
|
|
127
|
+
},
|
|
128
|
+
onError: (error)=>handleError(error, 'enable versioning')
|
|
129
|
+
});
|
|
130
|
+
else if (needsRetentionConfig) {
|
|
131
|
+
const retentionConfig = {
|
|
132
|
+
Bucket: bucketName,
|
|
133
|
+
ObjectLockConfiguration: {
|
|
134
|
+
ObjectLockEnabled: 'Enabled',
|
|
135
|
+
Rule: {
|
|
136
|
+
DefaultRetention: {
|
|
137
|
+
Mode: data.retentionMode,
|
|
138
|
+
Days: 'DAYS' === data.retentionPeriodFrequencyChoice ? data.retentionPeriod : void 0,
|
|
139
|
+
Years: 'YEARS' === data.retentionPeriodFrequencyChoice ? data.retentionPeriod : void 0
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
setObjectLockConfig(retentionConfig, {
|
|
145
|
+
onSuccess: ()=>{
|
|
146
|
+
if (needsEncryption) applyEncryption(bucketName);
|
|
147
|
+
else handleSuccess(bucketName);
|
|
148
|
+
},
|
|
149
|
+
onError: (error)=>handleError(error, 'configure object lock retention')
|
|
150
|
+
});
|
|
151
|
+
} else if (needsEncryption) applyEncryption(bucketName);
|
|
152
|
+
else handleSuccess(bucketName);
|
|
153
|
+
},
|
|
154
|
+
onError: (error)=>handleError(error, 'create bucket')
|
|
155
|
+
});
|
|
156
|
+
};
|
|
157
|
+
const applyEncryption = (bucketName)=>{
|
|
158
|
+
setBucketEncryption({
|
|
159
|
+
Bucket: bucketName,
|
|
160
|
+
ServerSideEncryptionConfiguration: {
|
|
161
|
+
Rules: [
|
|
162
|
+
{
|
|
163
|
+
ApplyServerSideEncryptionByDefault: {
|
|
164
|
+
SSEAlgorithm: 'AES256'
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}, {
|
|
170
|
+
onSuccess: ()=>handleSuccess(bucketName),
|
|
171
|
+
onError: (error)=>handleError(error, 'enable bucket encryption')
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
return /*#__PURE__*/ jsx(FormProvider, {
|
|
175
|
+
...useFormMethods,
|
|
176
|
+
children: /*#__PURE__*/ jsxs(Form, {
|
|
177
|
+
layout: {
|
|
178
|
+
kind: 'page',
|
|
179
|
+
title: 'Create a New Bucket',
|
|
180
|
+
subTitle
|
|
181
|
+
},
|
|
182
|
+
requireMode: "partial",
|
|
183
|
+
onSubmit: handleSubmit(onSubmit),
|
|
184
|
+
rightActions: /*#__PURE__*/ jsxs(Stack, {
|
|
185
|
+
gap: "r16",
|
|
186
|
+
children: [
|
|
187
|
+
/*#__PURE__*/ jsx(Button, {
|
|
188
|
+
id: "cancel-btn",
|
|
189
|
+
variant: "outline",
|
|
190
|
+
onClick: handleCancel,
|
|
191
|
+
type: "button",
|
|
192
|
+
label: "Cancel"
|
|
193
|
+
}),
|
|
194
|
+
/*#__PURE__*/ jsx(Button, {
|
|
195
|
+
disabled: !isValid,
|
|
196
|
+
isLoading: isCreatingBucket,
|
|
197
|
+
id: "create-bucket-btn",
|
|
198
|
+
type: "submit",
|
|
199
|
+
variant: "primary",
|
|
200
|
+
label: "Create"
|
|
201
|
+
})
|
|
202
|
+
]
|
|
203
|
+
}),
|
|
204
|
+
children: [
|
|
205
|
+
/*#__PURE__*/ jsx(FormSection, {
|
|
206
|
+
forceLabelWidth: convertRemToPixels(17.5),
|
|
207
|
+
children: /*#__PURE__*/ jsxs(Stack, {
|
|
208
|
+
direction: "vertical",
|
|
209
|
+
gap: "r16",
|
|
210
|
+
children: [
|
|
211
|
+
/*#__PURE__*/ jsx(FormGroup, {
|
|
212
|
+
id: "name",
|
|
213
|
+
label: "Bucket Name",
|
|
214
|
+
required: true,
|
|
215
|
+
direction: "horizontal",
|
|
216
|
+
content: /*#__PURE__*/ jsx(Input, {
|
|
217
|
+
id: "name",
|
|
218
|
+
autoFocus: true,
|
|
219
|
+
...register('name')
|
|
220
|
+
}),
|
|
221
|
+
labelHelpTooltip: /*#__PURE__*/ jsxs("ul", {
|
|
222
|
+
children: [
|
|
223
|
+
/*#__PURE__*/ jsx("li", {
|
|
224
|
+
children: "Must be unique"
|
|
225
|
+
}),
|
|
226
|
+
/*#__PURE__*/ jsx("li", {
|
|
227
|
+
children: "Cannot be modified after creation"
|
|
228
|
+
}),
|
|
229
|
+
/*#__PURE__*/ jsx("li", {
|
|
230
|
+
children: bucketErrorMessage
|
|
231
|
+
})
|
|
232
|
+
]
|
|
233
|
+
}),
|
|
234
|
+
helpErrorPosition: "bottom",
|
|
235
|
+
error: errors.name ? errors.name?.type === 'string.pattern.base' ? bucketErrorMessage : errors.name?.message : void 0
|
|
236
|
+
}),
|
|
237
|
+
children,
|
|
238
|
+
s3Capabilities?.bucketEncryption && /*#__PURE__*/ jsx(FormGroup, {
|
|
239
|
+
id: "isEncryptionEnabled",
|
|
240
|
+
label: "Encryption",
|
|
241
|
+
labelHelpTooltip: "Objects stored in this bucket will be automatically encrypted.",
|
|
242
|
+
helpErrorPosition: "bottom",
|
|
243
|
+
content: /*#__PURE__*/ jsx(Checkbox, {
|
|
244
|
+
id: "isEncryptionEnabled",
|
|
245
|
+
...register('isEncryptionEnabled')
|
|
246
|
+
})
|
|
247
|
+
}),
|
|
248
|
+
/*#__PURE__*/ jsx(FormGroup, {
|
|
249
|
+
id: "isVersioning",
|
|
250
|
+
label: "Versioning",
|
|
251
|
+
disabled: isObjectLockEnabled,
|
|
252
|
+
labelHelpTooltip: /*#__PURE__*/ jsxs("ul", {
|
|
253
|
+
children: [
|
|
254
|
+
/*#__PURE__*/ jsx("li", {
|
|
255
|
+
children: "Versioning keeps multiple versions of each objects in your bucket. You can restore deleted or overwritten objects as a result of unintended user actions or application failures."
|
|
256
|
+
}),
|
|
257
|
+
/*#__PURE__*/ jsx("li", {
|
|
258
|
+
children: "It's possible to enable and suspend versioning at the bucket level after the bucket creation."
|
|
259
|
+
})
|
|
260
|
+
]
|
|
261
|
+
}),
|
|
262
|
+
help: isObjectLockEnabled ? 'Automatically activated when Object-lock is Enabled' : void 0,
|
|
263
|
+
helpErrorPosition: "bottom",
|
|
264
|
+
content: /*#__PURE__*/ jsx(Checkbox, {
|
|
265
|
+
id: "isVersioning",
|
|
266
|
+
disabled: isObjectLockEnabled,
|
|
267
|
+
...register('isVersioning')
|
|
268
|
+
})
|
|
269
|
+
})
|
|
270
|
+
]
|
|
271
|
+
})
|
|
272
|
+
}),
|
|
273
|
+
/*#__PURE__*/ jsx(ObjectLockRetentionSettings, {})
|
|
274
|
+
]
|
|
275
|
+
})
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
const buckets_BucketCreate = BucketCreate;
|
|
279
|
+
export { BucketCreate, baseBucketCreateSchema, bucketErrorMessage, bucketNameValidationSchema, buckets_BucketCreate as default };
|
|
@@ -1 +1,43 @@
|
|
|
1
|
+
import { useDataBrowserNavigate } from '../../hooks/useDataBrowserNavigate';
|
|
2
|
+
interface BucketDetailsContextValue {
|
|
3
|
+
bucketName: string;
|
|
4
|
+
navigate: ReturnType<typeof useDataBrowserNavigate>;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Context for BucketDetails component.
|
|
8
|
+
*
|
|
9
|
+
* **Important**: Always use `useBucketDetailsContext()` hook instead of accessing this context directly.
|
|
10
|
+
* The hook provides proper error handling if the context is not available.
|
|
11
|
+
*
|
|
12
|
+
* This context is exported for testing purposes only.
|
|
13
|
+
*/
|
|
14
|
+
export declare const BucketDetailsContext: import("react").Context<BucketDetailsContextValue | null>;
|
|
15
|
+
export declare function useBucketDetailsContext(): BucketDetailsContextValue;
|
|
16
|
+
declare const OverviewTab: React.FC;
|
|
17
|
+
declare const LifecycleTab: React.FC;
|
|
18
|
+
declare const ReplicationTab: React.FC;
|
|
19
|
+
declare const NotificationTab: React.FC;
|
|
20
|
+
interface CustomTabProps {
|
|
21
|
+
config: {
|
|
22
|
+
id: string;
|
|
23
|
+
title: string;
|
|
24
|
+
path?: string;
|
|
25
|
+
withoutPadding?: boolean;
|
|
26
|
+
render: () => React.ReactNode;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
declare const CustomTab: React.FC<CustomTabProps>;
|
|
30
|
+
interface BucketDetailsProps {
|
|
31
|
+
children?: React.ReactNode;
|
|
32
|
+
}
|
|
33
|
+
declare const BucketDetailsRoot: React.FC<BucketDetailsProps>;
|
|
1
34
|
export declare function BucketDetails(): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
type BucketDetailsComponent = typeof BucketDetailsRoot & {
|
|
36
|
+
OverviewTab: typeof OverviewTab;
|
|
37
|
+
LifecycleTab: typeof LifecycleTab;
|
|
38
|
+
ReplicationTab: typeof ReplicationTab;
|
|
39
|
+
NotificationTab: typeof NotificationTab;
|
|
40
|
+
CustomTab: typeof CustomTab;
|
|
41
|
+
};
|
|
42
|
+
declare const BucketDetailsCompound: BucketDetailsComponent;
|
|
43
|
+
export { BucketDetailsCompound };
|