@scality/data-browser-library 1.0.7 → 1.0.9
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 +18 -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.js +39 -29
- 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/objects/ObjectList.js +22 -25
- package/dist/components/objects/ObjectLock/EditRetentionButton.js +2 -2
- package/dist/components/objects/UploadButton.js +25 -15
- package/dist/config/__tests__/resolveBrandingTheme.test.d.ts +1 -0
- package/dist/config/__tests__/resolveBrandingTheme.test.js +96 -0
- package/dist/config/resolveBrandingTheme.d.ts +16 -0
- package/dist/config/resolveBrandingTheme.js +23 -0
- package/dist/config/types.d.ts +36 -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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- 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
|
@@ -3,14 +3,13 @@ import { ConstrainedText, Icon, Loader, Stack, spacing } from "@scality/core-ui"
|
|
|
3
3
|
import { Box, Button } from "@scality/core-ui/dist/next";
|
|
4
4
|
import { createContext, memo, useContext, useMemo } from "react";
|
|
5
5
|
import { useDataBrowserUICustomization } from "../../contexts/DataBrowserUICustomizationContext.js";
|
|
6
|
-
import { useGetBucketAcl, useGetBucketCors, useGetBucketObjectLockConfiguration, useGetBucketPolicy, useGetBucketVersioning } from "../../hooks/index.js";
|
|
6
|
+
import { useGetBucketAcl, useGetBucketCors, useGetBucketObjectLockConfiguration, useGetBucketPolicy, useGetBucketVersioning, useISVBucketStatus } from "../../hooks/index.js";
|
|
7
7
|
import { isNotFoundError } from "../../utils/errorHandling.js";
|
|
8
8
|
import { EditRetentionButton } from "../objects/ObjectLock/EditRetentionButton.js";
|
|
9
9
|
import { useDataBrowserConfig } from "../providers/DataBrowserProvider.js";
|
|
10
10
|
import { Body, Group, GroupContent, GroupName, GroupValues, Key, Row, Table, TableContainer, Value } from "../ui/Table.elements.js";
|
|
11
11
|
import { BucketConfigEditButton } from "./BucketConfigEditButton.js";
|
|
12
12
|
import { BucketLocation } from "./BucketLocation.js";
|
|
13
|
-
const ERROR_NO_SUCH_BUCKET_POLICY = 'NoSuchBucketPolicy';
|
|
14
13
|
const DEFAULT_PUBLIC_ACL_URI = 'http://acs.amazonaws.com/groups/global/AllUsers';
|
|
15
14
|
const STATUS_PENDING = 'pending';
|
|
16
15
|
const STATUS_ERROR = 'error';
|
|
@@ -155,12 +154,10 @@ const createAclField = (bucketName, aclData, aclStatus, aclField, renderAcl)=>{
|
|
|
155
154
|
})
|
|
156
155
|
};
|
|
157
156
|
};
|
|
158
|
-
const createCorsField = (bucketName, corsData, corsStatus, corsError, onEditCors, corsField, renderCors)=>{
|
|
157
|
+
const createCorsField = (bucketName, corsData, corsStatus, corsError, onEditCors, corsField, renderCors, isISVManaged, isvApplication)=>{
|
|
159
158
|
let defaultValue;
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
else {
|
|
163
|
-
const hasCors = !!(corsData?.CORSRules && corsData.CORSRules.length > 0);
|
|
159
|
+
if (corsStatus !== STATUS_ERROR || isNotFoundError(corsError)) {
|
|
160
|
+
const hasCors = !isNotFoundError(corsError) && !!(corsData?.CORSRules && corsData.CORSRules.length > 0);
|
|
164
161
|
const handleEditCors = ()=>onEditCors?.(bucketName);
|
|
165
162
|
defaultValue = /*#__PURE__*/ jsxs(Box, {
|
|
166
163
|
display: "flex",
|
|
@@ -175,11 +172,13 @@ const createCorsField = (bucketName, corsData, corsStatus, corsError, onEditCors
|
|
|
175
172
|
hasConfig: hasCors,
|
|
176
173
|
isLoading: corsStatus === STATUS_PENDING,
|
|
177
174
|
onEdit: handleEditCors,
|
|
178
|
-
configName: "bucket CORS"
|
|
175
|
+
configName: "bucket CORS",
|
|
176
|
+
disabled: isISVManaged,
|
|
177
|
+
tooltipOverlay: isISVManaged ? `Edition is disabled as it is managed by ${isvApplication}.` : void 0
|
|
179
178
|
})
|
|
180
179
|
]
|
|
181
180
|
});
|
|
182
|
-
}
|
|
181
|
+
} else defaultValue = /*#__PURE__*/ jsx(ErrorField, {});
|
|
183
182
|
return {
|
|
184
183
|
id: 'cors',
|
|
185
184
|
label: 'CORS',
|
|
@@ -202,11 +201,10 @@ const createPublicField = (bucketName, aclStatus, isPublic, publicField, renderP
|
|
|
202
201
|
})
|
|
203
202
|
};
|
|
204
203
|
};
|
|
205
|
-
const createBucketPolicyField = (bucketName, policyData, policyStatus, policyError, onEditPolicy, bucketPolicyField, renderBucketPolicy)=>{
|
|
204
|
+
const createBucketPolicyField = (bucketName, policyData, policyStatus, policyError, onEditPolicy, bucketPolicyField, renderBucketPolicy, isISVManaged, isvApplication)=>{
|
|
206
205
|
let defaultValue;
|
|
207
|
-
if (policyStatus
|
|
208
|
-
|
|
209
|
-
const hasPolicy = !!policyData?.Policy;
|
|
206
|
+
if (policyStatus !== STATUS_ERROR || isNotFoundError(policyError)) {
|
|
207
|
+
const hasPolicy = !isNotFoundError(policyError) && !!policyData?.Policy;
|
|
210
208
|
const handleEditPolicy = ()=>onEditPolicy?.(bucketName);
|
|
211
209
|
defaultValue = /*#__PURE__*/ jsxs(Box, {
|
|
212
210
|
display: "flex",
|
|
@@ -221,11 +219,13 @@ const createBucketPolicyField = (bucketName, policyData, policyStatus, policyErr
|
|
|
221
219
|
hasConfig: hasPolicy,
|
|
222
220
|
isLoading: policyStatus === STATUS_PENDING,
|
|
223
221
|
onEdit: handleEditPolicy,
|
|
224
|
-
configName: "bucket policy"
|
|
222
|
+
configName: "bucket policy",
|
|
223
|
+
disabled: isISVManaged,
|
|
224
|
+
tooltipOverlay: isISVManaged ? `Edition is disabled as it is managed by ${isvApplication}.` : void 0
|
|
225
225
|
})
|
|
226
226
|
]
|
|
227
227
|
});
|
|
228
|
-
}
|
|
228
|
+
} else defaultValue = /*#__PURE__*/ jsx(ErrorField, {});
|
|
229
229
|
return {
|
|
230
230
|
id: 'bucketPolicy',
|
|
231
231
|
label: 'Bucket Policy',
|
|
@@ -424,6 +424,7 @@ const PermissionsSection = /*#__PURE__*/ memo(({ onEditPolicy, onEditCors, owner
|
|
|
424
424
|
const { bucketName } = useBucketOverviewContext();
|
|
425
425
|
const { extraBucketOverviewPermissions } = useDataBrowserUICustomization();
|
|
426
426
|
const config = useDataBrowserConfig();
|
|
427
|
+
const { isISVManaged, isvApplication } = useISVBucketStatus(bucketName);
|
|
427
428
|
const { data: aclData, status: aclStatus } = useGetBucketAcl({
|
|
428
429
|
Bucket: bucketName
|
|
429
430
|
});
|
|
@@ -441,9 +442,9 @@ const PermissionsSection = /*#__PURE__*/ memo(({ onEditPolicy, onEditCors, owner
|
|
|
441
442
|
const defaultFields = {
|
|
442
443
|
owner: createOwnerField(bucketName, aclData, aclStatus, ownerField, renderOwner),
|
|
443
444
|
acl: createAclField(bucketName, aclData, aclStatus, aclField, renderAcl),
|
|
444
|
-
cors: createCorsField(bucketName, corsData, corsStatus, corsError, onEditCors, corsField, renderCors),
|
|
445
|
+
cors: createCorsField(bucketName, corsData, corsStatus, corsError, onEditCors, corsField, renderCors, isISVManaged, isvApplication),
|
|
445
446
|
public: createPublicField(bucketName, aclStatus, isPublic, publicField, renderPublic),
|
|
446
|
-
bucketPolicy: createBucketPolicyField(bucketName, policyData, policyStatus, policyError, onEditPolicy, bucketPolicyField, renderBucketPolicy)
|
|
447
|
+
bucketPolicy: createBucketPolicyField(bucketName, policyData, policyStatus, policyError, onEditPolicy, bucketPolicyField, renderBucketPolicy, isISVManaged, isvApplication)
|
|
447
448
|
};
|
|
448
449
|
return mergeFieldsWithExtras(defaultFields, extraBucketOverviewPermissions, bucketName, [
|
|
449
450
|
'owner',
|
|
@@ -475,7 +476,9 @@ const PermissionsSection = /*#__PURE__*/ memo(({ onEditPolicy, onEditCors, owner
|
|
|
475
476
|
policyData,
|
|
476
477
|
policyError,
|
|
477
478
|
policyStatus,
|
|
478
|
-
isPublic
|
|
479
|
+
isPublic,
|
|
480
|
+
isISVManaged,
|
|
481
|
+
isvApplication
|
|
479
482
|
]);
|
|
480
483
|
return /*#__PURE__*/ jsx(Section, {
|
|
481
484
|
title: "Permissions",
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { Box, Button, CopyButton } from "@scality/core-ui/dist/next";
|
|
4
|
-
import { useCallback, useMemo } from "react";
|
|
2
|
+
import { Form, FormGroup, FormSection, Icon, Loader, Stack, Text, useToast } from "@scality/core-ui";
|
|
3
|
+
import { Box, Button, CopyButton, Editor } from "@scality/core-ui/dist/next";
|
|
4
|
+
import { useCallback, useEffect, useMemo } from "react";
|
|
5
5
|
import { Controller } from "react-hook-form";
|
|
6
6
|
import { useParams } from "react-router";
|
|
7
|
-
import { useBucketConfigEditor, useGetBucketPolicy, useISVBucketStatus, useSetBucketPolicy } from "../../hooks/index.js";
|
|
7
|
+
import { useBucketConfigEditor, useDeleteBucketPolicy, useGetBucketPolicy, useISVBucketStatus, useSetBucketPolicy } from "../../hooks/index.js";
|
|
8
|
+
import { useDataBrowserNavigate } from "../../hooks/useDataBrowserNavigate.js";
|
|
8
9
|
import bucketPolicySchema from "../../schemas/bucketPolicySchema.json";
|
|
9
|
-
import {
|
|
10
|
+
import { isNotFoundError } from "../../utils/errorHandling.js";
|
|
10
11
|
const getDefaultPolicyTemplate = (bucketName)=>`{
|
|
11
12
|
"Version": "2012-10-17",
|
|
12
13
|
"Statement": [
|
|
@@ -20,8 +21,12 @@ const getDefaultPolicyTemplate = (bucketName)=>`{
|
|
|
20
21
|
]
|
|
21
22
|
}`;
|
|
22
23
|
const validatePolicyConfig = (content)=>{
|
|
24
|
+
const trimmed = content.trim();
|
|
25
|
+
if ('' === trimmed) return {
|
|
26
|
+
isValid: true
|
|
27
|
+
};
|
|
23
28
|
try {
|
|
24
|
-
JSON.parse(
|
|
29
|
+
JSON.parse(trimmed);
|
|
25
30
|
return {
|
|
26
31
|
isValid: true
|
|
27
32
|
};
|
|
@@ -35,33 +40,65 @@ const validatePolicyConfig = (content)=>{
|
|
|
35
40
|
const BucketPolicyPage = ()=>{
|
|
36
41
|
const { bucketName } = useParams();
|
|
37
42
|
const { showToast } = useToast();
|
|
38
|
-
const { isISVManaged,
|
|
43
|
+
const { isISVManaged, isLoading: isISVLoading } = useISVBucketStatus(bucketName);
|
|
44
|
+
const navigate = useDataBrowserNavigate();
|
|
45
|
+
useEffect(()=>{
|
|
46
|
+
if (isISVManaged) navigate(`/buckets/${bucketName}`, {
|
|
47
|
+
replace: true
|
|
48
|
+
});
|
|
49
|
+
}, [
|
|
50
|
+
isISVManaged,
|
|
51
|
+
bucketName,
|
|
52
|
+
navigate
|
|
53
|
+
]);
|
|
54
|
+
const shouldFetchData = !isISVManaged && !isISVLoading;
|
|
39
55
|
const { data: policyData, status: policyStatus, error: policyError } = useGetBucketPolicy({
|
|
40
56
|
Bucket: bucketName
|
|
57
|
+
}, {
|
|
58
|
+
enabled: shouldFetchData
|
|
41
59
|
});
|
|
42
60
|
const initialContent = useMemo(()=>{
|
|
61
|
+
if (isNotFoundError(policyError)) return;
|
|
43
62
|
if (policyData?.Policy) return policyData.Policy;
|
|
44
63
|
}, [
|
|
45
|
-
policyData
|
|
64
|
+
policyData,
|
|
65
|
+
policyError
|
|
46
66
|
]);
|
|
47
|
-
const { form, content, isCreateMode, isValidFormat,
|
|
67
|
+
const { form, content, isCreateMode, isValidFormat, jsonSchema, navigateToBucket, loadTemplate } = useBucketConfigEditor({
|
|
48
68
|
bucketName: bucketName,
|
|
49
69
|
initialContent,
|
|
50
70
|
defaultTemplate: getDefaultPolicyTemplate(bucketName),
|
|
51
71
|
isLoading: 'pending' === policyStatus,
|
|
52
|
-
notFoundErrorNames: [
|
|
53
|
-
'NoSuchBucketPolicy'
|
|
54
|
-
],
|
|
55
72
|
errorInstance: policyError,
|
|
56
73
|
validate: validatePolicyConfig,
|
|
57
|
-
|
|
74
|
+
jsonSchema: bucketPolicySchema
|
|
58
75
|
});
|
|
59
76
|
const { control, handleSubmit, setError, clearErrors, formState: { isDirty, errors } } = form;
|
|
60
77
|
const { mutate: savePolicy, isPending: isSaving } = useSetBucketPolicy();
|
|
78
|
+
const { mutate: deletePolicy, isPending: isDeleting } = useDeleteBucketPolicy();
|
|
61
79
|
const onSubmit = useCallback((data)=>{
|
|
62
80
|
const result = validatePolicyConfig(data.content);
|
|
63
81
|
if (!result.isValid) return;
|
|
64
|
-
const
|
|
82
|
+
const trimmed = data.content.trim();
|
|
83
|
+
if ('' === trimmed) return void deletePolicy({
|
|
84
|
+
Bucket: bucketName
|
|
85
|
+
}, {
|
|
86
|
+
onSuccess: ()=>{
|
|
87
|
+
showToast({
|
|
88
|
+
open: true,
|
|
89
|
+
message: 'Bucket policy deleted',
|
|
90
|
+
status: 'success'
|
|
91
|
+
});
|
|
92
|
+
navigateToBucket();
|
|
93
|
+
},
|
|
94
|
+
onError: (error)=>{
|
|
95
|
+
setError('content', {
|
|
96
|
+
type: 'server',
|
|
97
|
+
message: error instanceof Error ? error.message : 'Failed to delete'
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
const minifiedPolicy = JSON.stringify(JSON.parse(trimmed));
|
|
65
102
|
savePolicy({
|
|
66
103
|
Bucket: bucketName,
|
|
67
104
|
Policy: minifiedPolicy
|
|
@@ -84,12 +121,14 @@ const BucketPolicyPage = ()=>{
|
|
|
84
121
|
}, [
|
|
85
122
|
bucketName,
|
|
86
123
|
savePolicy,
|
|
124
|
+
deletePolicy,
|
|
87
125
|
navigateToBucket,
|
|
88
126
|
showToast,
|
|
89
127
|
setError
|
|
90
128
|
]);
|
|
91
|
-
|
|
92
|
-
|
|
129
|
+
if (isISVManaged || isISVLoading) return null;
|
|
130
|
+
const hasUnexpectedError = policyError && !isNotFoundError(policyError);
|
|
131
|
+
if ('pending' === policyStatus) return /*#__PURE__*/ jsx(Loader, {
|
|
93
132
|
centered: true,
|
|
94
133
|
size: "massive",
|
|
95
134
|
children: /*#__PURE__*/ jsx(Fragment, {
|
|
@@ -139,7 +178,7 @@ const BucketPolicyPage = ()=>{
|
|
|
139
178
|
label: "Cancel",
|
|
140
179
|
onClick: navigateToBucket,
|
|
141
180
|
type: "button",
|
|
142
|
-
disabled: isSaving
|
|
181
|
+
disabled: isSaving || isDeleting
|
|
143
182
|
}),
|
|
144
183
|
/*#__PURE__*/ jsx(Button, {
|
|
145
184
|
variant: "primary",
|
|
@@ -148,83 +187,80 @@ const BucketPolicyPage = ()=>{
|
|
|
148
187
|
name: "Save"
|
|
149
188
|
}),
|
|
150
189
|
type: "submit",
|
|
151
|
-
disabled: !isDirty && !isCreateMode || isSaving || !isValidFormat
|
|
190
|
+
disabled: !isDirty && !isCreateMode || isSaving || isDeleting || !isValidFormat
|
|
152
191
|
})
|
|
153
192
|
]
|
|
154
193
|
}),
|
|
155
|
-
children: /*#__PURE__*/ jsxs(
|
|
194
|
+
children: /*#__PURE__*/ jsxs(FormSection, {
|
|
156
195
|
children: [
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
children: [
|
|
165
|
-
/*#__PURE__*/ jsx("strong", {
|
|
166
|
-
children: "Warning:"
|
|
167
|
-
}),
|
|
168
|
-
" This bucket is managed by ",
|
|
169
|
-
isvApplication,
|
|
170
|
-
". Adding a Bucket Policy may conflict with IAM policies created by ",
|
|
171
|
-
isvApplication,
|
|
172
|
-
", potentially disrupting ",
|
|
173
|
-
isvApplication,
|
|
174
|
-
" operations (e.g., backup cleanup). Ensure your Bucket Policy does not deny actions that ",
|
|
175
|
-
isvApplication,
|
|
176
|
-
" requires."
|
|
177
|
-
]
|
|
196
|
+
/*#__PURE__*/ jsx(FormGroup, {
|
|
197
|
+
id: "bucketName",
|
|
198
|
+
label: "Bucket Name",
|
|
199
|
+
required: true,
|
|
200
|
+
direction: "horizontal",
|
|
201
|
+
content: /*#__PURE__*/ jsx(Text, {
|
|
202
|
+
children: bucketName
|
|
178
203
|
})
|
|
179
204
|
}),
|
|
180
|
-
/*#__PURE__*/
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
205
|
+
/*#__PURE__*/ jsx(FormGroup, {
|
|
206
|
+
id: "policyDocument",
|
|
207
|
+
label: "Policy Document",
|
|
208
|
+
required: true,
|
|
209
|
+
direction: "vertical",
|
|
210
|
+
help: "AWS Bucket policy standards are supported.",
|
|
211
|
+
helpErrorPosition: "bottom",
|
|
212
|
+
error: errors.content?.message,
|
|
213
|
+
content: /*#__PURE__*/ jsxs(Stack, {
|
|
214
|
+
direction: "horizontal",
|
|
215
|
+
gap: "r16",
|
|
216
|
+
style: {
|
|
217
|
+
alignItems: 'flex-start'
|
|
218
|
+
},
|
|
219
|
+
children: [
|
|
220
|
+
/*#__PURE__*/ jsx(Controller, {
|
|
221
|
+
control: control,
|
|
222
|
+
name: "content",
|
|
223
|
+
render: ({ field: { onChange, value } })=>/*#__PURE__*/ jsx(Editor, {
|
|
224
|
+
value: value,
|
|
225
|
+
onChange: (newValue)=>{
|
|
226
|
+
onChange(newValue);
|
|
227
|
+
if (errors.content) clearErrors('content');
|
|
228
|
+
},
|
|
229
|
+
language: jsonSchema ? {
|
|
230
|
+
name: 'json',
|
|
231
|
+
schema: jsonSchema
|
|
232
|
+
} : 'json',
|
|
233
|
+
height: "60vh",
|
|
234
|
+
width: "32rem"
|
|
235
|
+
})
|
|
236
|
+
}),
|
|
237
|
+
/*#__PURE__*/ jsxs(Stack, {
|
|
238
|
+
direction: "vertical",
|
|
239
|
+
gap: "r8",
|
|
200
240
|
children: [
|
|
201
|
-
/*#__PURE__*/ jsx(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
value: value,
|
|
206
|
-
onChange: (newValue)=>{
|
|
207
|
-
onChange(newValue);
|
|
208
|
-
if (errors.content) clearErrors('content');
|
|
209
|
-
},
|
|
210
|
-
language: "json",
|
|
211
|
-
height: "60vh",
|
|
212
|
-
width: "33rem",
|
|
213
|
-
beforeMount: handleBeforeMount
|
|
214
|
-
})
|
|
241
|
+
/*#__PURE__*/ jsx(CopyButton, {
|
|
242
|
+
textToCopy: content,
|
|
243
|
+
label: "Policy",
|
|
244
|
+
variant: "outline"
|
|
215
245
|
}),
|
|
216
|
-
/*#__PURE__*/ jsx(
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
246
|
+
isCreateMode && !content && /*#__PURE__*/ jsx(Text, {
|
|
247
|
+
variant: "Smaller",
|
|
248
|
+
color: "textSecondary",
|
|
249
|
+
children: "Empty bucket policy"
|
|
250
|
+
}),
|
|
251
|
+
isCreateMode && !content && /*#__PURE__*/ jsx(Button, {
|
|
252
|
+
variant: "outline",
|
|
253
|
+
label: "Load a template",
|
|
254
|
+
onClick: loadTemplate,
|
|
255
|
+
type: "button",
|
|
256
|
+
style: {
|
|
257
|
+
minWidth: '10rem'
|
|
258
|
+
}
|
|
223
259
|
})
|
|
224
260
|
]
|
|
225
261
|
})
|
|
226
|
-
|
|
227
|
-
|
|
262
|
+
]
|
|
263
|
+
})
|
|
228
264
|
})
|
|
229
265
|
]
|
|
230
266
|
})
|
|
@@ -603,14 +603,10 @@ function BucketReplicationFormPage() {
|
|
|
603
603
|
content: /*#__PURE__*/ jsx(Controller, {
|
|
604
604
|
name: "status",
|
|
605
605
|
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))
|
|
606
|
+
render: ({ field })=>/*#__PURE__*/ jsx(Toggle, {
|
|
607
|
+
toggle: 'Enabled' === field.value,
|
|
608
|
+
onChange: (e)=>field.onChange(e.target.checked ? 'Enabled' : 'Disabled'),
|
|
609
|
+
label: 'Enabled' === field.value ? 'Enabled' : 'Disabled'
|
|
614
610
|
})
|
|
615
611
|
})
|
|
616
612
|
}),
|
|
@@ -662,6 +658,7 @@ function BucketReplicationFormPage() {
|
|
|
662
658
|
label: "Destination",
|
|
663
659
|
id: "sameAccount",
|
|
664
660
|
direction: "horizontal",
|
|
661
|
+
labelHelpTooltip: "Toggle between same-account and cross-account replication destination",
|
|
665
662
|
content: /*#__PURE__*/ jsx(Controller, {
|
|
666
663
|
name: "sameAccount",
|
|
667
664
|
control: control,
|
|
@@ -672,17 +669,22 @@ function BucketReplicationFormPage() {
|
|
|
672
669
|
})
|
|
673
670
|
})
|
|
674
671
|
}),
|
|
675
|
-
sameAccount ? /*#__PURE__*/ jsx(Fragment, {}) : /*#__PURE__*/ jsx(
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
required: true,
|
|
682
|
-
content: /*#__PURE__*/ jsx(Input, {
|
|
672
|
+
sameAccount ? /*#__PURE__*/ jsx(Fragment, {}) : /*#__PURE__*/ jsx("div", {
|
|
673
|
+
style: {
|
|
674
|
+
paddingLeft: spacing.r24
|
|
675
|
+
},
|
|
676
|
+
children: /*#__PURE__*/ jsx(FormGroup, {
|
|
677
|
+
label: "Target account ID",
|
|
683
678
|
id: "targetAccountId",
|
|
684
|
-
|
|
685
|
-
|
|
679
|
+
direction: "horizontal",
|
|
680
|
+
error: errors?.targetAccountId?.message,
|
|
681
|
+
helpErrorPosition: "bottom",
|
|
682
|
+
required: true,
|
|
683
|
+
content: /*#__PURE__*/ jsx(Input, {
|
|
684
|
+
id: "targetAccountId",
|
|
685
|
+
placeholder: "Account ID",
|
|
686
|
+
...register('targetAccountId')
|
|
687
|
+
})
|
|
686
688
|
})
|
|
687
689
|
}),
|
|
688
690
|
/*#__PURE__*/ jsx(FormGroup, {
|
|
@@ -781,24 +783,30 @@ function BucketReplicationFormPage() {
|
|
|
781
783
|
})
|
|
782
784
|
}),
|
|
783
785
|
includeEncryptedObjects && /*#__PURE__*/ jsx(Text, {
|
|
786
|
+
variant: "Small",
|
|
784
787
|
color: "textSecondary",
|
|
785
788
|
children: "Encryption is required when replicating encrypted objects"
|
|
786
789
|
})
|
|
787
790
|
]
|
|
788
791
|
})
|
|
789
792
|
}),
|
|
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, {
|
|
793
|
+
encryptReplicatedObjects ? /*#__PURE__*/ jsx("div", {
|
|
794
|
+
style: {
|
|
795
|
+
paddingLeft: spacing.r24
|
|
796
|
+
},
|
|
797
|
+
children: /*#__PURE__*/ jsx(FormGroup, {
|
|
798
|
+
label: "Replica KMS Key ID",
|
|
799
799
|
id: "replicaKmsKeyId",
|
|
800
|
-
|
|
801
|
-
|
|
800
|
+
direction: "horizontal",
|
|
801
|
+
error: errors?.replicaKmsKeyId?.message,
|
|
802
|
+
helpErrorPosition: "bottom",
|
|
803
|
+
labelHelpTooltip: "KMS key ID or ARN to use for encrypting replicated objects",
|
|
804
|
+
required: true,
|
|
805
|
+
content: /*#__PURE__*/ jsx(Input, {
|
|
806
|
+
id: "replicaKmsKeyId",
|
|
807
|
+
placeholder: "KMS Key ID or ARN",
|
|
808
|
+
...register('replicaKmsKeyId')
|
|
809
|
+
})
|
|
802
810
|
})
|
|
803
811
|
}) : /*#__PURE__*/ jsx(Fragment, {})
|
|
804
812
|
]
|
|
@@ -837,6 +845,7 @@ function BucketReplicationFormPage() {
|
|
|
837
845
|
})
|
|
838
846
|
}),
|
|
839
847
|
enforceRTC && /*#__PURE__*/ jsx(Text, {
|
|
848
|
+
variant: "Small",
|
|
840
849
|
color: "textSecondary",
|
|
841
850
|
children: "Metrics must be enabled when RTC is enabled"
|
|
842
851
|
})
|
|
@@ -872,6 +881,7 @@ function BucketReplicationFormPage() {
|
|
|
872
881
|
})
|
|
873
882
|
}),
|
|
874
883
|
('tags' === filterType || 'and' === filterType) && /*#__PURE__*/ jsx(Text, {
|
|
884
|
+
variant: "Small",
|
|
875
885
|
color: "textSecondary",
|
|
876
886
|
children: "Delete marker replication is not supported for tag-based filters"
|
|
877
887
|
})
|
|
@@ -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: ()=>{
|