@scality/data-browser-library 1.0.8 → 1.1.0
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/__tests__/BucketCorsPage.test.js +67 -9
- package/dist/components/__tests__/BucketDetails.test.js +1 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.js +16 -11
- package/dist/components/__tests__/BucketNotificationFormPage.test.js +45 -0
- package/dist/components/__tests__/BucketOverview.test.js +92 -2
- package/dist/components/__tests__/BucketPolicyPage.test.js +70 -51
- package/dist/components/__tests__/BucketReplicationFormPage.test.js +51 -24
- package/dist/components/__tests__/ObjectList.test.js +43 -2
- package/dist/components/buckets/BucketConfigEditButton.d.ts +2 -0
- package/dist/components/buckets/BucketConfigEditButton.js +9 -3
- package/dist/components/buckets/BucketCorsPage.js +57 -20
- package/dist/components/buckets/BucketDetails.js +27 -2
- package/dist/components/buckets/BucketLifecycleFormPage.js +310 -270
- package/dist/components/buckets/BucketOverview.js +21 -18
- package/dist/components/buckets/BucketPolicyPage.js +119 -83
- package/dist/components/buckets/BucketReplicationFormPage.d.ts +1 -0
- package/dist/components/buckets/BucketReplicationFormPage.js +165 -129
- package/dist/components/buckets/BucketVersioning.js +16 -10
- package/dist/components/buckets/__tests__/BucketVersioning.test.js +76 -23
- package/dist/components/buckets/notifications/BucketNotificationFormPage.js +13 -5
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +2 -2
- package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.js +3 -3
- package/dist/components/objects/ObjectList.js +22 -25
- package/dist/components/objects/ObjectLock/EditRetentionButton.js +2 -2
- package/dist/config/types.d.ts +11 -0
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +2 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/objectOperations.d.ts +3 -3
- package/dist/hooks/objectOperations.js +3 -3
- package/dist/hooks/useBucketConfigEditor.d.ts +4 -4
- package/dist/hooks/useBucketConfigEditor.js +16 -31
- package/dist/test/mocks/esmOnlyModules.js +4 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/utils/__tests__/proxyMiddleware.test.js +34 -0
- package/dist/utils/proxyMiddleware.js +2 -0
- package/package.json +4 -4
- package/dist/components/Editor.d.ts +0 -12
- package/dist/components/Editor.js +0 -28
- package/dist/types/monaco.d.ts +0 -13
- package/dist/types/monaco.js +0 -0
|
@@ -5,13 +5,14 @@ import { convertRemToPixels } from "@scality/core-ui/dist/components/tablev2/Tab
|
|
|
5
5
|
import { Box, Button, Input, Select } from "@scality/core-ui/dist/next";
|
|
6
6
|
import joi from "joi";
|
|
7
7
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
8
|
-
import { Controller, FormProvider, useFieldArray, useForm } from "react-hook-form";
|
|
8
|
+
import { Controller, FormProvider, useFieldArray, useForm, useFormContext } from "react-hook-form";
|
|
9
9
|
import { useParams } from "react-router";
|
|
10
10
|
import { useDataBrowserUICustomization } from "../../contexts/DataBrowserUICustomizationContext.js";
|
|
11
11
|
import { useGetBucketReplication, useSetBucketReplication } from "../../hooks/bucketConfiguration.js";
|
|
12
12
|
import { useBuckets } from "../../hooks/bucketOperations.js";
|
|
13
|
-
import { useISVBucketStatus } from "../../hooks/useISVBucketDetection.js";
|
|
14
13
|
import { useDataBrowserNavigate } from "../../hooks/useDataBrowserNavigate.js";
|
|
14
|
+
import { useFeatures } from "../../hooks/useFeatures.js";
|
|
15
|
+
import { useISVBucketStatus } from "../../hooks/useISVBucketDetection.js";
|
|
15
16
|
import { AWS_RULE_LIMITS, STATUS_OPTIONS, buildS3Filter } from "../../utils/s3RuleUtils.js";
|
|
16
17
|
import { FilterFormSection, createFilterValidationSchema } from "../ui/FilterFormSection.js";
|
|
17
18
|
const storageClassOptions = [
|
|
@@ -44,7 +45,7 @@ const storageClassOptions = [
|
|
|
44
45
|
label: 'Glacier Instant Retrieval'
|
|
45
46
|
}
|
|
46
47
|
];
|
|
47
|
-
const createSchema = (hasExistingRules)=>joi.object({
|
|
48
|
+
const createSchema = (hasExistingRules, hasCustomDestination)=>joi.object({
|
|
48
49
|
role: hasExistingRules ? joi.string().optional() : joi.string().required().messages({
|
|
49
50
|
'string.empty': 'Role ARN is required for first replication rule'
|
|
50
51
|
}),
|
|
@@ -61,10 +62,10 @@ const createSchema = (hasExistingRules)=>joi.object({
|
|
|
61
62
|
includeEncryptedObjects: joi.boolean(),
|
|
62
63
|
replicaModifications: joi.boolean(),
|
|
63
64
|
sameAccount: joi.boolean(),
|
|
64
|
-
targetBucket: joi.string().required().messages({
|
|
65
|
+
targetBucket: hasCustomDestination ? joi.string().allow('').optional() : joi.string().required().messages({
|
|
65
66
|
'string.empty': 'Target bucket is required'
|
|
66
67
|
}),
|
|
67
|
-
targetAccountId: joi.when('sameAccount', {
|
|
68
|
+
targetAccountId: hasCustomDestination ? joi.string().allow('').optional() : joi.when('sameAccount', {
|
|
68
69
|
is: false,
|
|
69
70
|
then: joi.string().required().messages({
|
|
70
71
|
'string.empty': 'Target account ID is required for cross-account replication'
|
|
@@ -185,8 +186,10 @@ const ToggleFormField = ({ name, label, id, control, labelHelpTooltip })=>/*#__P
|
|
|
185
186
|
})
|
|
186
187
|
})
|
|
187
188
|
});
|
|
188
|
-
const buildDestination = (data)=>
|
|
189
|
-
|
|
189
|
+
const buildDestination = (data, sourceBucketName)=>{
|
|
190
|
+
const bucketName = data.targetBucket || sourceBucketName;
|
|
191
|
+
return {
|
|
192
|
+
Bucket: `arn:aws:s3:::${bucketName}`,
|
|
190
193
|
...!data.sameAccount && data.targetAccountId && '' !== data.targetAccountId.trim() && {
|
|
191
194
|
Account: data.targetAccountId
|
|
192
195
|
},
|
|
@@ -219,7 +222,8 @@ const buildDestination = (data)=>({
|
|
|
219
222
|
Owner: 'Destination'
|
|
220
223
|
}
|
|
221
224
|
}
|
|
222
|
-
}
|
|
225
|
+
};
|
|
226
|
+
};
|
|
223
227
|
const buildSourceSelectionCriteria = (data)=>{
|
|
224
228
|
if (data.includeEncryptedObjects || data.replicaModifications) return {
|
|
225
229
|
...data.includeEncryptedObjects && {
|
|
@@ -234,12 +238,12 @@ const buildSourceSelectionCriteria = (data)=>{
|
|
|
234
238
|
}
|
|
235
239
|
};
|
|
236
240
|
};
|
|
237
|
-
const buildReplicationRule = (data)=>{
|
|
241
|
+
const buildReplicationRule = (data, sourceBucketName)=>{
|
|
238
242
|
const rule = {
|
|
239
243
|
ID: data.ruleId,
|
|
240
244
|
Status: data.status,
|
|
241
245
|
Priority: data.priority ?? 0,
|
|
242
|
-
Destination: buildDestination(data)
|
|
246
|
+
Destination: buildDestination(data, sourceBucketName)
|
|
243
247
|
};
|
|
244
248
|
const filter = buildS3Filter(data);
|
|
245
249
|
if (filter) rule.Filter = filter;
|
|
@@ -250,18 +254,95 @@ const buildReplicationRule = (data)=>{
|
|
|
250
254
|
};
|
|
251
255
|
return rule;
|
|
252
256
|
};
|
|
257
|
+
function DefaultReplicationDestinationFields() {
|
|
258
|
+
const { watch, register, control, formState: { errors } } = useFormContext();
|
|
259
|
+
const { bucketName } = useParams();
|
|
260
|
+
const { data: bucketsData } = useBuckets();
|
|
261
|
+
const availableBuckets = bucketsData?.Buckets || [];
|
|
262
|
+
const sameAccount = watch('sameAccount');
|
|
263
|
+
const showAdvancedReplication = useFeatures('replicationAdvanced');
|
|
264
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
265
|
+
children: [
|
|
266
|
+
/*#__PURE__*/ jsx(FormGroup, {
|
|
267
|
+
label: "Destination",
|
|
268
|
+
id: "sameAccount",
|
|
269
|
+
direction: "horizontal",
|
|
270
|
+
labelHelpTooltip: "Toggle between same-account and cross-account replication destination",
|
|
271
|
+
content: /*#__PURE__*/ jsx(Controller, {
|
|
272
|
+
name: "sameAccount",
|
|
273
|
+
control: control,
|
|
274
|
+
render: ({ field })=>/*#__PURE__*/ jsx(Toggle, {
|
|
275
|
+
toggle: field.value,
|
|
276
|
+
onChange: field.onChange,
|
|
277
|
+
label: field.value ? 'Same account destination' : 'Not same account destination'
|
|
278
|
+
})
|
|
279
|
+
})
|
|
280
|
+
}),
|
|
281
|
+
sameAccount ? /*#__PURE__*/ jsx(Fragment, {}) : /*#__PURE__*/ jsx("div", {
|
|
282
|
+
style: {
|
|
283
|
+
paddingLeft: spacing.r24
|
|
284
|
+
},
|
|
285
|
+
children: /*#__PURE__*/ jsx(FormGroup, {
|
|
286
|
+
label: "Target account ID",
|
|
287
|
+
id: "targetAccountId",
|
|
288
|
+
direction: "horizontal",
|
|
289
|
+
error: errors?.targetAccountId?.message,
|
|
290
|
+
helpErrorPosition: "bottom",
|
|
291
|
+
required: true,
|
|
292
|
+
content: /*#__PURE__*/ jsx(Input, {
|
|
293
|
+
id: "targetAccountId",
|
|
294
|
+
placeholder: "Account ID",
|
|
295
|
+
...register('targetAccountId')
|
|
296
|
+
})
|
|
297
|
+
})
|
|
298
|
+
}),
|
|
299
|
+
/*#__PURE__*/ jsx(FormGroup, {
|
|
300
|
+
label: "Target Bucket",
|
|
301
|
+
id: "targetBucket",
|
|
302
|
+
direction: "horizontal",
|
|
303
|
+
error: errors?.targetBucket?.message,
|
|
304
|
+
helpErrorPosition: "bottom",
|
|
305
|
+
required: true,
|
|
306
|
+
content: sameAccount ? /*#__PURE__*/ jsx(Controller, {
|
|
307
|
+
name: "targetBucket",
|
|
308
|
+
control: control,
|
|
309
|
+
render: ({ field })=>/*#__PURE__*/ jsx(Select, {
|
|
310
|
+
id: "targetBucket",
|
|
311
|
+
value: field.value,
|
|
312
|
+
onChange: field.onChange,
|
|
313
|
+
placeholder: "Select a bucket",
|
|
314
|
+
children: availableBuckets.filter((bucket)=>bucket.Name !== bucketName).map((bucket)=>/*#__PURE__*/ jsx(Select.Option, {
|
|
315
|
+
value: bucket.Name || '',
|
|
316
|
+
children: bucket.Name
|
|
317
|
+
}, bucket.Name))
|
|
318
|
+
})
|
|
319
|
+
}) : /*#__PURE__*/ jsx(Input, {
|
|
320
|
+
id: "targetBucket",
|
|
321
|
+
placeholder: "Bucket name",
|
|
322
|
+
...register('targetBucket')
|
|
323
|
+
})
|
|
324
|
+
}),
|
|
325
|
+
showAdvancedReplication && !sameAccount ? /*#__PURE__*/ jsx(ToggleFormField, {
|
|
326
|
+
name: "switchObjectOwnership",
|
|
327
|
+
label: "Switch Object ownership",
|
|
328
|
+
id: "switchObjectOwnership",
|
|
329
|
+
control: control,
|
|
330
|
+
labelHelpTooltip: "Change replica ownership to destination bucket owner (AccessControlTranslation)"
|
|
331
|
+
}) : /*#__PURE__*/ jsx(Fragment, {})
|
|
332
|
+
]
|
|
333
|
+
});
|
|
334
|
+
}
|
|
253
335
|
function BucketReplicationFormPage() {
|
|
254
|
-
const { storageClassSelector: StorageClassSelector, storageClassLabel } = useDataBrowserUICustomization();
|
|
336
|
+
const { storageClassSelector: StorageClassSelector, storageClassLabel, replicationRoleDefault, replicationDestinationFields: CustomDestinationFields } = useDataBrowserUICustomization();
|
|
255
337
|
const { bucketName, ruleId } = useParams();
|
|
256
338
|
const navigate = useDataBrowserNavigate();
|
|
257
339
|
const { showToast } = useToast();
|
|
258
340
|
const isEditMode = !!ruleId;
|
|
341
|
+
const showAdvancedReplication = useFeatures('replicationAdvanced');
|
|
259
342
|
const { isISVManaged, isvApplication, isLoading: isISVLoading } = useISVBucketStatus(bucketName);
|
|
260
343
|
const { data: replicationData, status: replicationStatus } = useGetBucketReplication({
|
|
261
344
|
Bucket: bucketName
|
|
262
345
|
});
|
|
263
|
-
const { data: bucketsData } = useBuckets();
|
|
264
|
-
const availableBuckets = bucketsData?.Buckets || [];
|
|
265
346
|
const existingRole = replicationData?.ReplicationConfiguration?.Role || '';
|
|
266
347
|
const hasExistingRules = (replicationData?.ReplicationConfiguration?.Rules || []).length > 0;
|
|
267
348
|
const existingRule = useMemo(()=>{
|
|
@@ -286,20 +367,21 @@ function BucketReplicationFormPage() {
|
|
|
286
367
|
}, [
|
|
287
368
|
replicationData
|
|
288
369
|
]);
|
|
289
|
-
const dynamicSchema = useMemo(()=>createSchema(hasExistingRules).keys({
|
|
370
|
+
const dynamicSchema = useMemo(()=>createSchema(hasExistingRules, !!CustomDestinationFields).keys({
|
|
290
371
|
ruleId: joi.string().required().invalid(...existingRuleIds).messages({
|
|
291
372
|
'string.empty': 'Rule ID is required',
|
|
292
373
|
'any.invalid': 'A rule with this ID already exists'
|
|
293
374
|
})
|
|
294
375
|
}), [
|
|
295
376
|
existingRuleIds,
|
|
296
|
-
hasExistingRules
|
|
377
|
+
hasExistingRules,
|
|
378
|
+
CustomDestinationFields
|
|
297
379
|
]);
|
|
298
380
|
const methods = useForm({
|
|
299
381
|
resolver: joiResolver(dynamicSchema),
|
|
300
382
|
mode: 'onChange',
|
|
301
383
|
defaultValues: {
|
|
302
|
-
role: '',
|
|
384
|
+
role: replicationRoleDefault || '',
|
|
303
385
|
ruleId: '',
|
|
304
386
|
status: 'Enabled',
|
|
305
387
|
priority: null,
|
|
@@ -327,11 +409,35 @@ function BucketReplicationFormPage() {
|
|
|
327
409
|
name: 'tags'
|
|
328
410
|
});
|
|
329
411
|
const filterType = watch('filterType');
|
|
330
|
-
const sameAccount = watch('sameAccount');
|
|
331
412
|
const encryptReplicatedObjects = watch('encryptReplicatedObjects');
|
|
332
413
|
const includeEncryptedObjects = watch('includeEncryptedObjects');
|
|
333
414
|
const deleteMarkerReplication = watch('deleteMarkerReplication');
|
|
334
415
|
const enforceRTC = watch('enforceRTC');
|
|
416
|
+
const storageClassField = /*#__PURE__*/ jsx(FormGroup, {
|
|
417
|
+
label: storageClassLabel || 'Storage Class',
|
|
418
|
+
id: "storageClass",
|
|
419
|
+
direction: "horizontal",
|
|
420
|
+
error: errors?.storageClass?.message,
|
|
421
|
+
helpErrorPosition: "bottom",
|
|
422
|
+
labelHelpTooltip: StorageClassSelector ? void 0 : 'Storage class for replicated objects in destination bucket',
|
|
423
|
+
content: /*#__PURE__*/ jsx(Controller, {
|
|
424
|
+
name: "storageClass",
|
|
425
|
+
control: control,
|
|
426
|
+
render: ({ field })=>StorageClassSelector ? /*#__PURE__*/ jsx(StorageClassSelector, {
|
|
427
|
+
value: field.value,
|
|
428
|
+
onChange: field.onChange,
|
|
429
|
+
context: "replication"
|
|
430
|
+
}) : /*#__PURE__*/ jsx(Select, {
|
|
431
|
+
id: "storageClass",
|
|
432
|
+
value: field.value,
|
|
433
|
+
onChange: field.onChange,
|
|
434
|
+
children: storageClassOptions.map((option)=>/*#__PURE__*/ jsx(Select.Option, {
|
|
435
|
+
value: option.value,
|
|
436
|
+
children: option.label
|
|
437
|
+
}, option.value))
|
|
438
|
+
})
|
|
439
|
+
})
|
|
440
|
+
});
|
|
335
441
|
const { mutate: setReplication, isPending: isSaving } = useSetBucketReplication();
|
|
336
442
|
const loadedRuleIdRef = useRef(null);
|
|
337
443
|
useEffect(()=>{
|
|
@@ -344,7 +450,7 @@ function BucketReplicationFormPage() {
|
|
|
344
450
|
} else if (!isEditMode && !isDirty) {
|
|
345
451
|
reset((prev)=>({
|
|
346
452
|
...prev,
|
|
347
|
-
role: existingRole,
|
|
453
|
+
role: existingRole || replicationRoleDefault || '',
|
|
348
454
|
priority: nextAvailablePriority
|
|
349
455
|
}));
|
|
350
456
|
loadedRuleIdRef.current = null;
|
|
@@ -353,6 +459,7 @@ function BucketReplicationFormPage() {
|
|
|
353
459
|
isEditMode,
|
|
354
460
|
existingRule,
|
|
355
461
|
existingRole,
|
|
462
|
+
replicationRoleDefault,
|
|
356
463
|
nextAvailablePriority,
|
|
357
464
|
isDirty,
|
|
358
465
|
reset
|
|
@@ -425,7 +532,7 @@ function BucketReplicationFormPage() {
|
|
|
425
532
|
]);
|
|
426
533
|
const onSubmit = useCallback((data)=>{
|
|
427
534
|
if (!bucketName) return;
|
|
428
|
-
const rule = buildReplicationRule(data);
|
|
535
|
+
const rule = buildReplicationRule(data, bucketName);
|
|
429
536
|
const existingRules = replicationData?.ReplicationConfiguration?.Rules || [];
|
|
430
537
|
const updatedRules = isEditMode ? existingRules.map((r)=>r.ID === existingRule?.ID ? rule : r) : [
|
|
431
538
|
...existingRules,
|
|
@@ -553,7 +660,7 @@ function BucketReplicationFormPage() {
|
|
|
553
660
|
direction: "horizontal",
|
|
554
661
|
error: errors?.role?.message,
|
|
555
662
|
helpErrorPosition: "bottom",
|
|
556
|
-
required:
|
|
663
|
+
required: true,
|
|
557
664
|
content: hasExistingRules ? /*#__PURE__*/ jsxs(Stack, {
|
|
558
665
|
direction: "vertical",
|
|
559
666
|
gap: "r8",
|
|
@@ -562,6 +669,7 @@ function BucketReplicationFormPage() {
|
|
|
562
669
|
children: existingRole || 'Not set'
|
|
563
670
|
}),
|
|
564
671
|
/*#__PURE__*/ jsx(Text, {
|
|
672
|
+
variant: "Small",
|
|
565
673
|
color: "textSecondary",
|
|
566
674
|
children: "To change the Role, edit it through bucket configuration or delete all rules first"
|
|
567
675
|
})
|
|
@@ -603,14 +711,10 @@ function BucketReplicationFormPage() {
|
|
|
603
711
|
content: /*#__PURE__*/ jsx(Controller, {
|
|
604
712
|
name: "status",
|
|
605
713
|
control: control,
|
|
606
|
-
render: ({ field })=>/*#__PURE__*/ jsx(
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
children: STATUS_OPTIONS.map((option)=>/*#__PURE__*/ jsx(Select.Option, {
|
|
611
|
-
value: option.value,
|
|
612
|
-
children: option.label
|
|
613
|
-
}, option.value))
|
|
714
|
+
render: ({ field })=>/*#__PURE__*/ jsx(Toggle, {
|
|
715
|
+
toggle: 'Enabled' === field.value,
|
|
716
|
+
onChange: (e)=>field.onChange(e.target.checked ? 'Enabled' : 'Disabled'),
|
|
717
|
+
label: 'Enabled' === field.value ? 'Enabled' : 'Disabled'
|
|
614
718
|
})
|
|
615
719
|
})
|
|
616
720
|
}),
|
|
@@ -652,98 +756,22 @@ function BucketReplicationFormPage() {
|
|
|
652
756
|
removeTag: removeTag,
|
|
653
757
|
errors: errors
|
|
654
758
|
}),
|
|
655
|
-
/*#__PURE__*/
|
|
759
|
+
/*#__PURE__*/ jsx(FormSection, {
|
|
656
760
|
title: {
|
|
657
761
|
name: 'Destination'
|
|
658
762
|
},
|
|
659
763
|
forceLabelWidth: convertRemToPixels(15),
|
|
660
|
-
children:
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
label: field.value ? 'Same account destination' : 'Not same account destination'
|
|
672
|
-
})
|
|
673
|
-
})
|
|
674
|
-
}),
|
|
675
|
-
sameAccount ? /*#__PURE__*/ jsx(Fragment, {}) : /*#__PURE__*/ jsx(FormGroup, {
|
|
676
|
-
label: "Target account ID",
|
|
677
|
-
id: "targetAccountId",
|
|
678
|
-
direction: "horizontal",
|
|
679
|
-
error: errors?.targetAccountId?.message,
|
|
680
|
-
helpErrorPosition: "bottom",
|
|
681
|
-
required: true,
|
|
682
|
-
content: /*#__PURE__*/ jsx(Input, {
|
|
683
|
-
id: "targetAccountId",
|
|
684
|
-
placeholder: "Account ID",
|
|
685
|
-
...register('targetAccountId')
|
|
686
|
-
})
|
|
687
|
-
}),
|
|
688
|
-
/*#__PURE__*/ jsx(FormGroup, {
|
|
689
|
-
label: "Target Bucket",
|
|
690
|
-
id: "targetBucket",
|
|
691
|
-
direction: "horizontal",
|
|
692
|
-
error: errors?.targetBucket?.message,
|
|
693
|
-
helpErrorPosition: "bottom",
|
|
694
|
-
required: true,
|
|
695
|
-
content: sameAccount ? /*#__PURE__*/ jsx(Controller, {
|
|
696
|
-
name: "targetBucket",
|
|
697
|
-
control: control,
|
|
698
|
-
render: ({ field })=>/*#__PURE__*/ jsx(Select, {
|
|
699
|
-
id: "targetBucket",
|
|
700
|
-
value: field.value,
|
|
701
|
-
onChange: field.onChange,
|
|
702
|
-
placeholder: "Select a bucket",
|
|
703
|
-
children: availableBuckets.filter((bucket)=>bucket.Name !== bucketName).map((bucket)=>/*#__PURE__*/ jsx(Select.Option, {
|
|
704
|
-
value: bucket.Name || '',
|
|
705
|
-
children: bucket.Name
|
|
706
|
-
}, bucket.Name))
|
|
707
|
-
})
|
|
708
|
-
}) : /*#__PURE__*/ jsx(Input, {
|
|
709
|
-
id: "targetBucket",
|
|
710
|
-
placeholder: "Bucket name",
|
|
711
|
-
...register('targetBucket')
|
|
712
|
-
})
|
|
713
|
-
}),
|
|
714
|
-
/*#__PURE__*/ jsx(FormGroup, {
|
|
715
|
-
label: storageClassLabel || 'Storage Class',
|
|
716
|
-
id: "storageClass",
|
|
717
|
-
direction: "horizontal",
|
|
718
|
-
error: errors?.storageClass?.message,
|
|
719
|
-
helpErrorPosition: "bottom",
|
|
720
|
-
labelHelpTooltip: StorageClassSelector ? void 0 : 'Storage class for replicated objects in destination bucket',
|
|
721
|
-
content: /*#__PURE__*/ jsx(Controller, {
|
|
722
|
-
name: "storageClass",
|
|
723
|
-
control: control,
|
|
724
|
-
render: ({ field })=>StorageClassSelector ? /*#__PURE__*/ jsx(StorageClassSelector, {
|
|
725
|
-
value: field.value,
|
|
726
|
-
onChange: field.onChange,
|
|
727
|
-
context: "replication"
|
|
728
|
-
}) : /*#__PURE__*/ jsx(Select, {
|
|
729
|
-
id: "storageClass",
|
|
730
|
-
value: field.value,
|
|
731
|
-
onChange: field.onChange,
|
|
732
|
-
children: storageClassOptions.map((option)=>/*#__PURE__*/ jsx(Select.Option, {
|
|
733
|
-
value: option.value,
|
|
734
|
-
children: option.label
|
|
735
|
-
}, option.value))
|
|
736
|
-
})
|
|
737
|
-
})
|
|
738
|
-
}),
|
|
739
|
-
sameAccount ? /*#__PURE__*/ jsx(Fragment, {}) : /*#__PURE__*/ jsx(ToggleFormField, {
|
|
740
|
-
name: "switchObjectOwnership",
|
|
741
|
-
label: "Switch Object ownership",
|
|
742
|
-
id: "switchObjectOwnership",
|
|
743
|
-
control: control,
|
|
744
|
-
labelHelpTooltip: "Change replica ownership to destination bucket owner (AccessControlTranslation)"
|
|
745
|
-
})
|
|
746
|
-
]
|
|
764
|
+
children: CustomDestinationFields ? /*#__PURE__*/ jsxs(Fragment, {
|
|
765
|
+
children: [
|
|
766
|
+
storageClassField,
|
|
767
|
+
/*#__PURE__*/ jsx(CustomDestinationFields, {})
|
|
768
|
+
]
|
|
769
|
+
}) : /*#__PURE__*/ jsxs(Fragment, {
|
|
770
|
+
children: [
|
|
771
|
+
/*#__PURE__*/ jsx(DefaultReplicationDestinationFields, {}),
|
|
772
|
+
storageClassField
|
|
773
|
+
]
|
|
774
|
+
})
|
|
747
775
|
}),
|
|
748
776
|
/*#__PURE__*/ jsxs(FormSection, {
|
|
749
777
|
title: {
|
|
@@ -781,29 +809,35 @@ function BucketReplicationFormPage() {
|
|
|
781
809
|
})
|
|
782
810
|
}),
|
|
783
811
|
includeEncryptedObjects && /*#__PURE__*/ jsx(Text, {
|
|
812
|
+
variant: "Small",
|
|
784
813
|
color: "textSecondary",
|
|
785
814
|
children: "Encryption is required when replicating encrypted objects"
|
|
786
815
|
})
|
|
787
816
|
]
|
|
788
817
|
})
|
|
789
818
|
}),
|
|
790
|
-
encryptReplicatedObjects ? /*#__PURE__*/ jsx(
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
labelHelpTooltip: "KMS key ID or ARN to use for encrypting replicated objects",
|
|
797
|
-
required: true,
|
|
798
|
-
content: /*#__PURE__*/ jsx(Input, {
|
|
819
|
+
encryptReplicatedObjects ? /*#__PURE__*/ jsx("div", {
|
|
820
|
+
style: {
|
|
821
|
+
paddingLeft: spacing.r24
|
|
822
|
+
},
|
|
823
|
+
children: /*#__PURE__*/ jsx(FormGroup, {
|
|
824
|
+
label: "Replica KMS Key ID",
|
|
799
825
|
id: "replicaKmsKeyId",
|
|
800
|
-
|
|
801
|
-
|
|
826
|
+
direction: "horizontal",
|
|
827
|
+
error: errors?.replicaKmsKeyId?.message,
|
|
828
|
+
helpErrorPosition: "bottom",
|
|
829
|
+
labelHelpTooltip: "KMS key ID or ARN to use for encrypting replicated objects",
|
|
830
|
+
required: true,
|
|
831
|
+
content: /*#__PURE__*/ jsx(Input, {
|
|
832
|
+
id: "replicaKmsKeyId",
|
|
833
|
+
placeholder: "KMS Key ID or ARN",
|
|
834
|
+
...register('replicaKmsKeyId')
|
|
835
|
+
})
|
|
802
836
|
})
|
|
803
837
|
}) : /*#__PURE__*/ jsx(Fragment, {})
|
|
804
838
|
]
|
|
805
839
|
}),
|
|
806
|
-
/*#__PURE__*/ jsxs(FormSection, {
|
|
840
|
+
showAdvancedReplication && /*#__PURE__*/ jsxs(FormSection, {
|
|
807
841
|
title: {
|
|
808
842
|
name: 'Additional Options'
|
|
809
843
|
},
|
|
@@ -837,6 +871,7 @@ function BucketReplicationFormPage() {
|
|
|
837
871
|
})
|
|
838
872
|
}),
|
|
839
873
|
enforceRTC && /*#__PURE__*/ jsx(Text, {
|
|
874
|
+
variant: "Small",
|
|
840
875
|
color: "textSecondary",
|
|
841
876
|
children: "Metrics must be enabled when RTC is enabled"
|
|
842
877
|
})
|
|
@@ -872,6 +907,7 @@ function BucketReplicationFormPage() {
|
|
|
872
907
|
})
|
|
873
908
|
}),
|
|
874
909
|
('tags' === filterType || 'and' === filterType) && /*#__PURE__*/ jsx(Text, {
|
|
910
|
+
variant: "Small",
|
|
875
911
|
color: "textSecondary",
|
|
876
912
|
children: "Delete marker replication is not supported for tag-based filters"
|
|
877
913
|
})
|
|
@@ -884,4 +920,4 @@ function BucketReplicationFormPage() {
|
|
|
884
920
|
})
|
|
885
921
|
});
|
|
886
922
|
}
|
|
887
|
-
export { BucketReplicationFormPage };
|
|
923
|
+
export { BucketReplicationFormPage, DefaultReplicationDestinationFields };
|
|
@@ -11,7 +11,7 @@ function BucketVersioning({ tooltipOverlay }) {
|
|
|
11
11
|
const { data: objectLockData, status: objectLockStatus } = useGetBucketObjectLockConfiguration({
|
|
12
12
|
Bucket: bucketName
|
|
13
13
|
});
|
|
14
|
-
const {
|
|
14
|
+
const { isISVManaged, isvApplication } = useISVBucketStatus(bucketName);
|
|
15
15
|
const { mutate: changeBucketVersioning } = useSetBucketVersioning();
|
|
16
16
|
const { showToast } = useToast();
|
|
17
17
|
const isObjectLockEnabled = objectLockData?.ObjectLockConfiguration?.ObjectLockEnabled === 'Enabled';
|
|
@@ -24,11 +24,13 @@ function BucketVersioning({ tooltipOverlay }) {
|
|
|
24
24
|
}
|
|
25
25
|
}, {
|
|
26
26
|
onSuccess: ()=>{
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
setTimeout(()=>{
|
|
28
|
+
showToast({
|
|
29
|
+
open: true,
|
|
30
|
+
message: isVersioning ? 'Bucket versioning enabled' : 'Bucket versioning disabled',
|
|
31
|
+
status: 'success'
|
|
32
|
+
});
|
|
33
|
+
}, 500);
|
|
32
34
|
},
|
|
33
35
|
onError: (error)=>{
|
|
34
36
|
showToast({
|
|
@@ -48,13 +50,17 @@ function BucketVersioning({ tooltipOverlay }) {
|
|
|
48
50
|
"Enabled",
|
|
49
51
|
/*#__PURE__*/ jsx("br", {}),
|
|
50
52
|
/*#__PURE__*/ jsx(SmallerText, {
|
|
51
|
-
children: "Versioning cannot be
|
|
53
|
+
children: "Versioning cannot be disabled because Object-lock is enabled for this bucket."
|
|
52
54
|
})
|
|
53
55
|
]
|
|
54
56
|
});
|
|
55
57
|
return /*#__PURE__*/ jsx(Tooltip, {
|
|
56
|
-
overlay: tooltipOverlay ? tooltipOverlay :
|
|
57
|
-
children:
|
|
58
|
+
overlay: tooltipOverlay ? tooltipOverlay : isISVManaged ? /*#__PURE__*/ jsxs(Fragment, {
|
|
59
|
+
children: [
|
|
60
|
+
"Enabling versioning is not possible due to the bucket being managed by ",
|
|
61
|
+
isvApplication,
|
|
62
|
+
"."
|
|
63
|
+
]
|
|
58
64
|
}) : 'error' === versioningStatus ? /*#__PURE__*/ jsx(Fragment, {
|
|
59
65
|
children: versioningError?.message
|
|
60
66
|
}) : null,
|
|
@@ -63,7 +69,7 @@ function BucketVersioning({ tooltipOverlay }) {
|
|
|
63
69
|
},
|
|
64
70
|
children: /*#__PURE__*/ jsx(Toggle, {
|
|
65
71
|
id: "versioningToggle",
|
|
66
|
-
disabled: 'pending' === versioningStatus || 'pending' === objectLockStatus || 'error' === versioningStatus ||
|
|
72
|
+
disabled: 'pending' === versioningStatus || 'pending' === objectLockStatus || 'error' === versioningStatus || isISVManaged,
|
|
67
73
|
toggle: isVersioningEnabled,
|
|
68
74
|
label: isVersioningEnabled ? 'Active' : 'Inactive',
|
|
69
75
|
onChange: ()=>{
|