@scality/data-browser-library 1.0.0-preview.13 → 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 +15 -8
- package/dist/components/DataBrowserUI.js +79 -55
- 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.js +121 -122
- 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 +175 -176
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +84 -84
- package/dist/components/__tests__/BucketOverview.test.js +256 -200
- 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 +251 -250
- 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 +2 -2
- package/dist/components/buckets/BucketDetails.js +48 -36
- 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 +2 -2
- package/dist/components/buckets/BucketList.js +28 -27
- package/dist/components/buckets/BucketLocation.js +3 -3
- package/dist/components/buckets/BucketOverview.d.ts +1 -1
- package/dist/components/buckets/BucketOverview.js +62 -62
- package/dist/components/buckets/BucketPage.js +19 -11
- 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 +11 -11
- 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 +19 -19
- 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 -22
- package/dist/components/index.js +3 -2
- package/dist/components/layouts/ArrowNavigation.d.ts +1 -2
- package/dist/components/layouts/ArrowNavigation.js +3 -3
- 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 +9 -9
- 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 +39 -39
- 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.js +119 -119
- package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.js +211 -211
- package/dist/components/objects/ObjectDetails/index.d.ts +1 -1
- package/dist/components/objects/ObjectDetails/index.js +30 -30
- package/dist/components/objects/ObjectList.d.ts +5 -5
- package/dist/components/objects/ObjectList.js +112 -111
- 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 +5 -5
- 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 +20 -3
- package/dist/contexts/DataBrowserUICustomizationContext.d.ts +2 -2
- 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 +9 -15
- package/dist/test/testUtils.js +78 -92
- package/dist/test/utils/errorHandling.test.js +119 -119
- package/dist/types/index.d.ts +6 -31
- package/dist/utils/__tests__/s3ConfigIdentifier.test.d.ts +1 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.js +429 -0
- package/dist/utils/constants.js +8 -8
- 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/useSupportedNotificationEvents.d.ts +6 -0
- package/dist/utils/useSupportedNotificationEvents.js +7 -0
- package/package.json +2 -2
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { render, screen, waitFor } from "@testing-library/react";
|
|
3
|
-
import { MemoryRouter } from "react-router
|
|
3
|
+
import { MemoryRouter } from "react-router";
|
|
4
4
|
import { BucketDetails } from "../buckets/BucketDetails.js";
|
|
5
5
|
import { applyBucketMocks, createTestWrapper } from "../../test/testUtils.js";
|
|
6
6
|
import { useGetBucketAcl, useGetBucketCors, useGetBucketLifecycle, useGetBucketLocation, useGetBucketObjectLockConfiguration, useGetBucketPolicy, useGetBucketReplication, useGetBucketTagging, useGetBucketVersioning } from "../../hooks/index.js";
|
|
7
7
|
import { useISVBucketStatus } from "../../hooks/useISVBucketDetection.js";
|
|
8
8
|
import { useFeatures } from "../../utils/useFeatures.js";
|
|
9
9
|
import * as __WEBPACK_EXTERNAL_MODULE__contexts_DataBrowserUICustomizationContext_js_f267b01c__ from "../../contexts/DataBrowserUICustomizationContext.js";
|
|
10
|
-
jest.mock(
|
|
11
|
-
jest.mock(
|
|
12
|
-
jest.mock(
|
|
13
|
-
jest.mock("../../contexts/DataBrowserUICustomizationContext");
|
|
10
|
+
jest.mock('../../hooks');
|
|
11
|
+
jest.mock('../../hooks/useISVBucketDetection');
|
|
12
|
+
jest.mock('../../utils/useFeatures');
|
|
14
13
|
const mockUseParams = jest.fn();
|
|
15
14
|
const mockUseNavigate = jest.fn();
|
|
16
|
-
jest.mock(
|
|
17
|
-
...jest.requireActual(
|
|
15
|
+
jest.mock('react-router', ()=>({
|
|
16
|
+
...jest.requireActual('react-router'),
|
|
18
17
|
useParams: ()=>mockUseParams(),
|
|
19
18
|
useNavigate: ()=>mockUseNavigate()
|
|
20
19
|
}));
|
|
@@ -30,13 +29,13 @@ const mockUseGetBucketTagging = jest.mocked(useGetBucketTagging);
|
|
|
30
29
|
const mockUseISVBucketStatus = jest.mocked(useISVBucketStatus);
|
|
31
30
|
const mockUseFeatures = jest.mocked(useFeatures);
|
|
32
31
|
const mockUseDataBrowserUICustomization = (config = {})=>{
|
|
33
|
-
jest.spyOn(__WEBPACK_EXTERNAL_MODULE__contexts_DataBrowserUICustomizationContext_js_f267b01c__,
|
|
32
|
+
jest.spyOn(__WEBPACK_EXTERNAL_MODULE__contexts_DataBrowserUICustomizationContext_js_f267b01c__, 'useDataBrowserUICustomization').mockReturnValue(config);
|
|
34
33
|
};
|
|
35
34
|
const renderBucketDetails = ()=>{
|
|
36
35
|
const Wrapper = createTestWrapper();
|
|
37
36
|
return render(/*#__PURE__*/ jsx(MemoryRouter, {
|
|
38
37
|
initialEntries: [
|
|
39
|
-
|
|
38
|
+
'/buckets/test-bucket'
|
|
40
39
|
],
|
|
41
40
|
children: /*#__PURE__*/ jsx(Wrapper, {
|
|
42
41
|
children: /*#__PURE__*/ jsx(BucketDetails, {})
|
|
@@ -58,165 +57,165 @@ const mockHookDefaults = (overrides = {})=>{
|
|
|
58
57
|
useFeatures: mockUseFeatures
|
|
59
58
|
}, overrides);
|
|
60
59
|
};
|
|
61
|
-
describe(
|
|
60
|
+
describe('BucketDetails', ()=>{
|
|
62
61
|
beforeEach(()=>{
|
|
63
62
|
jest.clearAllMocks();
|
|
64
63
|
mockHookDefaults();
|
|
65
64
|
mockUseDataBrowserUICustomization({});
|
|
66
65
|
mockUseParams.mockReturnValue({
|
|
67
|
-
bucketName:
|
|
66
|
+
bucketName: 'test-bucket'
|
|
68
67
|
});
|
|
69
68
|
mockUseNavigate.mockReturnValue(jest.fn());
|
|
70
69
|
});
|
|
71
|
-
it(
|
|
70
|
+
it('renders all default tabs', async ()=>{
|
|
72
71
|
renderBucketDetails();
|
|
73
72
|
await waitFor(()=>{
|
|
74
|
-
expect(screen.getByText(
|
|
75
|
-
expect(screen.getByText(
|
|
76
|
-
expect(screen.getByText(
|
|
73
|
+
expect(screen.getByText('Overview')).toBeInTheDocument();
|
|
74
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
75
|
+
expect(screen.getByText('Replication')).toBeInTheDocument();
|
|
77
76
|
});
|
|
78
77
|
});
|
|
79
|
-
it(
|
|
78
|
+
it('shows overview tab content by default', ()=>{
|
|
80
79
|
renderBucketDetails();
|
|
81
|
-
const overviewTab = screen.getByText(
|
|
82
|
-
expect(overviewTab).toHaveAttribute(
|
|
80
|
+
const overviewTab = screen.getByText('Overview').closest('[role="tab"]');
|
|
81
|
+
expect(overviewTab).toHaveAttribute('class', expect.stringContaining('selected'));
|
|
83
82
|
});
|
|
84
|
-
it(
|
|
83
|
+
it('handles lifecycle data loading', ()=>{
|
|
85
84
|
mockUseGetBucketLifecycle.mockReturnValue({
|
|
86
85
|
data: void 0,
|
|
87
|
-
status:
|
|
86
|
+
status: 'pending',
|
|
88
87
|
error: null
|
|
89
88
|
});
|
|
90
89
|
renderBucketDetails();
|
|
91
|
-
expect(screen.getByText(
|
|
90
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
92
91
|
});
|
|
93
|
-
it(
|
|
92
|
+
it('handles lifecycle error gracefully', ()=>{
|
|
94
93
|
mockUseGetBucketLifecycle.mockReturnValue({
|
|
95
94
|
data: void 0,
|
|
96
|
-
status:
|
|
97
|
-
error: new Error(
|
|
95
|
+
status: 'error',
|
|
96
|
+
error: new Error('Failed to fetch')
|
|
98
97
|
});
|
|
99
98
|
renderBucketDetails();
|
|
100
|
-
expect(screen.getByText(
|
|
99
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
101
100
|
});
|
|
102
|
-
it(
|
|
103
|
-
const notFoundError = new Error(
|
|
104
|
-
notFoundError.name =
|
|
101
|
+
it('handles lifecycle 404 as success', ()=>{
|
|
102
|
+
const notFoundError = new Error('Not found');
|
|
103
|
+
notFoundError.name = 'NoSuchLifecycleConfiguration';
|
|
105
104
|
notFoundError.$metadata = {
|
|
106
105
|
httpStatusCode: 404
|
|
107
106
|
};
|
|
108
107
|
mockUseGetBucketLifecycle.mockReturnValue({
|
|
109
108
|
data: void 0,
|
|
110
|
-
status:
|
|
109
|
+
status: 'error',
|
|
111
110
|
error: notFoundError
|
|
112
111
|
});
|
|
113
112
|
renderBucketDetails();
|
|
114
|
-
expect(screen.getByText(
|
|
113
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
115
114
|
});
|
|
116
|
-
it(
|
|
115
|
+
it('displays lifecycle rules when available', ()=>{
|
|
117
116
|
mockUseGetBucketLifecycle.mockReturnValue({
|
|
118
117
|
data: {
|
|
119
118
|
Rules: [
|
|
120
119
|
{
|
|
121
|
-
ID:
|
|
122
|
-
Status:
|
|
120
|
+
ID: 'rule-1',
|
|
121
|
+
Status: 'Enabled',
|
|
123
122
|
Filter: {}
|
|
124
123
|
},
|
|
125
124
|
{
|
|
126
|
-
ID:
|
|
127
|
-
Status:
|
|
125
|
+
ID: 'rule-2',
|
|
126
|
+
Status: 'Disabled',
|
|
128
127
|
Filter: {}
|
|
129
128
|
}
|
|
130
129
|
]
|
|
131
130
|
},
|
|
132
|
-
status:
|
|
131
|
+
status: 'success',
|
|
133
132
|
error: null
|
|
134
133
|
});
|
|
135
134
|
renderBucketDetails();
|
|
136
|
-
expect(screen.getByText(
|
|
135
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
137
136
|
});
|
|
138
|
-
it(
|
|
137
|
+
it('handles replication data loading', ()=>{
|
|
139
138
|
mockUseGetBucketReplication.mockReturnValue({
|
|
140
139
|
data: void 0,
|
|
141
|
-
status:
|
|
140
|
+
status: 'pending',
|
|
142
141
|
error: null
|
|
143
142
|
});
|
|
144
143
|
renderBucketDetails();
|
|
145
|
-
expect(screen.getByText(
|
|
144
|
+
expect(screen.getByText('Replication')).toBeInTheDocument();
|
|
146
145
|
});
|
|
147
|
-
it(
|
|
146
|
+
it('handles replication error gracefully', ()=>{
|
|
148
147
|
mockUseGetBucketReplication.mockReturnValue({
|
|
149
148
|
data: void 0,
|
|
150
|
-
status:
|
|
151
|
-
error: new Error(
|
|
149
|
+
status: 'error',
|
|
150
|
+
error: new Error('Failed to fetch')
|
|
152
151
|
});
|
|
153
152
|
renderBucketDetails();
|
|
154
|
-
expect(screen.getByText(
|
|
153
|
+
expect(screen.getByText('Replication')).toBeInTheDocument();
|
|
155
154
|
});
|
|
156
|
-
it(
|
|
157
|
-
const notFoundError = new Error(
|
|
158
|
-
notFoundError.name =
|
|
155
|
+
it('handles replication 404 as success', ()=>{
|
|
156
|
+
const notFoundError = new Error('Not found');
|
|
157
|
+
notFoundError.name = 'ReplicationConfigurationNotFoundError';
|
|
159
158
|
notFoundError.$metadata = {
|
|
160
159
|
httpStatusCode: 404
|
|
161
160
|
};
|
|
162
161
|
mockUseGetBucketReplication.mockReturnValue({
|
|
163
162
|
data: void 0,
|
|
164
|
-
status:
|
|
163
|
+
status: 'error',
|
|
165
164
|
error: notFoundError
|
|
166
165
|
});
|
|
167
166
|
renderBucketDetails();
|
|
168
|
-
expect(screen.getByText(
|
|
167
|
+
expect(screen.getByText('Replication')).toBeInTheDocument();
|
|
169
168
|
});
|
|
170
|
-
it(
|
|
169
|
+
it('displays replication rules when available', ()=>{
|
|
171
170
|
mockUseGetBucketReplication.mockReturnValue({
|
|
172
171
|
data: {
|
|
173
172
|
ReplicationConfiguration: {
|
|
174
|
-
Role:
|
|
173
|
+
Role: 'arn:aws:iam::123456789012:role/replication-role',
|
|
175
174
|
Rules: [
|
|
176
175
|
{
|
|
177
|
-
ID:
|
|
178
|
-
Status:
|
|
176
|
+
ID: 'repl-rule-1',
|
|
177
|
+
Status: 'Enabled',
|
|
179
178
|
Priority: 1,
|
|
180
179
|
Destination: {
|
|
181
|
-
Bucket:
|
|
180
|
+
Bucket: 'arn:aws:s3:::destination-bucket'
|
|
182
181
|
}
|
|
183
182
|
}
|
|
184
183
|
]
|
|
185
184
|
}
|
|
186
185
|
},
|
|
187
|
-
status:
|
|
186
|
+
status: 'success',
|
|
188
187
|
error: null
|
|
189
188
|
});
|
|
190
189
|
renderBucketDetails();
|
|
191
|
-
expect(screen.getByText(
|
|
190
|
+
expect(screen.getByText('Replication')).toBeInTheDocument();
|
|
192
191
|
});
|
|
193
|
-
it(
|
|
192
|
+
it('shows message when bucket name is missing', ()=>{
|
|
194
193
|
mockUseParams.mockReturnValue({
|
|
195
194
|
bucketName: void 0
|
|
196
195
|
});
|
|
197
196
|
renderBucketDetails();
|
|
198
|
-
expect(screen.getByText(
|
|
197
|
+
expect(screen.getByText('No bucket selected')).toBeInTheDocument();
|
|
199
198
|
});
|
|
200
|
-
describe(
|
|
201
|
-
it(
|
|
199
|
+
describe('extraBucketTabs support', ()=>{
|
|
200
|
+
it('renders extra tabs when configured', async ()=>{
|
|
202
201
|
const CustomTab = ()=>/*#__PURE__*/ jsx("div", {
|
|
203
202
|
children: "Custom Tab Content"
|
|
204
203
|
});
|
|
205
204
|
mockUseDataBrowserUICustomization({
|
|
206
205
|
extraBucketTabs: [
|
|
207
206
|
{
|
|
208
|
-
id:
|
|
209
|
-
title:
|
|
207
|
+
id: 'customTab',
|
|
208
|
+
title: 'Custom Tab',
|
|
210
209
|
render: CustomTab
|
|
211
210
|
}
|
|
212
211
|
]
|
|
213
212
|
});
|
|
214
213
|
renderBucketDetails();
|
|
215
214
|
await waitFor(()=>{
|
|
216
|
-
expect(screen.getByText(
|
|
215
|
+
expect(screen.getByText('Custom Tab')).toBeInTheDocument();
|
|
217
216
|
});
|
|
218
217
|
});
|
|
219
|
-
it(
|
|
218
|
+
it('renders multiple extra tabs', async ()=>{
|
|
220
219
|
const Tab1 = ()=>/*#__PURE__*/ jsx("div", {
|
|
221
220
|
children: "Tab 1 Content"
|
|
222
221
|
});
|
|
@@ -226,51 +225,51 @@ describe("BucketDetails", ()=>{
|
|
|
226
225
|
mockUseDataBrowserUICustomization({
|
|
227
226
|
extraBucketTabs: [
|
|
228
227
|
{
|
|
229
|
-
id:
|
|
230
|
-
title:
|
|
228
|
+
id: 'tab1',
|
|
229
|
+
title: 'Tab 1',
|
|
231
230
|
render: Tab1
|
|
232
231
|
},
|
|
233
232
|
{
|
|
234
|
-
id:
|
|
235
|
-
title:
|
|
233
|
+
id: 'tab2',
|
|
234
|
+
title: 'Tab 2',
|
|
236
235
|
render: Tab2
|
|
237
236
|
}
|
|
238
237
|
]
|
|
239
238
|
});
|
|
240
239
|
renderBucketDetails();
|
|
241
240
|
await waitFor(()=>{
|
|
242
|
-
expect(screen.getByText(
|
|
243
|
-
expect(screen.getByText(
|
|
241
|
+
expect(screen.getByText('Tab 1')).toBeInTheDocument();
|
|
242
|
+
expect(screen.getByText('Tab 2')).toBeInTheDocument();
|
|
244
243
|
});
|
|
245
244
|
});
|
|
246
|
-
it(
|
|
245
|
+
it('can replace default tabs using matching IDs', async ()=>{
|
|
247
246
|
const CustomOverview = ()=>/*#__PURE__*/ jsx("div", {
|
|
248
247
|
children: "Custom Overview Content"
|
|
249
248
|
});
|
|
250
249
|
mockUseDataBrowserUICustomization({
|
|
251
250
|
extraBucketTabs: [
|
|
252
251
|
{
|
|
253
|
-
id:
|
|
254
|
-
title:
|
|
252
|
+
id: 'overview',
|
|
253
|
+
title: 'Custom Overview',
|
|
255
254
|
render: CustomOverview
|
|
256
255
|
}
|
|
257
256
|
]
|
|
258
257
|
});
|
|
259
258
|
renderBucketDetails();
|
|
260
259
|
await waitFor(()=>{
|
|
261
|
-
expect(screen.getByText(
|
|
262
|
-
expect(screen.queryByText(
|
|
260
|
+
expect(screen.getByText('Custom Overview')).toBeInTheDocument();
|
|
261
|
+
expect(screen.queryByText('Overview')).not.toBeInTheDocument();
|
|
263
262
|
});
|
|
264
263
|
});
|
|
265
|
-
it(
|
|
264
|
+
it('supports withoutPadding option for extra tabs', async ()=>{
|
|
266
265
|
const CustomTab = ()=>/*#__PURE__*/ jsx("div", {
|
|
267
266
|
children: "No Padding Content"
|
|
268
267
|
});
|
|
269
268
|
mockUseDataBrowserUICustomization({
|
|
270
269
|
extraBucketTabs: [
|
|
271
270
|
{
|
|
272
|
-
id:
|
|
273
|
-
title:
|
|
271
|
+
id: 'noPaddingTab',
|
|
272
|
+
title: 'No Padding',
|
|
274
273
|
withoutPadding: true,
|
|
275
274
|
render: CustomTab
|
|
276
275
|
}
|
|
@@ -278,144 +277,144 @@ describe("BucketDetails", ()=>{
|
|
|
278
277
|
});
|
|
279
278
|
renderBucketDetails();
|
|
280
279
|
await waitFor(()=>{
|
|
281
|
-
expect(screen.getByText(
|
|
280
|
+
expect(screen.getByText('No Padding')).toBeInTheDocument();
|
|
282
281
|
});
|
|
283
282
|
});
|
|
284
|
-
it(
|
|
283
|
+
it('supports custom path for extra tabs', async ()=>{
|
|
285
284
|
const CustomTab = ()=>/*#__PURE__*/ jsx("div", {
|
|
286
285
|
children: "Custom Path Content"
|
|
287
286
|
});
|
|
288
287
|
mockUseDataBrowserUICustomization({
|
|
289
288
|
extraBucketTabs: [
|
|
290
289
|
{
|
|
291
|
-
id:
|
|
292
|
-
title:
|
|
293
|
-
path:
|
|
290
|
+
id: 'customPath',
|
|
291
|
+
title: 'Custom Path Tab',
|
|
292
|
+
path: '/custom-path',
|
|
294
293
|
render: CustomTab
|
|
295
294
|
}
|
|
296
295
|
]
|
|
297
296
|
});
|
|
298
297
|
renderBucketDetails();
|
|
299
298
|
await waitFor(()=>{
|
|
300
|
-
expect(screen.getByText(
|
|
299
|
+
expect(screen.getByText('Custom Path Tab')).toBeInTheDocument();
|
|
301
300
|
});
|
|
302
301
|
});
|
|
303
|
-
it(
|
|
302
|
+
it('maintains correct tab order with extra tabs', async ()=>{
|
|
304
303
|
const ExtraTab = ()=>/*#__PURE__*/ jsx("div", {
|
|
305
304
|
children: "Extra Tab Content"
|
|
306
305
|
});
|
|
307
306
|
mockUseDataBrowserUICustomization({
|
|
308
307
|
extraBucketTabs: [
|
|
309
308
|
{
|
|
310
|
-
id:
|
|
311
|
-
title:
|
|
309
|
+
id: 'extraTab',
|
|
310
|
+
title: 'Extra Tab',
|
|
312
311
|
render: ExtraTab
|
|
313
312
|
}
|
|
314
313
|
]
|
|
315
314
|
});
|
|
316
315
|
renderBucketDetails();
|
|
317
316
|
await waitFor(()=>{
|
|
318
|
-
const tabs = screen.getAllByRole(
|
|
317
|
+
const tabs = screen.getAllByRole('tab');
|
|
319
318
|
const tabTexts = tabs.map((tab)=>tab.textContent);
|
|
320
319
|
expect(tabTexts).toEqual([
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
320
|
+
'Overview',
|
|
321
|
+
'Lifecycle',
|
|
322
|
+
'Replication',
|
|
323
|
+
'Extra Tab'
|
|
325
324
|
]);
|
|
326
325
|
});
|
|
327
326
|
});
|
|
328
|
-
it(
|
|
327
|
+
it('can replace lifecycle tab', async ()=>{
|
|
329
328
|
const CustomLifecycle = ()=>/*#__PURE__*/ jsx("div", {
|
|
330
329
|
children: "Custom Lifecycle Content"
|
|
331
330
|
});
|
|
332
331
|
mockUseDataBrowserUICustomization({
|
|
333
332
|
extraBucketTabs: [
|
|
334
333
|
{
|
|
335
|
-
id:
|
|
336
|
-
title:
|
|
334
|
+
id: 'lifecycle',
|
|
335
|
+
title: 'Custom Lifecycle',
|
|
337
336
|
render: CustomLifecycle
|
|
338
337
|
}
|
|
339
338
|
]
|
|
340
339
|
});
|
|
341
340
|
renderBucketDetails();
|
|
342
341
|
await waitFor(()=>{
|
|
343
|
-
expect(screen.getByText(
|
|
344
|
-
expect(screen.queryByText(
|
|
342
|
+
expect(screen.getByText('Custom Lifecycle')).toBeInTheDocument();
|
|
343
|
+
expect(screen.queryByText('Lifecycle')).not.toBeInTheDocument();
|
|
345
344
|
});
|
|
346
345
|
});
|
|
347
|
-
it(
|
|
346
|
+
it('can replace replication tab', async ()=>{
|
|
348
347
|
const CustomReplication = ()=>/*#__PURE__*/ jsx("div", {
|
|
349
348
|
children: "Custom Replication Content"
|
|
350
349
|
});
|
|
351
350
|
mockUseDataBrowserUICustomization({
|
|
352
351
|
extraBucketTabs: [
|
|
353
352
|
{
|
|
354
|
-
id:
|
|
355
|
-
title:
|
|
353
|
+
id: 'replication',
|
|
354
|
+
title: 'Custom Replication',
|
|
356
355
|
render: CustomReplication
|
|
357
356
|
}
|
|
358
357
|
]
|
|
359
358
|
});
|
|
360
359
|
renderBucketDetails();
|
|
361
360
|
await waitFor(()=>{
|
|
362
|
-
expect(screen.getByText(
|
|
363
|
-
expect(screen.queryByText(
|
|
361
|
+
expect(screen.getByText('Custom Replication')).toBeInTheDocument();
|
|
362
|
+
expect(screen.queryByText('Replication')).not.toBeInTheDocument();
|
|
364
363
|
});
|
|
365
364
|
});
|
|
366
365
|
});
|
|
367
|
-
describe(
|
|
368
|
-
it(
|
|
366
|
+
describe('Tab query parameters', ()=>{
|
|
367
|
+
it('creates correct query object for overview tab', ()=>{
|
|
369
368
|
renderBucketDetails();
|
|
370
|
-
const overviewTab = screen.getByText(
|
|
369
|
+
const overviewTab = screen.getByText('Overview');
|
|
371
370
|
expect(overviewTab).toBeInTheDocument();
|
|
372
371
|
expect(overviewTab.closest('[role="tab"]')).toBeInTheDocument();
|
|
373
372
|
});
|
|
374
|
-
it(
|
|
373
|
+
it('creates correct query object for lifecycle tab', ()=>{
|
|
375
374
|
renderBucketDetails();
|
|
376
|
-
const lifecycleTab = screen.getByText(
|
|
375
|
+
const lifecycleTab = screen.getByText('Lifecycle');
|
|
377
376
|
expect(lifecycleTab).toBeInTheDocument();
|
|
378
377
|
expect(lifecycleTab.closest('[role="tab"]')).toBeInTheDocument();
|
|
379
378
|
});
|
|
380
|
-
it(
|
|
379
|
+
it('creates correct query object for replication tab', ()=>{
|
|
381
380
|
renderBucketDetails();
|
|
382
|
-
const replicationTab = screen.getByText(
|
|
381
|
+
const replicationTab = screen.getByText('Replication');
|
|
383
382
|
expect(replicationTab).toBeInTheDocument();
|
|
384
383
|
expect(replicationTab.closest('[role="tab"]')).toBeInTheDocument();
|
|
385
384
|
});
|
|
386
385
|
});
|
|
387
|
-
describe(
|
|
388
|
-
it(
|
|
386
|
+
describe('Status transformation', ()=>{
|
|
387
|
+
it('transforms pending status to loading', ()=>{
|
|
389
388
|
mockUseGetBucketLifecycle.mockReturnValue({
|
|
390
389
|
data: void 0,
|
|
391
|
-
status:
|
|
390
|
+
status: 'pending',
|
|
392
391
|
error: null
|
|
393
392
|
});
|
|
394
393
|
renderBucketDetails();
|
|
395
|
-
expect(screen.getByText(
|
|
394
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
396
395
|
});
|
|
397
|
-
it(
|
|
396
|
+
it('transforms error status correctly', ()=>{
|
|
398
397
|
mockUseGetBucketLifecycle.mockReturnValue({
|
|
399
398
|
data: void 0,
|
|
400
|
-
status:
|
|
401
|
-
error: new Error(
|
|
399
|
+
status: 'error',
|
|
400
|
+
error: new Error('Generic error')
|
|
402
401
|
});
|
|
403
402
|
renderBucketDetails();
|
|
404
|
-
expect(screen.getByText(
|
|
403
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
405
404
|
});
|
|
406
|
-
it(
|
|
407
|
-
const notFoundError = new Error(
|
|
408
|
-
notFoundError.name =
|
|
405
|
+
it('transforms 404 error to success', ()=>{
|
|
406
|
+
const notFoundError = new Error('Not found');
|
|
407
|
+
notFoundError.name = 'NoSuchLifecycleConfiguration';
|
|
409
408
|
notFoundError.$metadata = {
|
|
410
409
|
httpStatusCode: 404
|
|
411
410
|
};
|
|
412
411
|
mockUseGetBucketLifecycle.mockReturnValue({
|
|
413
412
|
data: void 0,
|
|
414
|
-
status:
|
|
413
|
+
status: 'error',
|
|
415
414
|
error: notFoundError
|
|
416
415
|
});
|
|
417
416
|
renderBucketDetails();
|
|
418
|
-
expect(screen.getByText(
|
|
417
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
419
418
|
});
|
|
420
419
|
});
|
|
421
420
|
});
|