@scality/data-browser-library 1.0.0-preview.11 → 1.0.0-preview.15
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 +27 -0
- package/dist/components/DataBrowserUI.js +88 -0
- package/dist/components/Editor.d.ts +1 -1
- package/dist/components/Editor.js +3 -3
- package/dist/components/__tests__/BucketCreate.test.js +102 -102
- package/dist/components/__tests__/BucketDetails.test.d.ts +1 -0
- package/dist/components/__tests__/BucketDetails.test.js +420 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.js +177 -177
- package/dist/components/__tests__/BucketLifecycleList.test.js +85 -85
- package/dist/components/__tests__/BucketList.test.js +463 -239
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +84 -84
- package/dist/components/__tests__/BucketOverview.test.js +273 -261
- package/dist/components/__tests__/BucketPolicyPage.test.js +62 -62
- package/dist/components/__tests__/BucketReplicationFormPage.test.js +542 -542
- 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 +62 -62
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +47 -47
- package/dist/components/__tests__/DeleteObjectButton.test.js +63 -63
- package/dist/components/__tests__/EmptyBucketButton.test.js +56 -56
- package/dist/components/__tests__/MetadataSearch.test.js +65 -65
- package/dist/components/__tests__/ObjectList.test.js +739 -238
- package/dist/components/__tests__/UploadButton.test.js +45 -45
- package/dist/components/buckets/BucketCreate.d.ts +2 -2
- package/dist/components/buckets/BucketCreate.js +41 -41
- package/dist/components/buckets/BucketDetails.d.ts +40 -0
- package/dist/components/buckets/BucketDetails.js +208 -88
- package/dist/components/buckets/BucketLifecycleFormPage.js +161 -160
- package/dist/components/buckets/BucketLifecycleList.d.ts +2 -2
- package/dist/components/buckets/BucketLifecycleList.js +46 -46
- package/dist/components/buckets/BucketList.d.ts +7 -8
- package/dist/components/buckets/BucketList.js +156 -100
- package/dist/components/buckets/BucketLocation.js +3 -3
- package/dist/components/buckets/BucketOverview.d.ts +7 -1
- package/dist/components/buckets/BucketOverview.js +366 -182
- package/dist/components/buckets/BucketPage.js +20 -16
- package/dist/components/buckets/BucketPolicyButton.js +2 -2
- package/dist/components/buckets/BucketPolicyPage.js +27 -25
- package/dist/components/buckets/BucketReplicationFormPage.js +133 -132
- package/dist/components/buckets/BucketReplicationList.d.ts +2 -2
- package/dist/components/buckets/BucketReplicationList.js +41 -41
- package/dist/components/buckets/BucketVersioning.js +13 -10
- package/dist/components/buckets/DeleteBucketButton.js +5 -5
- package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +2 -2
- package/dist/components/buckets/DeleteBucketConfigRuleButton.js +1 -1
- package/dist/components/buckets/EmptyBucketButton.js +20 -20
- package/dist/components/buckets/EmptyBucketSummary.d.ts +1 -1
- package/dist/components/buckets/EmptyBucketSummary.js +1 -1
- package/dist/components/buckets/EmptyBucketSummaryList.js +22 -22
- package/dist/components/buckets/__tests__/BucketVersioning.test.js +45 -45
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +34 -33
- package/dist/components/buckets/notifications/EventsSection.js +144 -28
- 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 +23 -21
- package/dist/components/index.js +4 -2
- package/dist/components/layouts/ArrowNavigation.d.ts +1 -2
- package/dist/components/layouts/ArrowNavigation.js +22 -10
- package/dist/components/layouts/BrowserPageLayout.d.ts +2 -3
- package/dist/components/layouts/BrowserPageLayout.js +1 -1
- package/dist/components/objects/CreateFolderButton.d.ts +2 -2
- package/dist/components/objects/CreateFolderButton.js +10 -10
- package/dist/components/objects/DeleteObjectButton.d.ts +1 -1
- package/dist/components/objects/DeleteObjectButton.js +20 -20
- package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +1 -1
- package/dist/components/objects/ObjectDetails/ObjectMetadata.js +56 -56
- package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +1 -1
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +294 -164
- package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +1 -1
- package/dist/components/objects/ObjectDetails/ObjectTags.js +25 -25
- 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 +813 -0
- package/dist/components/objects/ObjectDetails/index.d.ts +17 -1
- package/dist/components/objects/ObjectDetails/index.js +136 -50
- package/dist/components/objects/ObjectList.d.ts +11 -9
- package/dist/components/objects/ObjectList.js +576 -295
- package/dist/components/objects/ObjectLock/EditRetentionButton.js +3 -3
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +14 -14
- package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +1 -1
- package/dist/components/objects/ObjectLock/ObjectLockSettings.js +29 -28
- 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 +50 -50
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +77 -77
- package/dist/components/objects/ObjectPage.js +5 -4
- package/dist/components/objects/UploadButton.d.ts +3 -3
- package/dist/components/objects/UploadButton.js +6 -6
- package/dist/components/providers/DataBrowserProvider.d.ts +15 -4
- package/dist/components/providers/DataBrowserProvider.js +33 -11
- package/dist/components/search/MetadataSearch.js +26 -25
- package/dist/components/search/SearchHints.js +1 -1
- package/dist/components/ui/ArrayFieldActions.js +4 -4
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +1 -1
- package/dist/components/ui/ConfirmDeleteRuleModal.js +1 -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 +1 -1
- package/dist/components/ui/Search.elements.js +7 -7
- package/dist/components/ui/Table.elements.js +5 -5
- package/dist/config/factory.d.ts +23 -10
- package/dist/config/factory.js +22 -7
- package/dist/config/types.d.ts +134 -0
- package/dist/contexts/DataBrowserUICustomizationContext.d.ts +27 -0
- package/dist/contexts/DataBrowserUICustomizationContext.js +13 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.js +41 -41
- package/dist/hooks/__tests__/useIsBucketEmpty.test.js +25 -25
- package/dist/hooks/bucketConfiguration.d.ts +1 -1
- package/dist/hooks/bucketConfiguration.js +48 -48
- package/dist/hooks/bucketOperations.d.ts +1 -1
- package/dist/hooks/bucketOperations.js +6 -6
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +78 -78
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +78 -78
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +42 -42
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +61 -61
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +63 -63
- package/dist/hooks/factories/index.d.ts +4 -4
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +15 -12
- package/dist/hooks/factories/useCreateS3LoginHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3MutationHook.d.ts +3 -3
- package/dist/hooks/factories/useCreateS3MutationHook.js +6 -1
- package/dist/hooks/factories/useCreateS3QueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3QueryHook.js +8 -5
- package/dist/hooks/index.d.ts +14 -13
- package/dist/hooks/index.js +2 -1
- 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 +49 -49
- package/dist/hooks/presignedOperations.d.ts +2 -2
- package/dist/hooks/presignedOperations.js +3 -3
- package/dist/hooks/useBatchObjectLegalHold.js +7 -4
- package/dist/hooks/useDataBrowserNavigate.d.ts +14 -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 +10 -10
- package/dist/hooks/useISVBucketDetection.js +3 -3
- package/dist/hooks/useIsBucketEmpty.js +4 -4
- package/dist/hooks/useLoginMutation.d.ts +1 -1
- package/dist/hooks/useLoginMutation.js +1 -1
- package/dist/hooks/useS3Client.d.ts +5 -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/index.d.ts +6 -6
- 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 +31 -16
- 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 +72 -49
- package/dist/test/msw/index.d.ts +2 -2
- 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 +19 -19
- package/dist/test/testUtils.d.ts +70 -12
- package/dist/test/testUtils.js +160 -75
- package/dist/test/utils/errorHandling.test.js +119 -119
- package/dist/types/index.d.ts +8 -31
- package/dist/utils/__tests__/s3ConfigIdentifier.test.d.ts +1 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.js +429 -0
- package/dist/utils/constants.d.ts +7 -0
- package/dist/utils/constants.js +16 -9
- package/dist/utils/deletion/index.d.ts +2 -2
- 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 +2 -0
- package/dist/utils/proxyMiddleware.d.ts +1 -1
- package/dist/utils/proxyMiddleware.js +6 -11
- package/dist/utils/s3Client.d.ts +2 -2
- package/dist/utils/s3Client.js +1 -1
- package/dist/utils/s3ConfigIdentifier.d.ts +68 -0
- package/dist/utils/s3ConfigIdentifier.js +55 -0
- package/dist/utils/s3RuleUtils.d.ts +5 -5
- package/dist/utils/s3RuleUtils.js +17 -17
- package/dist/utils/useFeatures.js +1 -1
- package/dist/utils/useSupportedNotificationEvents.d.ts +6 -0
- package/dist/utils/useSupportedNotificationEvents.js +7 -0
- package/package.json +3 -3
|
@@ -4,34 +4,34 @@ import { Icon, Loader, Text, spacing, useToast } from "@scality/core-ui";
|
|
|
4
4
|
import { Box, Button, Input, Select } from "@scality/core-ui/dist/next";
|
|
5
5
|
import { convertSizeToRem } from "@scality/core-ui/dist/components/inputv2/inputv2";
|
|
6
6
|
import { Controller, useFieldArray, useForm } from "react-hook-form";
|
|
7
|
-
import { useQueryClient } from "@tanstack/react-query";
|
|
8
7
|
import { useCopyObject, useObjectMetadata } from "../../../hooks/index.js";
|
|
8
|
+
import { useInvalidateQueries } from "../../providers/DataBrowserProvider.js";
|
|
9
9
|
import { TableContainer } from "../../ui/Table.elements.js";
|
|
10
10
|
import { ArrayFieldActions } from "../../ui/ArrayFieldActions.js";
|
|
11
11
|
const METADATA_KEYS = [
|
|
12
12
|
{
|
|
13
|
-
key:
|
|
14
|
-
label:
|
|
13
|
+
key: 'CacheControl',
|
|
14
|
+
label: 'cache-control'
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
|
-
key:
|
|
18
|
-
label:
|
|
17
|
+
key: 'ContentDisposition',
|
|
18
|
+
label: 'content-disposition'
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
key:
|
|
22
|
-
label:
|
|
21
|
+
key: 'ContentEncoding',
|
|
22
|
+
label: 'content-encoding'
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
key:
|
|
26
|
-
label:
|
|
25
|
+
key: 'ContentType',
|
|
26
|
+
label: 'content-type'
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
key:
|
|
30
|
-
label:
|
|
29
|
+
key: 'WebsiteRedirectLocation',
|
|
30
|
+
label: 'website-redirect-location'
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
|
-
key:
|
|
34
|
-
label:
|
|
33
|
+
key: 'x-amz-meta',
|
|
34
|
+
label: 'x-amz-meta'
|
|
35
35
|
}
|
|
36
36
|
];
|
|
37
37
|
const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
@@ -45,17 +45,17 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
45
45
|
});
|
|
46
46
|
const copyObjectMutation = useCopyObject();
|
|
47
47
|
const { showToast } = useToast();
|
|
48
|
-
const
|
|
48
|
+
const invalidateQueries = useInvalidateQueries();
|
|
49
49
|
const [isInitialized, setIsInitialized] = useState(false);
|
|
50
50
|
const { control, handleSubmit, setValue, watch, formState: { errors, isValid, isSubmitting } } = useForm({
|
|
51
|
-
mode:
|
|
51
|
+
mode: 'onChange',
|
|
52
52
|
defaultValues: {
|
|
53
53
|
metadata: []
|
|
54
54
|
}
|
|
55
55
|
});
|
|
56
56
|
const { fields, append, remove } = useFieldArray({
|
|
57
57
|
control,
|
|
58
|
-
name:
|
|
58
|
+
name: 'metadata'
|
|
59
59
|
});
|
|
60
60
|
useEffect(()=>{
|
|
61
61
|
setIsInitialized(false);
|
|
@@ -66,37 +66,37 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
66
66
|
versionId
|
|
67
67
|
]);
|
|
68
68
|
useEffect(()=>{
|
|
69
|
-
if (metadata &&
|
|
69
|
+
if (metadata && 'success' === metadataStatus && !isInitialized) {
|
|
70
70
|
const rows = [];
|
|
71
71
|
const standardKeys = [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
'CacheControl',
|
|
73
|
+
'ContentDisposition',
|
|
74
|
+
'ContentEncoding',
|
|
75
|
+
'ContentType',
|
|
76
|
+
'WebsiteRedirectLocation'
|
|
77
77
|
];
|
|
78
78
|
standardKeys.forEach((keyType)=>{
|
|
79
79
|
const value = metadata[keyType];
|
|
80
80
|
if (value) rows.push({
|
|
81
81
|
keyType,
|
|
82
|
-
customKey:
|
|
82
|
+
customKey: '',
|
|
83
83
|
value
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
86
|
const userMetadata = metadata.Metadata || {};
|
|
87
87
|
Object.entries(userMetadata).forEach(([key, value])=>{
|
|
88
88
|
rows.push({
|
|
89
|
-
keyType:
|
|
89
|
+
keyType: 'x-amz-meta',
|
|
90
90
|
customKey: key,
|
|
91
91
|
value: value
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
94
|
if (0 === rows.length) rows.push({
|
|
95
|
-
keyType:
|
|
96
|
-
customKey:
|
|
97
|
-
value:
|
|
95
|
+
keyType: '',
|
|
96
|
+
customKey: '',
|
|
97
|
+
value: ''
|
|
98
98
|
});
|
|
99
|
-
setValue(
|
|
99
|
+
setValue('metadata', rows);
|
|
100
100
|
setIsInitialized(true);
|
|
101
101
|
}
|
|
102
102
|
}, [
|
|
@@ -106,9 +106,9 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
106
106
|
isInitialized
|
|
107
107
|
]);
|
|
108
108
|
const getAvailableOptions = (currentIndex)=>{
|
|
109
|
-
const allMetadata = watch(
|
|
110
|
-
const usedKeys = new Set(allMetadata.filter((row, idx)=>idx !== currentIndex &&
|
|
111
|
-
return METADATA_KEYS.filter((key)=>
|
|
109
|
+
const allMetadata = watch('metadata') || [];
|
|
110
|
+
const usedKeys = new Set(allMetadata.filter((row, idx)=>idx !== currentIndex && 'x-amz-meta' !== row.keyType).map((row)=>row.keyType));
|
|
111
|
+
return METADATA_KEYS.filter((key)=>'x-amz-meta' === key.key || !usedKeys.has(key.key));
|
|
112
112
|
};
|
|
113
113
|
const onSubmit = async (data)=>{
|
|
114
114
|
if (!metadata) return;
|
|
@@ -120,18 +120,18 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
120
120
|
Bucket: bucketName,
|
|
121
121
|
Key: objectKey,
|
|
122
122
|
CopySource: copySource,
|
|
123
|
-
MetadataDirective:
|
|
123
|
+
MetadataDirective: 'REPLACE',
|
|
124
124
|
Metadata: {}
|
|
125
125
|
};
|
|
126
126
|
validMetadata.forEach((row)=>{
|
|
127
|
-
if (
|
|
127
|
+
if ('x-amz-meta' === row.keyType) copyParams.Metadata[row.customKey.trim()] = row.value.trim();
|
|
128
128
|
else if (row.keyType) copyParams[row.keyType] = row.value.trim();
|
|
129
129
|
});
|
|
130
130
|
if (!copyParams.ContentType && metadata.ContentType) copyParams.ContentType = metadata.ContentType;
|
|
131
131
|
await copyObjectMutation.mutateAsync(copyParams);
|
|
132
|
-
await
|
|
132
|
+
await invalidateQueries({
|
|
133
133
|
queryKey: [
|
|
134
|
-
|
|
134
|
+
'HeadObject',
|
|
135
135
|
{
|
|
136
136
|
Bucket: bucketName,
|
|
137
137
|
Key: objectKey,
|
|
@@ -141,19 +141,19 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
141
141
|
});
|
|
142
142
|
showToast({
|
|
143
143
|
open: true,
|
|
144
|
-
message:
|
|
145
|
-
status:
|
|
144
|
+
message: 'Metadata saved successfully',
|
|
145
|
+
status: 'success'
|
|
146
146
|
});
|
|
147
147
|
} catch (error) {
|
|
148
|
-
const errorMessage = error instanceof Error ? error.message :
|
|
148
|
+
const errorMessage = error instanceof Error ? error.message : 'Failed to save metadata';
|
|
149
149
|
showToast({
|
|
150
150
|
open: true,
|
|
151
151
|
message: errorMessage,
|
|
152
|
-
status:
|
|
152
|
+
status: 'error'
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
155
|
};
|
|
156
|
-
if (
|
|
156
|
+
if ('pending' === metadataStatus) return /*#__PURE__*/ jsx(TableContainer, {
|
|
157
157
|
children: /*#__PURE__*/ jsx(Box, {
|
|
158
158
|
display: "flex",
|
|
159
159
|
justifyContent: "center",
|
|
@@ -161,7 +161,7 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
161
161
|
children: /*#__PURE__*/ jsx(Loader, {})
|
|
162
162
|
})
|
|
163
163
|
});
|
|
164
|
-
if (
|
|
164
|
+
if ('error' === metadataStatus) return /*#__PURE__*/ jsx(TableContainer, {
|
|
165
165
|
children: /*#__PURE__*/ jsx(Box, {
|
|
166
166
|
padding: spacing.r16,
|
|
167
167
|
children: /*#__PURE__*/ jsx(Text, {
|
|
@@ -224,7 +224,7 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
224
224
|
})
|
|
225
225
|
}),
|
|
226
226
|
/*#__PURE__*/ jsx(Box, {
|
|
227
|
-
width: convertSizeToRem(
|
|
227
|
+
width: convertSizeToRem('1/3')
|
|
228
228
|
})
|
|
229
229
|
]
|
|
230
230
|
}),
|
|
@@ -241,14 +241,14 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
241
241
|
rules: {
|
|
242
242
|
validate: (value, formValues)=>{
|
|
243
243
|
if (1 === formValues.metadata.length && !value && !formValues.metadata[0].value.trim()) return true;
|
|
244
|
-
if (!value) return
|
|
244
|
+
if (!value) return 'Please select a metadata key';
|
|
245
245
|
const allMetadata = formValues.metadata;
|
|
246
246
|
const usedKeys = allMetadata.map((row, idx)=>{
|
|
247
247
|
if (idx === index) return null;
|
|
248
|
-
if (
|
|
248
|
+
if ('x-amz-meta' === row.keyType) return row.customKey ? `x-amz-meta-${row.customKey.trim()}` : null;
|
|
249
249
|
return row.keyType;
|
|
250
250
|
}).filter(Boolean);
|
|
251
|
-
const currentKey =
|
|
251
|
+
const currentKey = 'x-amz-meta' === value ? formValues.metadata[index].customKey ? `x-amz-meta-${formValues.metadata[index].customKey.trim()}` : null : value;
|
|
252
252
|
if (currentKey && usedKeys.includes(currentKey)) return `Duplicate key "${currentKey}"`;
|
|
253
253
|
return true;
|
|
254
254
|
}
|
|
@@ -258,7 +258,7 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
258
258
|
value: value,
|
|
259
259
|
onChange: (newValue)=>{
|
|
260
260
|
onChange(newValue);
|
|
261
|
-
if (
|
|
261
|
+
if ('x-amz-meta' !== newValue) setValue(`metadata.${index}.customKey`, '');
|
|
262
262
|
},
|
|
263
263
|
placeholder: "Select key",
|
|
264
264
|
children: getAvailableOptions(index).map((key)=>/*#__PURE__*/ jsx(Select.Option, {
|
|
@@ -267,13 +267,13 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
267
267
|
}, key.key))
|
|
268
268
|
})
|
|
269
269
|
}),
|
|
270
|
-
|
|
270
|
+
'x-amz-meta' === watch(`metadata.${index}.keyType`) && /*#__PURE__*/ jsx(Controller, {
|
|
271
271
|
control: control,
|
|
272
272
|
name: `metadata.${index}.customKey`,
|
|
273
273
|
rules: {
|
|
274
274
|
validate: (value, formValues)=>{
|
|
275
|
-
if (
|
|
276
|
-
if (!value.trim()) return
|
|
275
|
+
if ('x-amz-meta' === formValues.metadata[index].keyType) {
|
|
276
|
+
if (!value.trim()) return 'Custom key required';
|
|
277
277
|
}
|
|
278
278
|
return true;
|
|
279
279
|
}
|
|
@@ -295,7 +295,7 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
295
295
|
rules: {
|
|
296
296
|
validate: (value, formValues)=>{
|
|
297
297
|
if (1 === formValues.metadata.length && !value.trim() && !formValues.metadata[0].keyType) return true;
|
|
298
|
-
if (!value.trim()) return
|
|
298
|
+
if (!value.trim()) return 'Value cannot be empty';
|
|
299
299
|
return true;
|
|
300
300
|
}
|
|
301
301
|
},
|
|
@@ -311,15 +311,15 @@ const ObjectMetadata = ({ bucketName, objectKey, versionId })=>{
|
|
|
311
311
|
onRemove: ()=>{
|
|
312
312
|
remove(index);
|
|
313
313
|
if (1 === fields.length) append({
|
|
314
|
-
keyType:
|
|
315
|
-
customKey:
|
|
316
|
-
value:
|
|
314
|
+
keyType: '',
|
|
315
|
+
customKey: '',
|
|
316
|
+
value: ''
|
|
317
317
|
});
|
|
318
318
|
},
|
|
319
319
|
onAdd: ()=>append({
|
|
320
|
-
keyType:
|
|
321
|
-
customKey:
|
|
322
|
-
value:
|
|
320
|
+
keyType: '',
|
|
321
|
+
customKey: '',
|
|
322
|
+
value: ''
|
|
323
323
|
}),
|
|
324
324
|
canRemove: true,
|
|
325
325
|
canAdd: !!watch(`metadata.${index}.keyType`) && !!watch(`metadata.${index}.value`),
|