@scality/data-browser-library 1.0.0-preview.9 → 1.0.1
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 +12 -0
- package/dist/components/DataBrowserUI.js +99 -0
- package/dist/components/Editor.d.ts +1 -1
- package/dist/components/Editor.js +3 -3
- package/dist/components/__tests__/BucketAccessor.test.js +214 -0
- package/dist/components/__tests__/BucketCorsPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketCorsPage.test.js +263 -0
- package/dist/components/__tests__/BucketCreate.test.js +271 -105
- package/dist/components/__tests__/BucketDetails.test.d.ts +1 -0
- package/dist/components/__tests__/BucketDetails.test.js +421 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +13 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.js +178 -178
- package/dist/components/__tests__/BucketLifecycleList.test.js +85 -85
- package/dist/components/__tests__/BucketList.test.js +463 -239
- package/dist/components/__tests__/BucketNotificationFormPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationFormPage.test.js +348 -0
- package/dist/components/__tests__/BucketNotificationList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationList.test.js +379 -0
- package/dist/components/__tests__/BucketOverview.test.js +281 -266
- package/dist/components/__tests__/BucketPolicyPage.test.js +151 -99
- package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +15 -0
- package/dist/components/__tests__/BucketReplicationFormPage.test.js +544 -544
- 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 +64 -64
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +47 -47
- package/dist/components/__tests__/DeleteObjectButton.test.js +64 -64
- package/dist/components/__tests__/EmptyBucketButton.test.js +59 -59
- package/dist/components/__tests__/MetadataSearch.test.js +65 -65
- package/dist/components/__tests__/ObjectList.test.js +741 -240
- package/dist/components/__tests__/UploadButton.test.js +45 -45
- package/dist/components/breadcrumb/Breadcrumb.d.ts +6 -0
- package/dist/components/breadcrumb/Breadcrumb.js +37 -0
- package/dist/components/breadcrumb/DataBrowserBreadcrumb.d.ts +1 -0
- package/dist/components/breadcrumb/DataBrowserBreadcrumb.js +10 -0
- package/dist/components/breadcrumb/__tests__/Breadcrumb.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/Breadcrumb.test.js +196 -0
- package/dist/components/breadcrumb/__tests__/DataBrowserBreadcrumb.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/DataBrowserBreadcrumb.test.js +153 -0
- package/dist/components/breadcrumb/__tests__/useBreadcrumbPaths.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/useBreadcrumbPaths.test.js +134 -0
- package/dist/components/breadcrumb/index.d.ts +8 -0
- package/dist/components/breadcrumb/index.js +4 -0
- package/dist/components/breadcrumb/useBreadcrumbPaths.d.ts +2 -0
- package/dist/components/breadcrumb/useBreadcrumbPaths.js +82 -0
- package/dist/components/buckets/BucketAccessor.d.ts +2 -0
- package/dist/components/buckets/BucketAccessor.js +125 -0
- package/dist/components/buckets/BucketConfigEditButton.d.ts +8 -0
- package/dist/components/buckets/{BucketPolicyButton.js → BucketConfigEditButton.js} +9 -5
- package/dist/components/buckets/BucketCorsPage.d.ts +1 -0
- package/dist/components/buckets/BucketCorsPage.js +234 -0
- package/dist/components/buckets/BucketCreate.d.ts +3 -2
- package/dist/components/buckets/BucketCreate.js +89 -47
- package/dist/components/buckets/BucketDetails.d.ts +42 -0
- package/dist/components/buckets/BucketDetails.js +249 -85
- package/dist/components/buckets/BucketLifecycleFormPage.js +206 -190
- package/dist/components/buckets/BucketLifecycleList.d.ts +2 -2
- package/dist/components/buckets/BucketLifecycleList.js +47 -47
- package/dist/components/buckets/BucketList.d.ts +7 -8
- package/dist/components/buckets/BucketList.js +158 -101
- package/dist/components/buckets/BucketLocation.js +4 -4
- package/dist/components/buckets/BucketOverview.d.ts +22 -2
- package/dist/components/buckets/BucketOverview.js +394 -187
- package/dist/components/buckets/BucketPage.js +43 -21
- package/dist/components/buckets/BucketPolicyPage.js +155 -127
- package/dist/components/buckets/BucketReplicationFormPage.js +134 -133
- package/dist/components/buckets/BucketReplicationList.d.ts +2 -2
- package/dist/components/buckets/BucketReplicationList.js +42 -42
- package/dist/components/buckets/BucketVersioning.d.ts +4 -0
- package/dist/components/buckets/BucketVersioning.js +76 -0
- package/dist/components/buckets/DeleteBucketButton.js +8 -8
- package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +2 -2
- package/dist/components/buckets/DeleteBucketConfigRuleButton.js +2 -2
- package/dist/components/buckets/EmptyBucketButton.js +24 -24
- package/dist/components/buckets/EmptyBucketSummary.d.ts +2 -2
- package/dist/components/buckets/EmptyBucketSummary.js +1 -1
- package/dist/components/buckets/EmptyBucketSummaryList.d.ts +1 -1
- package/dist/components/buckets/EmptyBucketSummaryList.js +22 -22
- package/dist/components/buckets/__tests__/BucketVersioning.test.d.ts +1 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.js +163 -0
- package/dist/components/buckets/notifications/BucketNotificationFormPage.d.ts +1 -0
- package/dist/components/buckets/notifications/BucketNotificationFormPage.js +316 -0
- package/dist/components/buckets/notifications/BucketNotificationList.d.ts +10 -0
- package/dist/components/buckets/notifications/BucketNotificationList.js +267 -0
- package/dist/components/buckets/notifications/EventsSection.js +145 -29
- 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 +27 -20
- package/dist/components/index.js +17 -10
- package/dist/components/layouts/ArrowNavigation.d.ts +3 -0
- package/dist/components/layouts/ArrowNavigation.js +28 -0
- package/dist/components/layouts/BrowserPageLayout.d.ts +5 -1
- package/dist/components/layouts/BrowserPageLayout.js +10 -5
- package/dist/components/objects/CreateFolderButton.d.ts +2 -2
- package/dist/components/objects/CreateFolderButton.js +12 -12
- package/dist/components/objects/DeleteObjectButton.d.ts +1 -1
- package/dist/components/objects/DeleteObjectButton.js +19 -21
- package/dist/components/objects/GetPresignedUrlButton.d.ts +7 -0
- package/dist/components/objects/GetPresignedUrlButton.js +255 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectMetadata.js +263 -230
- package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +540 -138
- package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectTags.js +95 -123
- package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.d.ts +1 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.js +516 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.d.ts +1 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.js +1064 -0
- package/dist/components/objects/ObjectDetails/index.d.ts +18 -2
- package/dist/components/objects/ObjectDetails/index.js +152 -40
- package/dist/components/objects/ObjectList.d.ts +12 -10
- package/dist/components/objects/ObjectList.js +590 -263
- package/dist/components/objects/ObjectLock/EditRetentionButton.js +4 -4
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +15 -15
- package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +1 -1
- package/dist/components/objects/ObjectLock/ObjectLockSettings.js +32 -31
- 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 +51 -51
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +78 -78
- package/dist/components/objects/ObjectPage.js +12 -8
- package/dist/components/objects/UploadButton.d.ts +3 -3
- package/dist/components/objects/UploadButton.js +10 -10
- package/dist/components/objects/__tests__/GetPresignedUrlButton.test.d.ts +1 -0
- package/dist/components/objects/__tests__/GetPresignedUrlButton.test.js +531 -0
- package/dist/components/providers/DataBrowserProvider.d.ts +23 -12
- package/dist/components/providers/DataBrowserProvider.js +60 -38
- package/dist/components/providers/QueryProvider.d.ts +9 -0
- package/dist/components/providers/QueryProvider.js +21 -0
- package/dist/components/search/MetadataSearch.js +29 -28
- package/dist/components/search/SearchHints.js +1 -1
- package/dist/components/ui/ArrayFieldActions.js +12 -7
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +2 -2
- package/dist/components/ui/ConfirmDeleteRuleModal.js +6 -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 +2 -2
- package/dist/components/ui/Search.elements.js +7 -7
- package/dist/components/ui/Table.elements.d.ts +2 -1
- package/dist/components/ui/Table.elements.js +18 -12
- package/dist/config/__tests__/factory.test.d.ts +1 -0
- package/dist/config/__tests__/factory.test.js +311 -0
- package/dist/config/factory.d.ts +10 -56
- package/dist/config/factory.js +23 -71
- package/dist/config/types.d.ts +212 -34
- package/dist/contexts/DataBrowserUICustomizationContext.d.ts +27 -0
- package/dist/contexts/DataBrowserUICustomizationContext.js +13 -0
- package/dist/hooks/__tests__/useAccessibleBuckets.test.d.ts +1 -0
- package/dist/hooks/__tests__/useAccessibleBuckets.test.js +145 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.js +45 -45
- package/dist/hooks/__tests__/useIsBucketEmpty.test.js +27 -27
- package/dist/hooks/__tests__/useLoginMutation.test.d.ts +1 -0
- package/dist/hooks/__tests__/useLoginMutation.test.js +194 -0
- package/dist/hooks/bucketConfiguration.d.ts +8 -1
- package/dist/hooks/bucketConfiguration.js +52 -51
- package/dist/hooks/bucketOperations.d.ts +10 -1
- package/dist/hooks/bucketOperations.js +10 -9
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +80 -80
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +80 -80
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +44 -44
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +63 -63
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +65 -65
- package/dist/hooks/factories/index.d.ts +4 -4
- package/dist/hooks/factories/index.js +2 -2
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +16 -13
- package/dist/hooks/factories/useCreateS3LoginHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3LoginHook.js +1 -1
- package/dist/hooks/factories/useCreateS3MutationHook.d.ts +3 -3
- package/dist/hooks/factories/useCreateS3MutationHook.js +7 -2
- package/dist/hooks/factories/useCreateS3QueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3QueryHook.js +11 -6
- package/dist/hooks/index.d.ts +19 -12
- package/dist/hooks/index.js +16 -9
- 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 +50 -49
- package/dist/hooks/presignedOperations.d.ts +4 -4
- package/dist/hooks/presignedOperations.js +5 -5
- package/dist/hooks/useAccessibleBuckets.d.ts +11 -0
- package/dist/hooks/useAccessibleBuckets.js +115 -0
- package/dist/hooks/useBatchObjectLegalHold.d.ts +11 -0
- package/dist/hooks/useBatchObjectLegalHold.js +48 -0
- package/dist/hooks/useBucketConfigEditor.d.ts +31 -0
- package/dist/hooks/useBucketConfigEditor.js +82 -0
- package/dist/hooks/useDataBrowserNavigate.d.ts +28 -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 +11 -11
- package/dist/hooks/useFeatures.d.ts +7 -0
- package/dist/hooks/useFeatures.js +8 -0
- package/dist/hooks/useISVBucketDetection.js +6 -6
- package/dist/hooks/useIsBucketEmpty.js +4 -4
- package/dist/hooks/useLimitedAccessFlow.d.ts +48 -0
- package/dist/hooks/useLimitedAccessFlow.js +23 -0
- package/dist/hooks/useS3Client.d.ts +6 -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/hooks/useSupportedNotificationEvents.d.ts +6 -0
- package/dist/hooks/useSupportedNotificationEvents.js +8 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +2 -2
- package/dist/schemas/bucketPolicySchema.json +3 -13
- 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 +32 -17
- 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 +77 -54
- package/dist/test/msw/index.d.ts +2 -2
- package/dist/test/msw/index.js +1 -1
- 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 +13 -30
- package/dist/test/testUtils.d.ts +85 -33
- package/dist/test/testUtils.js +176 -111
- package/dist/test/utils/errorHandling.test.js +119 -119
- package/dist/types/index.d.ts +49 -36
- package/dist/types/monaco.d.ts +13 -0
- package/dist/types/monaco.js +0 -0
- package/dist/utils/__tests__/proxyMiddleware.test.d.ts +1 -0
- package/dist/utils/__tests__/proxyMiddleware.test.js +579 -0
- package/dist/utils/__tests__/s3Client.test.d.ts +1 -0
- package/dist/utils/__tests__/s3Client.test.js +340 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.d.ts +1 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.js +437 -0
- package/dist/utils/constants.d.ts +10 -0
- package/dist/utils/constants.js +19 -9
- package/dist/utils/deletion/index.d.ts +2 -2
- package/dist/utils/deletion/index.js +1 -1
- 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 +4 -2
- package/dist/utils/proxyMiddleware.d.ts +32 -13
- package/dist/utils/proxyMiddleware.js +90 -36
- package/dist/utils/s3Client.d.ts +14 -4
- package/dist/utils/s3Client.js +5 -26
- package/dist/utils/s3ConfigIdentifier.d.ts +79 -0
- package/dist/utils/s3ConfigIdentifier.js +57 -0
- package/dist/utils/s3RuleUtils.d.ts +5 -5
- package/dist/utils/s3RuleUtils.js +17 -17
- package/package.json +10 -8
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +0 -316
- package/dist/components/buckets/BucketPolicyButton.d.ts +0 -7
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.d.ts +0 -1
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +0 -234
- package/dist/hooks/useLoginMutation.d.ts +0 -21
- package/dist/hooks/useLoginMutation.js +0 -9
- package/dist/utils/useFeatures.d.ts +0 -1
- package/dist/utils/useFeatures.js +0 -7
- /package/dist/components/__tests__/{BucketNotificationCreatePage.test.d.ts → BucketAccessor.test.d.ts} +0 -0
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { fireEvent, render, screen, waitFor } from "@testing-library/react";
|
|
3
3
|
import user_event from "@testing-library/user-event";
|
|
4
|
-
import { MemoryRouter, Route, Routes } from "react-router
|
|
4
|
+
import { MemoryRouter, Route, Routes } from "react-router";
|
|
5
|
+
import { useGetBucketObjectLockConfiguration, useSetBucketObjectLockConfiguration } from "../../../../hooks/index.js";
|
|
5
6
|
import { createTestWrapper } from "../../../../test/testUtils.js";
|
|
6
7
|
import { ObjectLockSettings } from "../ObjectLockSettings.js";
|
|
7
|
-
|
|
8
|
-
jest.mock("../../../../hooks", ()=>({
|
|
8
|
+
jest.mock('../../../../hooks', ()=>({
|
|
9
9
|
useGetBucketObjectLockConfiguration: jest.fn(),
|
|
10
10
|
useSetBucketObjectLockConfiguration: jest.fn()
|
|
11
11
|
}));
|
|
12
12
|
const mockUseGetBucketObjectLockConfiguration = jest.mocked(useGetBucketObjectLockConfiguration);
|
|
13
13
|
const mockUseSetBucketObjectLockConfiguration = jest.mocked(useSetBucketObjectLockConfiguration);
|
|
14
14
|
const mockNavigate = jest.fn();
|
|
15
|
-
jest.mock(
|
|
16
|
-
...jest.requireActual(
|
|
15
|
+
jest.mock('react-router', ()=>({
|
|
16
|
+
...jest.requireActual('react-router'),
|
|
17
17
|
useNavigate: ()=>mockNavigate
|
|
18
18
|
}));
|
|
19
|
-
const renderObjectLockSettings = (bucketName =
|
|
19
|
+
const renderObjectLockSettings = (bucketName = 'test-bucket')=>{
|
|
20
20
|
const Wrapper = createTestWrapper();
|
|
21
21
|
return render(/*#__PURE__*/ jsx(MemoryRouter, {
|
|
22
22
|
initialEntries: [
|
|
@@ -32,74 +32,74 @@ const renderObjectLockSettings = (bucketName = "test-bucket")=>{
|
|
|
32
32
|
})
|
|
33
33
|
}));
|
|
34
34
|
};
|
|
35
|
-
describe(
|
|
35
|
+
describe('ObjectLockSettings', ()=>{
|
|
36
36
|
const mockMutate = jest.fn();
|
|
37
37
|
beforeEach(()=>{
|
|
38
38
|
jest.clearAllMocks();
|
|
39
39
|
mockNavigate.mockClear();
|
|
40
40
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
41
41
|
data: void 0,
|
|
42
|
-
status:
|
|
42
|
+
status: 'success'
|
|
43
43
|
});
|
|
44
44
|
mockUseSetBucketObjectLockConfiguration.mockReturnValue({
|
|
45
45
|
mutate: mockMutate,
|
|
46
46
|
isPending: false
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
|
-
it(
|
|
49
|
+
it('displays loading state while fetching bucket configuration', ()=>{
|
|
50
50
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
51
51
|
data: void 0,
|
|
52
|
-
status:
|
|
52
|
+
status: 'pending'
|
|
53
53
|
});
|
|
54
54
|
renderObjectLockSettings();
|
|
55
|
-
expect(screen.getByText(
|
|
55
|
+
expect(screen.getByText('Loading retention settings...')).toBeInTheDocument();
|
|
56
56
|
});
|
|
57
|
-
it(
|
|
57
|
+
it('renders form with Object Lock checkbox', async ()=>{
|
|
58
58
|
renderObjectLockSettings();
|
|
59
59
|
await waitFor(()=>{
|
|
60
|
-
expect(screen.getByText(
|
|
60
|
+
expect(screen.getByText('Object-lock settings')).toBeInTheDocument();
|
|
61
61
|
});
|
|
62
62
|
expect(screen.getByLabelText(/object-lock/i)).toBeInTheDocument();
|
|
63
63
|
});
|
|
64
|
-
it(
|
|
64
|
+
it('disables save button when Object Lock is not enabled', async ()=>{
|
|
65
65
|
renderObjectLockSettings();
|
|
66
66
|
await waitFor(()=>{
|
|
67
|
-
const saveButton = screen.getByRole(
|
|
67
|
+
const saveButton = screen.getByRole('button', {
|
|
68
68
|
name: /save/i
|
|
69
69
|
});
|
|
70
70
|
expect(saveButton).toBeDisabled();
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
|
-
it(
|
|
73
|
+
it('shows Default Retention fields when Object Lock is enabled', async ()=>{
|
|
74
74
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
75
75
|
data: {
|
|
76
76
|
ObjectLockConfiguration: {
|
|
77
|
-
ObjectLockEnabled:
|
|
77
|
+
ObjectLockEnabled: 'Enabled'
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
-
status:
|
|
80
|
+
status: 'success'
|
|
81
81
|
});
|
|
82
82
|
renderObjectLockSettings();
|
|
83
83
|
await waitFor(()=>{
|
|
84
|
-
expect(screen.getByText(
|
|
85
|
-
expect(screen.getByText(
|
|
86
|
-
expect(screen.getByText(
|
|
84
|
+
expect(screen.getByText('Default Retention')).toBeInTheDocument();
|
|
85
|
+
expect(screen.getByText('Retention mode')).toBeInTheDocument();
|
|
86
|
+
expect(screen.getByText('Retention period')).toBeInTheDocument();
|
|
87
87
|
}, {
|
|
88
88
|
timeout: 3000
|
|
89
89
|
});
|
|
90
90
|
});
|
|
91
|
-
it(
|
|
91
|
+
it('enables save button when Object Lock is enabled', async ()=>{
|
|
92
92
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
93
93
|
data: {
|
|
94
94
|
ObjectLockConfiguration: {
|
|
95
|
-
ObjectLockEnabled:
|
|
95
|
+
ObjectLockEnabled: 'Enabled'
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
status:
|
|
98
|
+
status: 'success'
|
|
99
99
|
});
|
|
100
100
|
renderObjectLockSettings();
|
|
101
101
|
await waitFor(()=>{
|
|
102
|
-
const saveButton = screen.getByRole(
|
|
102
|
+
const saveButton = screen.getByRole('button', {
|
|
103
103
|
name: /save/i
|
|
104
104
|
});
|
|
105
105
|
expect(saveButton).toBeEnabled();
|
|
@@ -107,18 +107,18 @@ describe("ObjectLockSettings", ()=>{
|
|
|
107
107
|
timeout: 3000
|
|
108
108
|
});
|
|
109
109
|
});
|
|
110
|
-
it(
|
|
110
|
+
it('enables retention fields when Default Retention is checked', async ()=>{
|
|
111
111
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
112
112
|
data: {
|
|
113
113
|
ObjectLockConfiguration: {
|
|
114
|
-
ObjectLockEnabled:
|
|
114
|
+
ObjectLockEnabled: 'Enabled'
|
|
115
115
|
}
|
|
116
116
|
},
|
|
117
|
-
status:
|
|
117
|
+
status: 'success'
|
|
118
118
|
});
|
|
119
119
|
renderObjectLockSettings();
|
|
120
120
|
await waitFor(()=>{
|
|
121
|
-
expect(screen.getByText(
|
|
121
|
+
expect(screen.getByText('Default Retention')).toBeInTheDocument();
|
|
122
122
|
});
|
|
123
123
|
const defaultRetentionCheckbox = screen.getByLabelText(/default retention/i);
|
|
124
124
|
expect(defaultRetentionCheckbox).not.toBeChecked();
|
|
@@ -130,20 +130,20 @@ describe("ObjectLockSettings", ()=>{
|
|
|
130
130
|
timeout: 3000
|
|
131
131
|
});
|
|
132
132
|
});
|
|
133
|
-
it(
|
|
133
|
+
it('disables retention fields when Default Retention is unchecked', async ()=>{
|
|
134
134
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
135
135
|
data: {
|
|
136
136
|
ObjectLockConfiguration: {
|
|
137
|
-
ObjectLockEnabled:
|
|
137
|
+
ObjectLockEnabled: 'Enabled',
|
|
138
138
|
Rule: {
|
|
139
139
|
DefaultRetention: {
|
|
140
|
-
Mode:
|
|
140
|
+
Mode: 'GOVERNANCE',
|
|
141
141
|
Days: 30
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
|
-
status:
|
|
146
|
+
status: 'success'
|
|
147
147
|
});
|
|
148
148
|
renderObjectLockSettings();
|
|
149
149
|
await waitFor(()=>{
|
|
@@ -155,18 +155,18 @@ describe("ObjectLockSettings", ()=>{
|
|
|
155
155
|
expect(governanceRadio).toBeDisabled();
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
|
-
it(
|
|
158
|
+
it('shows validation error when retention period is invalid', async ()=>{
|
|
159
159
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
160
160
|
data: {
|
|
161
161
|
ObjectLockConfiguration: {
|
|
162
|
-
ObjectLockEnabled:
|
|
162
|
+
ObjectLockEnabled: 'Enabled'
|
|
163
163
|
}
|
|
164
164
|
},
|
|
165
|
-
status:
|
|
165
|
+
status: 'success'
|
|
166
166
|
});
|
|
167
167
|
renderObjectLockSettings();
|
|
168
168
|
await waitFor(()=>{
|
|
169
|
-
expect(screen.getByText(
|
|
169
|
+
expect(screen.getByText('Default Retention')).toBeInTheDocument();
|
|
170
170
|
});
|
|
171
171
|
const defaultRetentionCheckbox = screen.getByLabelText(/default retention/i);
|
|
172
172
|
fireEvent.click(defaultRetentionCheckbox);
|
|
@@ -176,9 +176,9 @@ describe("ObjectLockSettings", ()=>{
|
|
|
176
176
|
});
|
|
177
177
|
const retentionPeriodInput = screen.getByLabelText(/retention period/i);
|
|
178
178
|
await user_event.clear(retentionPeriodInput);
|
|
179
|
-
await user_event.type(retentionPeriodInput,
|
|
179
|
+
await user_event.type(retentionPeriodInput, '0');
|
|
180
180
|
await waitFor(()=>{
|
|
181
|
-
const saveButton = screen.getByRole(
|
|
181
|
+
const saveButton = screen.getByRole('button', {
|
|
182
182
|
name: /save/i
|
|
183
183
|
});
|
|
184
184
|
expect(saveButton).toBeDisabled();
|
|
@@ -186,18 +186,18 @@ describe("ObjectLockSettings", ()=>{
|
|
|
186
186
|
timeout: 3000
|
|
187
187
|
});
|
|
188
188
|
});
|
|
189
|
-
it(
|
|
189
|
+
it('saves Object Lock configuration with Default Retention and navigates on success', async ()=>{
|
|
190
190
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
191
191
|
data: {
|
|
192
192
|
ObjectLockConfiguration: {
|
|
193
|
-
ObjectLockEnabled:
|
|
193
|
+
ObjectLockEnabled: 'Enabled'
|
|
194
194
|
}
|
|
195
195
|
},
|
|
196
|
-
status:
|
|
196
|
+
status: 'success'
|
|
197
197
|
});
|
|
198
198
|
renderObjectLockSettings();
|
|
199
199
|
await waitFor(()=>{
|
|
200
|
-
expect(screen.getByText(
|
|
200
|
+
expect(screen.getByText('Default Retention')).toBeInTheDocument();
|
|
201
201
|
});
|
|
202
202
|
const defaultRetentionCheckbox = screen.getByLabelText(/default retention/i);
|
|
203
203
|
fireEvent.click(defaultRetentionCheckbox);
|
|
@@ -207,13 +207,13 @@ describe("ObjectLockSettings", ()=>{
|
|
|
207
207
|
});
|
|
208
208
|
const retentionPeriodInput = screen.getByLabelText(/retention period/i);
|
|
209
209
|
await user_event.clear(retentionPeriodInput);
|
|
210
|
-
await user_event.type(retentionPeriodInput,
|
|
210
|
+
await user_event.type(retentionPeriodInput, '30');
|
|
211
211
|
const governanceRadio = screen.getByLabelText(/governance/i);
|
|
212
212
|
fireEvent.click(governanceRadio);
|
|
213
213
|
mockMutate.mockImplementation((_, options)=>{
|
|
214
214
|
options?.onSuccess?.();
|
|
215
215
|
});
|
|
216
|
-
const saveButton = screen.getByRole(
|
|
216
|
+
const saveButton = screen.getByRole('button', {
|
|
217
217
|
name: /save/i
|
|
218
218
|
});
|
|
219
219
|
await waitFor(()=>expect(saveButton).toBeEnabled(), {
|
|
@@ -223,25 +223,25 @@ describe("ObjectLockSettings", ()=>{
|
|
|
223
223
|
await waitFor(()=>{
|
|
224
224
|
expect(mockMutate).toHaveBeenCalled();
|
|
225
225
|
const callArgs = mockMutate.mock.calls[0][0];
|
|
226
|
-
expect(callArgs.Bucket).toBe(
|
|
227
|
-
expect(callArgs.ObjectLockConfiguration.ObjectLockEnabled).toBe(
|
|
228
|
-
expect(callArgs.ObjectLockConfiguration.Rule.DefaultRetention.Mode).toBe(
|
|
226
|
+
expect(callArgs.Bucket).toBe('test-bucket');
|
|
227
|
+
expect(callArgs.ObjectLockConfiguration.ObjectLockEnabled).toBe('Enabled');
|
|
228
|
+
expect(callArgs.ObjectLockConfiguration.Rule.DefaultRetention.Mode).toBe('GOVERNANCE');
|
|
229
229
|
expect(callArgs.ObjectLockConfiguration.Rule.DefaultRetention.Days || callArgs.ObjectLockConfiguration.Rule.DefaultRetention.Years).toBe(30);
|
|
230
|
-
expect(mockNavigate).toHaveBeenCalledWith(
|
|
230
|
+
expect(mockNavigate).toHaveBeenCalledWith('/buckets/test-bucket');
|
|
231
231
|
});
|
|
232
232
|
});
|
|
233
|
-
it(
|
|
233
|
+
it('saves Object Lock configuration with Years frequency', async ()=>{
|
|
234
234
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
235
235
|
data: {
|
|
236
236
|
ObjectLockConfiguration: {
|
|
237
|
-
ObjectLockEnabled:
|
|
237
|
+
ObjectLockEnabled: 'Enabled'
|
|
238
238
|
}
|
|
239
239
|
},
|
|
240
|
-
status:
|
|
240
|
+
status: 'success'
|
|
241
241
|
});
|
|
242
242
|
renderObjectLockSettings();
|
|
243
243
|
await waitFor(()=>{
|
|
244
|
-
expect(screen.getByText(
|
|
244
|
+
expect(screen.getByText('Default Retention')).toBeInTheDocument();
|
|
245
245
|
});
|
|
246
246
|
const defaultRetentionCheckbox = screen.getByLabelText(/default retention/i);
|
|
247
247
|
fireEvent.click(defaultRetentionCheckbox);
|
|
@@ -251,11 +251,11 @@ describe("ObjectLockSettings", ()=>{
|
|
|
251
251
|
});
|
|
252
252
|
const retentionPeriodInput = screen.getByLabelText(/retention period/i);
|
|
253
253
|
await user_event.clear(retentionPeriodInput);
|
|
254
|
-
await user_event.type(retentionPeriodInput,
|
|
254
|
+
await user_event.type(retentionPeriodInput, '2');
|
|
255
255
|
mockMutate.mockImplementation((_, options)=>{
|
|
256
256
|
options?.onSuccess?.();
|
|
257
257
|
});
|
|
258
|
-
const saveButton = screen.getByRole(
|
|
258
|
+
const saveButton = screen.getByRole('button', {
|
|
259
259
|
name: /save/i
|
|
260
260
|
});
|
|
261
261
|
await waitFor(()=>expect(saveButton).toBeEnabled(), {
|
|
@@ -265,24 +265,24 @@ describe("ObjectLockSettings", ()=>{
|
|
|
265
265
|
await waitFor(()=>{
|
|
266
266
|
expect(mockMutate).toHaveBeenCalled();
|
|
267
267
|
const callArgs = mockMutate.mock.calls[0][0];
|
|
268
|
-
expect(callArgs.Bucket).toBe(
|
|
269
|
-
expect(callArgs.ObjectLockConfiguration.ObjectLockEnabled).toBe(
|
|
270
|
-
expect(callArgs.ObjectLockConfiguration.Rule.DefaultRetention.Mode).toBe(
|
|
268
|
+
expect(callArgs.Bucket).toBe('test-bucket');
|
|
269
|
+
expect(callArgs.ObjectLockConfiguration.ObjectLockEnabled).toBe('Enabled');
|
|
270
|
+
expect(callArgs.ObjectLockConfiguration.Rule.DefaultRetention.Mode).toBe('GOVERNANCE');
|
|
271
271
|
expect(callArgs.ObjectLockConfiguration.Rule.DefaultRetention.Days || callArgs.ObjectLockConfiguration.Rule.DefaultRetention.Years).toBe(2);
|
|
272
272
|
});
|
|
273
273
|
});
|
|
274
|
-
it(
|
|
274
|
+
it('saves Object Lock configuration without Default Retention', async ()=>{
|
|
275
275
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
276
276
|
data: {
|
|
277
277
|
ObjectLockConfiguration: {
|
|
278
|
-
ObjectLockEnabled:
|
|
278
|
+
ObjectLockEnabled: 'Enabled'
|
|
279
279
|
}
|
|
280
280
|
},
|
|
281
|
-
status:
|
|
281
|
+
status: 'success'
|
|
282
282
|
});
|
|
283
283
|
renderObjectLockSettings();
|
|
284
284
|
await waitFor(()=>{
|
|
285
|
-
const saveButton = screen.getByRole(
|
|
285
|
+
const saveButton = screen.getByRole('button', {
|
|
286
286
|
name: /save/i
|
|
287
287
|
});
|
|
288
288
|
expect(saveButton).toBeEnabled();
|
|
@@ -292,41 +292,41 @@ describe("ObjectLockSettings", ()=>{
|
|
|
292
292
|
mockMutate.mockImplementation((_, options)=>{
|
|
293
293
|
options?.onSuccess?.();
|
|
294
294
|
});
|
|
295
|
-
const saveButton = screen.getByRole(
|
|
295
|
+
const saveButton = screen.getByRole('button', {
|
|
296
296
|
name: /save/i
|
|
297
297
|
});
|
|
298
298
|
fireEvent.click(saveButton);
|
|
299
299
|
await waitFor(()=>{
|
|
300
300
|
expect(mockMutate).toHaveBeenCalled();
|
|
301
301
|
const callArgs = mockMutate.mock.calls[0][0];
|
|
302
|
-
expect(callArgs.Bucket).toBe(
|
|
303
|
-
expect(callArgs.ObjectLockConfiguration.ObjectLockEnabled).toBe(
|
|
302
|
+
expect(callArgs.Bucket).toBe('test-bucket');
|
|
303
|
+
expect(callArgs.ObjectLockConfiguration.ObjectLockEnabled).toBe('Enabled');
|
|
304
304
|
expect(callArgs.ObjectLockConfiguration.Rule).toBeUndefined();
|
|
305
305
|
});
|
|
306
306
|
});
|
|
307
|
-
it(
|
|
307
|
+
it('displays error toast when save fails', async ()=>{
|
|
308
308
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
309
309
|
data: {
|
|
310
310
|
ObjectLockConfiguration: {
|
|
311
|
-
ObjectLockEnabled:
|
|
311
|
+
ObjectLockEnabled: 'Enabled'
|
|
312
312
|
}
|
|
313
313
|
},
|
|
314
|
-
status:
|
|
314
|
+
status: 'success'
|
|
315
315
|
});
|
|
316
316
|
renderObjectLockSettings();
|
|
317
317
|
await waitFor(()=>{
|
|
318
|
-
const saveButton = screen.getByRole(
|
|
318
|
+
const saveButton = screen.getByRole('button', {
|
|
319
319
|
name: /save/i
|
|
320
320
|
});
|
|
321
321
|
expect(saveButton).toBeEnabled();
|
|
322
322
|
}, {
|
|
323
323
|
timeout: 3000
|
|
324
324
|
});
|
|
325
|
-
const error = new Error(
|
|
325
|
+
const error = new Error('Access Denied');
|
|
326
326
|
mockMutate.mockImplementation((_, options)=>{
|
|
327
327
|
options?.onError?.(error);
|
|
328
328
|
});
|
|
329
|
-
const saveButton = screen.getByRole(
|
|
329
|
+
const saveButton = screen.getByRole('button', {
|
|
330
330
|
name: /save/i
|
|
331
331
|
});
|
|
332
332
|
fireEvent.click(saveButton);
|
|
@@ -334,30 +334,30 @@ describe("ObjectLockSettings", ()=>{
|
|
|
334
334
|
expect(mockNavigate).not.toHaveBeenCalled();
|
|
335
335
|
});
|
|
336
336
|
});
|
|
337
|
-
it(
|
|
337
|
+
it('navigates back when cancel button is clicked', async ()=>{
|
|
338
338
|
renderObjectLockSettings();
|
|
339
339
|
await waitFor(()=>{
|
|
340
|
-
const cancelButton = screen.getByRole(
|
|
340
|
+
const cancelButton = screen.getByRole('button', {
|
|
341
341
|
name: /cancel/i
|
|
342
342
|
});
|
|
343
343
|
fireEvent.click(cancelButton);
|
|
344
344
|
});
|
|
345
|
-
expect(mockNavigate).toHaveBeenCalledWith(
|
|
345
|
+
expect(mockNavigate).toHaveBeenCalledWith('/buckets/test-bucket');
|
|
346
346
|
});
|
|
347
|
-
it(
|
|
347
|
+
it('populates form with existing bucket configuration', async ()=>{
|
|
348
348
|
mockUseGetBucketObjectLockConfiguration.mockReturnValue({
|
|
349
349
|
data: {
|
|
350
350
|
ObjectLockConfiguration: {
|
|
351
|
-
ObjectLockEnabled:
|
|
351
|
+
ObjectLockEnabled: 'Enabled',
|
|
352
352
|
Rule: {
|
|
353
353
|
DefaultRetention: {
|
|
354
|
-
Mode:
|
|
354
|
+
Mode: 'COMPLIANCE',
|
|
355
355
|
Days: 60
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
359
|
},
|
|
360
|
-
status:
|
|
360
|
+
status: 'success'
|
|
361
361
|
});
|
|
362
362
|
renderObjectLockSettings();
|
|
363
363
|
await waitFor(()=>{
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useNavigate, useParams, useSearchParams } from "react-router-dom";
|
|
3
2
|
import { useCallback, useState } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { useParams, useSearchParams } from "react-router";
|
|
4
|
+
import { useDataBrowserNavigate } from "../../hooks/useDataBrowserNavigate.js";
|
|
6
5
|
import { BrowserPageLayout } from "../layouts/BrowserPageLayout.js";
|
|
6
|
+
import { ObjectDetails } from "./ObjectDetails/index.js";
|
|
7
|
+
import { ObjectList } from "./ObjectList.js";
|
|
7
8
|
const ObjectPage = ()=>{
|
|
8
9
|
const { bucketName } = useParams();
|
|
9
|
-
const navigate =
|
|
10
|
+
const navigate = useDataBrowserNavigate();
|
|
10
11
|
const [searchParams] = useSearchParams();
|
|
11
12
|
const [item, setItem] = useState(null);
|
|
12
|
-
const prefix = searchParams.get(
|
|
13
|
+
const prefix = searchParams.get('prefix') || '';
|
|
13
14
|
const handlePrefixChange = useCallback((newPrefix)=>{
|
|
14
15
|
const newSearchParams = new URLSearchParams(searchParams);
|
|
15
|
-
newSearchParams.set(
|
|
16
|
+
newSearchParams.set('prefix', newPrefix);
|
|
16
17
|
setItem(null);
|
|
17
18
|
navigate(`?${newSearchParams.toString()}`, {
|
|
18
19
|
replace: true
|
|
@@ -28,6 +29,7 @@ const ObjectPage = ()=>{
|
|
|
28
29
|
setItem(object);
|
|
29
30
|
};
|
|
30
31
|
return /*#__PURE__*/ jsx(BrowserPageLayout, {
|
|
32
|
+
iconName: "Bucket",
|
|
31
33
|
title: bucketName,
|
|
32
34
|
leftPanel: /*#__PURE__*/ jsx(ObjectList, {
|
|
33
35
|
bucketName: bucketName,
|
|
@@ -35,9 +37,11 @@ const ObjectPage = ()=>{
|
|
|
35
37
|
onObjectSelect: handleObjectSelect,
|
|
36
38
|
onPrefixChange: handlePrefixChange
|
|
37
39
|
}),
|
|
38
|
-
rightPanel:
|
|
40
|
+
rightPanel: /*#__PURE__*/ jsx(ObjectDetails, {
|
|
39
41
|
item: item
|
|
40
|
-
})
|
|
42
|
+
}),
|
|
43
|
+
withArrowNavigation: true,
|
|
44
|
+
arrowNavigationPath: `/buckets/${bucketName}`
|
|
41
45
|
});
|
|
42
46
|
};
|
|
43
47
|
export { ObjectPage };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type
|
|
1
|
+
import type { PutObjectCommandInput } from '@aws-sdk/client-s3';
|
|
2
|
+
import type React from 'react';
|
|
3
3
|
interface UploadButtonProps {
|
|
4
4
|
/**
|
|
5
5
|
* The S3 bucket name where files will be uploaded
|
|
@@ -16,7 +16,7 @@ interface UploadButtonProps {
|
|
|
16
16
|
/**
|
|
17
17
|
* Button variant
|
|
18
18
|
*/
|
|
19
|
-
variant?:
|
|
19
|
+
variant?: 'primary' | 'secondary' | 'outline';
|
|
20
20
|
/**
|
|
21
21
|
* Upload options to configure metadata, encryption, etc.
|
|
22
22
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useState } from "react";
|
|
3
|
-
import { useDropzone } from "react-dropzone";
|
|
4
2
|
import { Icon, Modal, PrettyBytes, Stack, Wrap, spacing } from "@scality/core-ui";
|
|
5
3
|
import { Button } from "@scality/core-ui/dist/components/buttonv2/Buttonv2.component";
|
|
4
|
+
import { useCallback, useState } from "react";
|
|
5
|
+
import { useDropzone } from "react-dropzone";
|
|
6
6
|
import styled_components from "styled-components";
|
|
7
7
|
import { useUploadObjects } from "../../hooks/index.js";
|
|
8
8
|
const DropZone = styled_components.div`
|
|
@@ -51,7 +51,7 @@ const RemoveButton = styled_components.button`
|
|
|
51
51
|
}
|
|
52
52
|
`;
|
|
53
53
|
const maybePluralize = (count, word)=>1 === count ? `1 ${word}` : `${count} ${word}s`;
|
|
54
|
-
const getTitle = (fileCount)=>0 === fileCount ?
|
|
54
|
+
const getTitle = (fileCount)=>0 === fileCount ? 'Upload Files' : `Upload ${maybePluralize(fileCount, 'file')}`;
|
|
55
55
|
const FileList = ({ acceptedFiles, open, removeFile })=>/*#__PURE__*/ jsxs("div", {
|
|
56
56
|
children: [
|
|
57
57
|
/*#__PURE__*/ jsx(Button, {
|
|
@@ -111,7 +111,7 @@ const NoFile = ({ open })=>/*#__PURE__*/ jsxs(EmptyFile, {
|
|
|
111
111
|
})
|
|
112
112
|
]
|
|
113
113
|
});
|
|
114
|
-
const
|
|
114
|
+
const UploadButton = ({ bucket, prefix = '', uploadOptions = {}, onUploadSuccess, onUploadError })=>{
|
|
115
115
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
116
116
|
const [acceptedFiles, setAcceptedFiles] = useState([]);
|
|
117
117
|
const uploadMutation = useUploadObjects();
|
|
@@ -177,8 +177,8 @@ const UploadButton_UploadButton = ({ bucket, prefix = "", uploadOptions = {}, on
|
|
|
177
177
|
icon: /*#__PURE__*/ jsx(Icon, {
|
|
178
178
|
name: "Simple-upload"
|
|
179
179
|
}),
|
|
180
|
-
label:
|
|
181
|
-
variant:
|
|
180
|
+
label: 'Upload',
|
|
181
|
+
variant: 'secondary',
|
|
182
182
|
onClick: openModal
|
|
183
183
|
}),
|
|
184
184
|
isModalOpen && /*#__PURE__*/ jsx(Modal, {
|
|
@@ -196,9 +196,9 @@ const UploadButton_UploadButton = ({ bucket, prefix = "", uploadOptions = {}, on
|
|
|
196
196
|
}),
|
|
197
197
|
/*#__PURE__*/ jsx(Button, {
|
|
198
198
|
disabled: 0 === acceptedFiles.length || uploadMutation.isPending,
|
|
199
|
-
variant: "
|
|
199
|
+
variant: "primary",
|
|
200
200
|
onClick: handleUpload,
|
|
201
|
-
label: uploadMutation.isPending ?
|
|
201
|
+
label: uploadMutation.isPending ? 'Uploading...' : 'Upload'
|
|
202
202
|
})
|
|
203
203
|
]
|
|
204
204
|
})
|
|
@@ -225,5 +225,5 @@ const UploadButton_UploadButton = ({ bucket, prefix = "", uploadOptions = {}, on
|
|
|
225
225
|
]
|
|
226
226
|
});
|
|
227
227
|
};
|
|
228
|
-
const
|
|
229
|
-
export {
|
|
228
|
+
const objects_UploadButton = UploadButton;
|
|
229
|
+
export { UploadButton, objects_UploadButton as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|