@scality/data-browser-library 1.0.0-preview.8 → 1.0.0-preview.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__/BucketCreate.test.d.ts +1 -0
- package/dist/components/__tests__/BucketCreate.test.js +408 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +1 -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 +190 -0
- package/dist/components/__tests__/BucketOverview.test.js +298 -8
- package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +1 -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__/DeleteBucketConfigRuleButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +196 -0
- package/dist/components/__tests__/EmptyBucketButton.test.d.ts +1 -0
- package/dist/components/__tests__/EmptyBucketButton.test.js +302 -0
- package/dist/components/buckets/BucketCreate.d.ts +49 -0
- package/dist/components/buckets/BucketCreate.js +237 -0
- package/dist/components/buckets/BucketDetails.js +62 -10
- package/dist/components/buckets/BucketLifecycleFormPage.d.ts +15 -0
- package/dist/components/buckets/BucketLifecycleFormPage.js +1070 -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 +5 -2
- package/dist/components/buckets/BucketList.js +38 -28
- package/dist/components/buckets/BucketOverview.d.ts +65 -4
- package/dist/components/buckets/BucketOverview.js +261 -179
- package/dist/components/buckets/BucketPage.js +1 -1
- package/dist/components/buckets/BucketReplicationFormPage.d.ts +1 -0
- package/dist/components/buckets/BucketReplicationFormPage.js +834 -0
- package/dist/components/buckets/BucketReplicationList.d.ts +11 -0
- package/dist/components/buckets/BucketReplicationList.js +189 -0
- 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/index.d.ts +8 -1
- package/dist/components/index.js +9 -2
- 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 +158 -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/ui/ArrayFieldActions.d.ts +36 -0
- package/dist/components/ui/ArrayFieldActions.js +38 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +16 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.js +43 -0
- package/dist/components/ui/FilterFormSection.d.ts +44 -0
- package/dist/components/ui/FilterFormSection.js +159 -0
- package/dist/config/factory.d.ts +13 -2
- package/dist/config/factory.js +9 -6
- package/dist/hooks/__tests__/useISVBucketDetection.test.d.ts +1 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.js +188 -0
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +44 -1
- package/dist/hooks/factories/useCreateS3QueryHook.js +22 -1
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.js +5 -1
- 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/useISVBucketDetection.d.ts +15 -0
- package/dist/hooks/useISVBucketDetection.js +27 -0
- package/dist/hooks/useTableRowSelection.d.ts +9 -0
- package/dist/hooks/useTableRowSelection.js +45 -0
- package/dist/test/testUtils.d.ts +99 -17
- package/dist/test/testUtils.js +64 -16
- package/dist/test/utils/errorHandling.test.js +39 -1
- package/dist/utils/constants.d.ts +12 -0
- package/dist/utils/constants.js +9 -0
- package/dist/utils/errorHandling.d.ts +9 -0
- package/dist/utils/errorHandling.js +6 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +2 -0
- package/dist/utils/s3RuleUtils.d.ts +53 -0
- package/dist/utils/s3RuleUtils.js +101 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export declare const AWS_RULE_LIMITS: {
|
|
2
|
+
RULE_ID_MAX_LENGTH: number;
|
|
3
|
+
TAG_KEY_MAX_LENGTH: number;
|
|
4
|
+
TAG_VALUE_MAX_LENGTH: number;
|
|
5
|
+
};
|
|
6
|
+
export declare const STATUS_OPTIONS: readonly [{
|
|
7
|
+
readonly value: "Enabled";
|
|
8
|
+
readonly label: "Enabled";
|
|
9
|
+
}, {
|
|
10
|
+
readonly value: "Disabled";
|
|
11
|
+
readonly label: "Disabled";
|
|
12
|
+
}];
|
|
13
|
+
export type FilterType = "none" | "prefix" | "tags" | "and";
|
|
14
|
+
/**
|
|
15
|
+
* Filter data for S3 rules. All fields are present for form handling,
|
|
16
|
+
* but only certain fields are used based on filterType.
|
|
17
|
+
*/
|
|
18
|
+
export interface FilterData {
|
|
19
|
+
filterType: FilterType;
|
|
20
|
+
prefix: string;
|
|
21
|
+
tags: Array<{
|
|
22
|
+
key: string;
|
|
23
|
+
value: string;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Type-safe filter specification for S3 rule building.
|
|
28
|
+
* Each variant only includes the fields relevant to that filter type.
|
|
29
|
+
*/
|
|
30
|
+
export type FilterSpec = {
|
|
31
|
+
type: "none";
|
|
32
|
+
} | {
|
|
33
|
+
type: "prefix";
|
|
34
|
+
prefix: string;
|
|
35
|
+
} | {
|
|
36
|
+
type: "tags";
|
|
37
|
+
tags: Array<{
|
|
38
|
+
key: string;
|
|
39
|
+
value: string;
|
|
40
|
+
}>;
|
|
41
|
+
} | {
|
|
42
|
+
type: "and";
|
|
43
|
+
prefix: string;
|
|
44
|
+
tags: Array<{
|
|
45
|
+
key: string;
|
|
46
|
+
value: string;
|
|
47
|
+
}>;
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* Converts form FilterData to type-safe FilterSpec.
|
|
51
|
+
*/
|
|
52
|
+
export declare function toFilterSpec(data: FilterData): FilterSpec;
|
|
53
|
+
export declare function buildS3Filter(data: FilterData): Record<string, unknown>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
const AWS_RULE_LIMITS = {
|
|
2
|
+
RULE_ID_MAX_LENGTH: 255,
|
|
3
|
+
TAG_KEY_MAX_LENGTH: 128,
|
|
4
|
+
TAG_VALUE_MAX_LENGTH: 256
|
|
5
|
+
};
|
|
6
|
+
const STATUS_OPTIONS = [
|
|
7
|
+
{
|
|
8
|
+
value: "Enabled",
|
|
9
|
+
label: "Enabled"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
value: "Disabled",
|
|
13
|
+
label: "Disabled"
|
|
14
|
+
}
|
|
15
|
+
];
|
|
16
|
+
function toFilterSpec(data) {
|
|
17
|
+
switch(data.filterType){
|
|
18
|
+
case "none":
|
|
19
|
+
return {
|
|
20
|
+
type: "none"
|
|
21
|
+
};
|
|
22
|
+
case "prefix":
|
|
23
|
+
return {
|
|
24
|
+
type: "prefix",
|
|
25
|
+
prefix: data.prefix
|
|
26
|
+
};
|
|
27
|
+
case "tags":
|
|
28
|
+
return {
|
|
29
|
+
type: "tags",
|
|
30
|
+
tags: data.tags
|
|
31
|
+
};
|
|
32
|
+
case "and":
|
|
33
|
+
return {
|
|
34
|
+
type: "and",
|
|
35
|
+
prefix: data.prefix,
|
|
36
|
+
tags: data.tags
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function buildS3Filter(data) {
|
|
41
|
+
const spec = toFilterSpec(data);
|
|
42
|
+
switch(spec.type){
|
|
43
|
+
case "none":
|
|
44
|
+
return {};
|
|
45
|
+
case "prefix":
|
|
46
|
+
return {
|
|
47
|
+
Prefix: spec.prefix
|
|
48
|
+
};
|
|
49
|
+
case "tags":
|
|
50
|
+
if (0 === spec.tags.length) return {};
|
|
51
|
+
if (1 === spec.tags.length) return {
|
|
52
|
+
Tag: {
|
|
53
|
+
Key: spec.tags[0].key,
|
|
54
|
+
Value: spec.tags[0].value
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
And: {
|
|
59
|
+
Tags: spec.tags.map((tag)=>({
|
|
60
|
+
Key: tag.key,
|
|
61
|
+
Value: tag.value
|
|
62
|
+
}))
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
case "and":
|
|
66
|
+
{
|
|
67
|
+
const hasPrefix = spec.prefix && "" !== spec.prefix.trim();
|
|
68
|
+
const hasTags = spec.tags.length > 0;
|
|
69
|
+
if (!hasTags && !hasPrefix) return {};
|
|
70
|
+
if (!hasTags && hasPrefix) return {
|
|
71
|
+
Prefix: spec.prefix
|
|
72
|
+
};
|
|
73
|
+
if (hasTags && !hasPrefix) {
|
|
74
|
+
if (1 === spec.tags.length) return {
|
|
75
|
+
Tag: {
|
|
76
|
+
Key: spec.tags[0].key,
|
|
77
|
+
Value: spec.tags[0].value
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
And: {
|
|
82
|
+
Tags: spec.tags.map((tag)=>({
|
|
83
|
+
Key: tag.key,
|
|
84
|
+
Value: tag.value
|
|
85
|
+
}))
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
And: {
|
|
91
|
+
Prefix: spec.prefix,
|
|
92
|
+
Tags: spec.tags.map((tag)=>({
|
|
93
|
+
Key: tag.key,
|
|
94
|
+
Value: tag.value
|
|
95
|
+
}))
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export { AWS_RULE_LIMITS, STATUS_OPTIONS, buildS3Filter, toFilterSpec };
|
package/package.json
CHANGED