@scality/data-browser-library 1.0.0-preview.11
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/Editor.d.ts +12 -0
- package/dist/components/Editor.js +28 -0
- 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.d.ts +1 -0
- package/dist/components/__tests__/BucketList.test.js +415 -0
- package/dist/components/__tests__/BucketNotificationCreatePage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +316 -0
- package/dist/components/__tests__/BucketOverview.test.d.ts +1 -0
- package/dist/components/__tests__/BucketOverview.test.js +769 -0
- package/dist/components/__tests__/BucketPolicyPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketPolicyPage.test.js +268 -0
- 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__/CreateFolderButton.test.d.ts +1 -0
- package/dist/components/__tests__/CreateFolderButton.test.js +147 -0
- package/dist/components/__tests__/DeleteBucketButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteBucketButton.test.js +272 -0
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +196 -0
- package/dist/components/__tests__/DeleteObjectButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteObjectButton.test.js +302 -0
- package/dist/components/__tests__/EmptyBucketButton.test.d.ts +1 -0
- package/dist/components/__tests__/EmptyBucketButton.test.js +302 -0
- package/dist/components/__tests__/MetadataSearch.test.d.ts +1 -0
- package/dist/components/__tests__/MetadataSearch.test.js +201 -0
- package/dist/components/__tests__/ObjectList.test.d.ts +1 -0
- package/dist/components/__tests__/ObjectList.test.js +283 -0
- package/dist/components/__tests__/UploadButton.test.d.ts +1 -0
- package/dist/components/__tests__/UploadButton.test.js +144 -0
- package/dist/components/buckets/BucketCreate.d.ts +49 -0
- package/dist/components/buckets/BucketCreate.js +237 -0
- package/dist/components/buckets/BucketDetails.d.ts +1 -0
- package/dist/components/buckets/BucketDetails.js +106 -0
- package/dist/components/buckets/BucketLifecycleFormPage.d.ts +15 -0
- package/dist/components/buckets/BucketLifecycleFormPage.js +1085 -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 +15 -0
- package/dist/components/buckets/BucketList.js +146 -0
- package/dist/components/buckets/BucketLocation.d.ts +3 -0
- package/dist/components/buckets/BucketLocation.js +16 -0
- package/dist/components/buckets/BucketOverview.d.ts +88 -0
- package/dist/components/buckets/BucketOverview.js +291 -0
- package/dist/components/buckets/BucketPage.d.ts +2 -0
- package/dist/components/buckets/BucketPage.js +47 -0
- package/dist/components/buckets/BucketPolicyButton.d.ts +7 -0
- package/dist/components/buckets/BucketPolicyButton.js +18 -0
- package/dist/components/buckets/BucketPolicyPage.d.ts +1 -0
- package/dist/components/buckets/BucketPolicyPage.js +236 -0
- 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/BucketVersioning.d.ts +4 -0
- package/dist/components/buckets/BucketVersioning.js +73 -0
- package/dist/components/buckets/DeleteBucketButton.d.ts +8 -0
- package/dist/components/buckets/DeleteBucketButton.js +78 -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/buckets/__tests__/BucketVersioning.test.d.ts +1 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.js +163 -0
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.d.ts +1 -0
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +234 -0
- package/dist/components/buckets/notifications/EventsSection.d.ts +1 -0
- package/dist/components/buckets/notifications/EventsSection.js +123 -0
- package/dist/components/buckets/notifications/events.d.ts +12 -0
- package/dist/components/buckets/notifications/events.js +27 -0
- package/dist/components/index.d.ts +21 -0
- package/dist/components/index.js +22 -0
- package/dist/components/layouts/ArrowNavigation.d.ts +4 -0
- package/dist/components/layouts/ArrowNavigation.js +16 -0
- package/dist/components/layouts/BrowserPageLayout.d.ts +12 -0
- package/dist/components/layouts/BrowserPageLayout.js +51 -0
- package/dist/components/objects/CreateFolderButton.d.ts +29 -0
- package/dist/components/objects/CreateFolderButton.js +118 -0
- package/dist/components/objects/DeleteObjectButton.d.ts +8 -0
- package/dist/components/objects/DeleteObjectButton.js +191 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +2 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.js +356 -0
- package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +3 -0
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +241 -0
- package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +3 -0
- package/dist/components/objects/ObjectDetails/ObjectTags.js +272 -0
- package/dist/components/objects/ObjectDetails/index.d.ts +9 -0
- package/dist/components/objects/ObjectDetails/index.js +75 -0
- package/dist/components/objects/ObjectList.d.ts +40 -0
- package/dist/components/objects/ObjectList.js +453 -0
- 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/objects/ObjectPage.d.ts +1 -0
- package/dist/components/objects/ObjectPage.js +45 -0
- package/dist/components/objects/UploadButton.d.ts +34 -0
- package/dist/components/objects/UploadButton.js +229 -0
- package/dist/components/providers/DataBrowserProvider.d.ts +20 -0
- package/dist/components/providers/DataBrowserProvider.js +42 -0
- package/dist/components/search/MetadataSearch.d.ts +5 -0
- package/dist/components/search/MetadataSearch.js +162 -0
- package/dist/components/search/SearchHints.d.ts +8 -0
- package/dist/components/search/SearchHints.js +21 -0
- package/dist/components/ui/ArrayFieldActions.d.ts +36 -0
- package/dist/components/ui/ArrayFieldActions.js +43 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +16 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.js +43 -0
- package/dist/components/ui/DeleteObjectModalContent.d.ts +5 -0
- package/dist/components/ui/DeleteObjectModalContent.js +71 -0
- package/dist/components/ui/FilterFormSection.d.ts +44 -0
- package/dist/components/ui/FilterFormSection.js +159 -0
- package/dist/components/ui/Search.elements.d.ts +17 -0
- package/dist/components/ui/Search.elements.js +59 -0
- package/dist/components/ui/Table.elements.d.ts +36 -0
- package/dist/components/ui/Table.elements.js +87 -0
- package/dist/config/factory.d.ts +63 -0
- package/dist/config/factory.js +74 -0
- package/dist/config/types.d.ts +46 -0
- package/dist/config/types.js +0 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.d.ts +1 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.js +188 -0
- package/dist/hooks/__tests__/useIsBucketEmpty.test.d.ts +1 -0
- package/dist/hooks/__tests__/useIsBucketEmpty.test.js +122 -0
- package/dist/hooks/bucketConfiguration.d.ts +168 -0
- package/dist/hooks/bucketConfiguration.js +67 -0
- package/dist/hooks/bucketOperations.d.ts +36 -0
- package/dist/hooks/bucketOperations.js +12 -0
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +276 -0
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +259 -0
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +166 -0
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +200 -0
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.d.ts +1 -0
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +179 -0
- package/dist/hooks/factories/index.d.ts +18 -0
- package/dist/hooks/factories/index.js +5 -0
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +13 -0
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +76 -0
- package/dist/hooks/factories/useCreateS3LoginHook.d.ts +8 -0
- package/dist/hooks/factories/useCreateS3LoginHook.js +22 -0
- package/dist/hooks/factories/useCreateS3MutationHook.d.ts +5 -0
- package/dist/hooks/factories/useCreateS3MutationHook.js +50 -0
- package/dist/hooks/factories/useCreateS3QueryHook.d.ts +3 -0
- package/dist/hooks/factories/useCreateS3QueryHook.js +51 -0
- package/dist/hooks/index.d.ts +13 -0
- package/dist/hooks/index.js +13 -0
- package/dist/hooks/loginOperations.d.ts +21 -0
- package/dist/hooks/loginOperations.js +9 -0
- package/dist/hooks/objectOperations.d.ts +190 -0
- package/dist/hooks/objectOperations.js +67 -0
- package/dist/hooks/presignedOperations.d.ts +73 -0
- package/dist/hooks/presignedOperations.js +72 -0
- package/dist/hooks/useBatchObjectLegalHold.d.ts +11 -0
- package/dist/hooks/useBatchObjectLegalHold.js +45 -0
- 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/useIsBucketEmpty.d.ts +7 -0
- package/dist/hooks/useIsBucketEmpty.js +36 -0
- package/dist/hooks/useLoginMutation.d.ts +21 -0
- package/dist/hooks/useLoginMutation.js +9 -0
- package/dist/hooks/useS3Client.d.ts +1 -0
- package/dist/hooks/useS3Client.js +13 -0
- package/dist/hooks/useTableRowSelection.d.ts +9 -0
- package/dist/hooks/useTableRowSelection.js +45 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +6 -0
- package/dist/schemas/bucketPolicySchema.json +321 -0
- package/dist/test/msw/handlers/deleteBucket.d.ts +1 -0
- package/dist/test/msw/handlers/deleteBucket.js +14 -0
- package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -0
- package/dist/test/msw/handlers/getBucketAcl.js +96 -0
- package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -0
- package/dist/test/msw/handlers/getBucketLocation.js +23 -0
- package/dist/test/msw/handlers/getBucketPolicy.d.ts +11 -0
- package/dist/test/msw/handlers/getBucketPolicy.js +72 -0
- package/dist/test/msw/handlers/headObject.d.ts +1 -0
- package/dist/test/msw/handlers/headObject.js +17 -0
- package/dist/test/msw/handlers/listBuckets.d.ts +1 -0
- package/dist/test/msw/handlers/listBuckets.js +24 -0
- package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -0
- package/dist/test/msw/handlers/listObjectVersions.js +83 -0
- package/dist/test/msw/handlers/listObjects.d.ts +1 -0
- package/dist/test/msw/handlers/listObjects.js +66 -0
- package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -0
- package/dist/test/msw/handlers/objectLegalHold.js +24 -0
- package/dist/test/msw/handlers/objectRetention.d.ts +1 -0
- package/dist/test/msw/handlers/objectRetention.js +27 -0
- package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -0
- package/dist/test/msw/handlers/putBucketAcl.js +18 -0
- package/dist/test/msw/handlers/putObject.d.ts +1 -0
- package/dist/test/msw/handlers/putObject.js +16 -0
- package/dist/test/msw/handlers.d.ts +4 -0
- package/dist/test/msw/handlers.js +109 -0
- package/dist/test/msw/index.d.ts +2 -0
- package/dist/test/msw/index.js +3 -0
- package/dist/test/msw/server.d.ts +4 -0
- package/dist/test/msw/server.js +20 -0
- package/dist/test/msw/utils.d.ts +2 -0
- package/dist/test/msw/utils.js +13 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.js +90 -0
- package/dist/test/testUtils.d.ts +181 -0
- package/dist/test/testUtils.js +310 -0
- package/dist/test/utils/errorHandling.test.d.ts +1 -0
- package/dist/test/utils/errorHandling.test.js +423 -0
- package/dist/types/index.d.ts +51 -0
- package/dist/types/index.js +0 -0
- package/dist/utils/constants.d.ts +12 -0
- package/dist/utils/constants.js +9 -0
- package/dist/utils/deletion/index.d.ts +2 -0
- package/dist/utils/deletion/index.js +2 -0
- package/dist/utils/deletion/messages.d.ts +5 -0
- package/dist/utils/deletion/messages.js +29 -0
- package/dist/utils/deletion/types.d.ts +11 -0
- package/dist/utils/deletion/types.js +0 -0
- package/dist/utils/errorHandling.d.ts +63 -0
- package/dist/utils/errorHandling.js +84 -0
- package/dist/utils/hooks.d.ts +2 -0
- package/dist/utils/hooks.js +26 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +4 -0
- package/dist/utils/proxyMiddleware.d.ts +18 -0
- package/dist/utils/proxyMiddleware.js +56 -0
- package/dist/utils/s3Client.d.ts +5 -0
- package/dist/utils/s3Client.js +36 -0
- package/dist/utils/s3RuleUtils.d.ts +53 -0
- package/dist/utils/s3RuleUtils.js +101 -0
- package/dist/utils/useFeatures.d.ts +1 -0
- package/dist/utils/useFeatures.js +7 -0
- package/package.json +84 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { GetConfigFunction } from "../../types";
|
|
4
|
+
import { CoreUITheme } from "@scality/core-ui/dist/style/theme";
|
|
5
|
+
export interface DataBrowserContextValue {
|
|
6
|
+
getS3Config: GetConfigFunction;
|
|
7
|
+
theme: CoreUITheme;
|
|
8
|
+
}
|
|
9
|
+
export declare const DataBrowserContext: React.Context<DataBrowserContextValue | null>;
|
|
10
|
+
export declare const useDataBrowserContext: () => DataBrowserContextValue;
|
|
11
|
+
export declare const useDataBrowserTheme: () => CoreUITheme;
|
|
12
|
+
interface DataBrowserProviderProps {
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
queryClient?: QueryClient;
|
|
15
|
+
enableDevtools?: boolean;
|
|
16
|
+
getS3Config?: GetConfigFunction;
|
|
17
|
+
theme?: CoreUITheme;
|
|
18
|
+
}
|
|
19
|
+
export declare const DataBrowserProvider: React.FC<DataBrowserProviderProps>;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
4
|
+
import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
|
|
5
|
+
const DataBrowserContext = /*#__PURE__*/ createContext(null);
|
|
6
|
+
const useDataBrowserContext = ()=>{
|
|
7
|
+
const context = useContext(DataBrowserContext);
|
|
8
|
+
if (!context) throw new Error("useDataBrowserContext must be used within a DataBrowserProvider component");
|
|
9
|
+
return context;
|
|
10
|
+
};
|
|
11
|
+
const useDataBrowserTheme = ()=>{
|
|
12
|
+
const { theme } = useDataBrowserContext();
|
|
13
|
+
return theme;
|
|
14
|
+
};
|
|
15
|
+
const defaultQueryClient = new QueryClient({
|
|
16
|
+
defaultOptions: {
|
|
17
|
+
queries: {
|
|
18
|
+
staleTime: 300000,
|
|
19
|
+
retry: 2
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const DataBrowserProvider = ({ children, queryClient = defaultQueryClient, enableDevtools = "development" === process.env.NODE_ENV, getS3Config, theme })=>{
|
|
24
|
+
const content = /*#__PURE__*/ jsxs(QueryClientProvider, {
|
|
25
|
+
client: queryClient,
|
|
26
|
+
children: [
|
|
27
|
+
children,
|
|
28
|
+
enableDevtools && /*#__PURE__*/ jsx(ReactQueryDevtools, {
|
|
29
|
+
initialIsOpen: false
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
});
|
|
33
|
+
if (getS3Config && theme) return /*#__PURE__*/ jsx(DataBrowserContext.Provider, {
|
|
34
|
+
value: {
|
|
35
|
+
getS3Config,
|
|
36
|
+
theme
|
|
37
|
+
},
|
|
38
|
+
children: content
|
|
39
|
+
});
|
|
40
|
+
return content;
|
|
41
|
+
};
|
|
42
|
+
export { DataBrowserContext, DataBrowserProvider, useDataBrowserContext, useDataBrowserTheme };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { usePrefixWithSlash, useQueryParams } from "../../utils/hooks.js";
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { useLocation, useNavigate } from "react-router-dom";
|
|
5
|
+
import { SearchContainer, SearchInputContainer, searchIcon } from "../ui/Search.elements.js";
|
|
6
|
+
import { Box, Button, Input } from "@scality/core-ui/dist/next";
|
|
7
|
+
import { Icon } from "@scality/core-ui";
|
|
8
|
+
import { SearchHints } from "./SearchHints.js";
|
|
9
|
+
const METADATA_SEARCH_HINT_ITEMS = [
|
|
10
|
+
{
|
|
11
|
+
label: 'files with extension ".pdf"',
|
|
12
|
+
query: "key like /pdf$/"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: "files bigger than 1MB",
|
|
16
|
+
query: "content-length > 1000000"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
label: "file names that contain scality (case insensitive)",
|
|
20
|
+
query: "key like /scality/i"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
label: "files with metadata field color set to green",
|
|
24
|
+
query: 'x-amz-meta-color="green"'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: "files tagged with color blue",
|
|
28
|
+
query: "tags.color=blue"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: "PDF files (from content-type)",
|
|
32
|
+
query: "content-type=application/pdf"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
label: "file names that contain the word Report (case sensitive)",
|
|
36
|
+
query: "key like Report"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: "files waiting to be replicated",
|
|
40
|
+
query: 'replication-status="PENDING"'
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
const MetadataSearch = ({ isError })=>{
|
|
44
|
+
const navigate = useNavigate();
|
|
45
|
+
const location = useLocation();
|
|
46
|
+
const query = useQueryParams();
|
|
47
|
+
const searchInput = query.get("metadatasearch");
|
|
48
|
+
const [inputText, setInputText] = useState(searchInput || "");
|
|
49
|
+
const [hintsShown, setHintsShown] = useState(false);
|
|
50
|
+
const prefixWithSlash = usePrefixWithSlash();
|
|
51
|
+
const inputRef = useRef(null);
|
|
52
|
+
const hintsRef = useRef(null);
|
|
53
|
+
const handleSubmit = useCallback((e)=>{
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
if (!inputText || prefixWithSlash) return;
|
|
56
|
+
const newQuery = new URLSearchParams(location.search);
|
|
57
|
+
newQuery.set("metadatasearch", inputText);
|
|
58
|
+
navigate(`${location.pathname}?${newQuery.toString()}`);
|
|
59
|
+
}, [
|
|
60
|
+
inputText,
|
|
61
|
+
prefixWithSlash,
|
|
62
|
+
location,
|
|
63
|
+
navigate
|
|
64
|
+
]);
|
|
65
|
+
const handleChange = useCallback((e)=>{
|
|
66
|
+
setInputText(e.target.value);
|
|
67
|
+
}, []);
|
|
68
|
+
const handleHintClicked = useCallback((queryText)=>{
|
|
69
|
+
setInputText(queryText);
|
|
70
|
+
setHintsShown(false);
|
|
71
|
+
}, []);
|
|
72
|
+
const handleInputClick = useCallback(()=>{
|
|
73
|
+
if (inputText || hintsShown) return;
|
|
74
|
+
setHintsShown(true);
|
|
75
|
+
}, [
|
|
76
|
+
inputText,
|
|
77
|
+
hintsShown
|
|
78
|
+
]);
|
|
79
|
+
useEffect(()=>{
|
|
80
|
+
const handleClickOutside = (event)=>{
|
|
81
|
+
if (hintsShown && inputRef.current && hintsRef.current && !inputRef.current.contains(event.target) && !hintsRef.current.contains(event.target)) setHintsShown(false);
|
|
82
|
+
};
|
|
83
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
84
|
+
return ()=>{
|
|
85
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
86
|
+
};
|
|
87
|
+
}, [
|
|
88
|
+
hintsShown
|
|
89
|
+
]);
|
|
90
|
+
const reset = useCallback(()=>{
|
|
91
|
+
setHintsShown(false);
|
|
92
|
+
setInputText("");
|
|
93
|
+
const newQuery = new URLSearchParams(location.search);
|
|
94
|
+
newQuery.delete("metadatasearch");
|
|
95
|
+
navigate(`${location.pathname}?${newQuery.toString()}`);
|
|
96
|
+
}, [
|
|
97
|
+
location,
|
|
98
|
+
navigate
|
|
99
|
+
]);
|
|
100
|
+
const handleHintClickWithFocus = useCallback((query)=>{
|
|
101
|
+
handleHintClicked(query);
|
|
102
|
+
if (inputRef.current) inputRef.current.focus();
|
|
103
|
+
}, [
|
|
104
|
+
handleHintClicked
|
|
105
|
+
]);
|
|
106
|
+
const isSearchDisabled = !inputText || !!prefixWithSlash;
|
|
107
|
+
const shouldShowHints = hintsShown && !inputText;
|
|
108
|
+
const shouldShowResetButton = !!inputText;
|
|
109
|
+
const leftIcon = searchIcon({
|
|
110
|
+
isMetadata: !!searchInput,
|
|
111
|
+
isError
|
|
112
|
+
});
|
|
113
|
+
return /*#__PURE__*/ jsxs(SearchContainer, {
|
|
114
|
+
isHidden: !!prefixWithSlash,
|
|
115
|
+
onSubmit: handleSubmit,
|
|
116
|
+
children: [
|
|
117
|
+
/*#__PURE__*/ jsxs(SearchInputContainer, {
|
|
118
|
+
children: [
|
|
119
|
+
/*#__PURE__*/ jsx(Input, {
|
|
120
|
+
id: "metadata-search-input",
|
|
121
|
+
ref: inputRef,
|
|
122
|
+
onChange: handleChange,
|
|
123
|
+
placeholder: "Metadata Search",
|
|
124
|
+
value: inputText,
|
|
125
|
+
onClick: handleInputClick,
|
|
126
|
+
leftIcon: leftIcon.name,
|
|
127
|
+
leftIconColor: leftIcon.color
|
|
128
|
+
}),
|
|
129
|
+
shouldShowResetButton && /*#__PURE__*/ jsx(Box, {
|
|
130
|
+
position: "absolute",
|
|
131
|
+
right: "1px",
|
|
132
|
+
top: "0px",
|
|
133
|
+
children: /*#__PURE__*/ jsx(Button, {
|
|
134
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
135
|
+
name: "Close"
|
|
136
|
+
}),
|
|
137
|
+
tooltip: {
|
|
138
|
+
overlay: "Reset search"
|
|
139
|
+
},
|
|
140
|
+
onClick: reset,
|
|
141
|
+
"aria-label": "Clear search input"
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
}),
|
|
146
|
+
shouldShowHints && /*#__PURE__*/ jsx(SearchHints, {
|
|
147
|
+
ref: hintsRef,
|
|
148
|
+
hints: METADATA_SEARCH_HINT_ITEMS,
|
|
149
|
+
onHintClick: handleHintClickWithFocus
|
|
150
|
+
}),
|
|
151
|
+
/*#__PURE__*/ jsx(Button, {
|
|
152
|
+
variant: "primary",
|
|
153
|
+
type: "submit",
|
|
154
|
+
label: "Search",
|
|
155
|
+
disabled: isSearchDisabled,
|
|
156
|
+
"aria-label": "Execute metadata search"
|
|
157
|
+
})
|
|
158
|
+
]
|
|
159
|
+
});
|
|
160
|
+
};
|
|
161
|
+
const search_MetadataSearch = MetadataSearch;
|
|
162
|
+
export { MetadataSearch, search_MetadataSearch as default };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SearchHintItem {
|
|
2
|
+
label: string;
|
|
3
|
+
query: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const SearchHints: import("react").ForwardRefExoticComponent<{
|
|
6
|
+
hints: SearchHintItem[];
|
|
7
|
+
onHintClick: (query: string) => void;
|
|
8
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { HintItem, HintsContainer, HintsTitle } from "../ui/Search.elements.js";
|
|
4
|
+
const SearchHints = /*#__PURE__*/ forwardRef(({ hints, onHintClick }, ref)=>/*#__PURE__*/ jsxs(HintsContainer, {
|
|
5
|
+
ref: ref,
|
|
6
|
+
role: "listbox",
|
|
7
|
+
"aria-label": "Suggestions",
|
|
8
|
+
children: [
|
|
9
|
+
/*#__PURE__*/ jsx(HintsTitle, {
|
|
10
|
+
children: "Suggestions"
|
|
11
|
+
}),
|
|
12
|
+
hints.map((item, index)=>/*#__PURE__*/ jsx(HintItem, {
|
|
13
|
+
onClick: ()=>onHintClick(item.query),
|
|
14
|
+
role: "option",
|
|
15
|
+
tabIndex: 0,
|
|
16
|
+
children: item.label
|
|
17
|
+
}, index))
|
|
18
|
+
]
|
|
19
|
+
}));
|
|
20
|
+
SearchHints.displayName = "SearchHints";
|
|
21
|
+
export { SearchHints };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type ArrayFieldActionsProps = {
|
|
2
|
+
/**
|
|
3
|
+
* Callback when remove button is clicked
|
|
4
|
+
*/
|
|
5
|
+
onRemove: () => void;
|
|
6
|
+
/**
|
|
7
|
+
* Callback when add button is clicked
|
|
8
|
+
* Only called if showAdd is true
|
|
9
|
+
*/
|
|
10
|
+
onAdd: () => void;
|
|
11
|
+
/**
|
|
12
|
+
* Whether the remove button should be enabled
|
|
13
|
+
*/
|
|
14
|
+
canRemove: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the add button should be enabled
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
canAdd?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Whether to show the add button
|
|
22
|
+
* Typically true only for the last item in the array
|
|
23
|
+
*/
|
|
24
|
+
showAdd: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Aria label for remove button
|
|
27
|
+
* @default "Remove"
|
|
28
|
+
*/
|
|
29
|
+
removeLabel?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Aria label for add button
|
|
32
|
+
* @default "Add"
|
|
33
|
+
*/
|
|
34
|
+
addLabel?: string;
|
|
35
|
+
};
|
|
36
|
+
export declare function ArrayFieldActions({ onRemove, onAdd, canRemove, canAdd, showAdd, removeLabel, addLabel, }: ArrayFieldActionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Button } from "@scality/core-ui/dist/next";
|
|
3
|
+
import { Icon, spacing } from "@scality/core-ui";
|
|
4
|
+
import { convertSizeToRem } from "@scality/core-ui/dist/components/inputv2/inputv2";
|
|
5
|
+
function ArrayFieldActions({ onRemove, onAdd, canRemove, canAdd = true, showAdd, removeLabel = "Remove", addLabel = "Add" }) {
|
|
6
|
+
return /*#__PURE__*/ jsxs(Box, {
|
|
7
|
+
display: "flex",
|
|
8
|
+
width: convertSizeToRem("1/2"),
|
|
9
|
+
gap: spacing.r8,
|
|
10
|
+
justifyContent: "flex-start",
|
|
11
|
+
children: [
|
|
12
|
+
/*#__PURE__*/ jsx(Button, {
|
|
13
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
14
|
+
name: "Remove-minus"
|
|
15
|
+
}),
|
|
16
|
+
variant: "danger",
|
|
17
|
+
type: "button",
|
|
18
|
+
onClick: onRemove,
|
|
19
|
+
"aria-label": removeLabel,
|
|
20
|
+
disabled: !canRemove,
|
|
21
|
+
tooltip: {
|
|
22
|
+
overlay: removeLabel,
|
|
23
|
+
placement: "top"
|
|
24
|
+
}
|
|
25
|
+
}),
|
|
26
|
+
showAdd && /*#__PURE__*/ jsx(Button, {
|
|
27
|
+
icon: /*#__PURE__*/ jsx(Icon, {
|
|
28
|
+
name: "Add-plus"
|
|
29
|
+
}),
|
|
30
|
+
variant: "outline",
|
|
31
|
+
type: "button",
|
|
32
|
+
onClick: onAdd,
|
|
33
|
+
"aria-label": addLabel,
|
|
34
|
+
tooltip: {
|
|
35
|
+
overlay: addLabel,
|
|
36
|
+
placement: "top"
|
|
37
|
+
},
|
|
38
|
+
disabled: !canAdd
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export { ArrayFieldActions };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface ConfirmDeleteRuleModalProps {
|
|
2
|
+
/** Whether the modal is open */
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
/** Rule ID to display in confirmation message */
|
|
5
|
+
ruleId: string;
|
|
6
|
+
/** Type of rule (e.g., "lifecycle", "replication") */
|
|
7
|
+
ruleType: "lifecycle" | "replication";
|
|
8
|
+
/** Whether deletion is in progress */
|
|
9
|
+
isDeleting: boolean;
|
|
10
|
+
/** Callback when user confirms deletion */
|
|
11
|
+
onConfirm: () => void;
|
|
12
|
+
/** Callback when user cancels deletion */
|
|
13
|
+
onCancel: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function ConfirmDeleteRuleModal({ isOpen, ruleId, ruleType, isDeleting, onConfirm, onCancel, }: ConfirmDeleteRuleModalProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Loader, Modal, Stack, Wrap } from "@scality/core-ui";
|
|
3
|
+
import { Button } from "@scality/core-ui/dist/next";
|
|
4
|
+
function ConfirmDeleteRuleModal({ isOpen, ruleId, ruleType, isDeleting, onConfirm, onCancel }) {
|
|
5
|
+
const ruleTypeLabel = "lifecycle" === ruleType ? "Lifecycle" : "Replication";
|
|
6
|
+
return /*#__PURE__*/ jsxs(Modal, {
|
|
7
|
+
close: onCancel,
|
|
8
|
+
isOpen: isOpen,
|
|
9
|
+
footer: /*#__PURE__*/ jsxs(Wrap, {
|
|
10
|
+
children: [
|
|
11
|
+
/*#__PURE__*/ jsx("p", {}),
|
|
12
|
+
/*#__PURE__*/ jsxs(Stack, {
|
|
13
|
+
children: [
|
|
14
|
+
/*#__PURE__*/ jsx(Button, {
|
|
15
|
+
variant: "outline",
|
|
16
|
+
onClick: onCancel,
|
|
17
|
+
label: "Cancel",
|
|
18
|
+
disabled: isDeleting
|
|
19
|
+
}),
|
|
20
|
+
/*#__PURE__*/ jsx(Button, {
|
|
21
|
+
variant: "danger",
|
|
22
|
+
onClick: onConfirm,
|
|
23
|
+
icon: isDeleting && /*#__PURE__*/ jsx(Loader, {
|
|
24
|
+
size: "larger"
|
|
25
|
+
}),
|
|
26
|
+
label: "Delete",
|
|
27
|
+
disabled: isDeleting
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
})
|
|
31
|
+
]
|
|
32
|
+
}),
|
|
33
|
+
title: `Delete ${ruleTypeLabel} Rule`,
|
|
34
|
+
children: [
|
|
35
|
+
"Are you sure you want to delete the ",
|
|
36
|
+
ruleType,
|
|
37
|
+
' rule "',
|
|
38
|
+
ruleId,
|
|
39
|
+
'"?'
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
export { ConfirmDeleteRuleModal };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ConstrainedText, Icon, PrettyBytes, spacing } from "@scality/core-ui";
|
|
3
|
+
import { tableRowHeight } from "@scality/core-ui/dist/components/tablev2/TableUtils";
|
|
4
|
+
import { Box, Table } from "@scality/core-ui/dist/next";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
import styled_components from "styled-components";
|
|
7
|
+
const Container = styled_components(Box)`
|
|
8
|
+
height: ${({ height })=>height};
|
|
9
|
+
min-height: 15.63rem;
|
|
10
|
+
margin: ${spacing.r8} 0rem;
|
|
11
|
+
`;
|
|
12
|
+
const DeleteObjectModalContent = ({ objects, onRemove })=>{
|
|
13
|
+
const columns = useMemo(()=>[
|
|
14
|
+
{
|
|
15
|
+
Header: "Name",
|
|
16
|
+
accessor: "Key",
|
|
17
|
+
Cell: ({ value })=>/*#__PURE__*/ jsx(ConstrainedText, {
|
|
18
|
+
text: value,
|
|
19
|
+
lineClamp: 1
|
|
20
|
+
}),
|
|
21
|
+
id: "name"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
Header: "Size",
|
|
25
|
+
accessor: "Size",
|
|
26
|
+
cellStyle: {
|
|
27
|
+
textAlign: "right"
|
|
28
|
+
},
|
|
29
|
+
Cell: ({ value })=>/*#__PURE__*/ jsx(PrettyBytes, {
|
|
30
|
+
bytes: Number(value)
|
|
31
|
+
}),
|
|
32
|
+
id: "size"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
Header: "",
|
|
36
|
+
accessor: "type",
|
|
37
|
+
cellStyle: {
|
|
38
|
+
width: "0.625rem"
|
|
39
|
+
},
|
|
40
|
+
Cell: (row)=>{
|
|
41
|
+
const objectKey = row.row.original.Key;
|
|
42
|
+
return /*#__PURE__*/ jsx("div", {
|
|
43
|
+
onClick: ()=>onRemove(objectKey),
|
|
44
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
45
|
+
name: "Close",
|
|
46
|
+
color: "buttonSecondary"
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
], [
|
|
52
|
+
onRemove
|
|
53
|
+
]);
|
|
54
|
+
const HEADER_AND_SPACING_ROWS = 3;
|
|
55
|
+
const rowHeight = "h40";
|
|
56
|
+
const tableRowHeightInRem = tableRowHeight[rowHeight];
|
|
57
|
+
return /*#__PURE__*/ jsx(Container, {
|
|
58
|
+
height: `calc(${objects.length + HEADER_AND_SPACING_ROWS} * (${tableRowHeightInRem}rem + 1px))`,
|
|
59
|
+
children: /*#__PURE__*/ jsx(Table, {
|
|
60
|
+
columns: columns,
|
|
61
|
+
data: objects,
|
|
62
|
+
children: /*#__PURE__*/ jsx(Table.SingleSelectableContent, {
|
|
63
|
+
rowHeight: "h40",
|
|
64
|
+
separationLineVariant: "backgroundLevel3",
|
|
65
|
+
selectedId: "Name",
|
|
66
|
+
onRowSelected: ()=>{}
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
export { DeleteObjectModalContent };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { UseFormRegisterReturn } from "react-hook-form";
|
|
2
|
+
export interface FilterFormValues {
|
|
3
|
+
filterType: "none" | "prefix" | "tags" | "and";
|
|
4
|
+
prefix: string;
|
|
5
|
+
tags: Array<{
|
|
6
|
+
key: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
interface FilterFormSectionProps {
|
|
11
|
+
filterType: string;
|
|
12
|
+
onFilterTypeChange: (value: string) => void;
|
|
13
|
+
prefixRegister: UseFormRegisterReturn;
|
|
14
|
+
tagFields: Array<{
|
|
15
|
+
id: string;
|
|
16
|
+
key: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}>;
|
|
19
|
+
tagKeyRegister: (index: number) => UseFormRegisterReturn;
|
|
20
|
+
tagValueRegister: (index: number) => UseFormRegisterReturn;
|
|
21
|
+
getTagKeyValue: (index: number) => string;
|
|
22
|
+
getTagValueValue: (index: number) => string;
|
|
23
|
+
appendTag: (value: {
|
|
24
|
+
key: string;
|
|
25
|
+
value: string;
|
|
26
|
+
}) => void;
|
|
27
|
+
removeTag: (index: number) => void;
|
|
28
|
+
errors?: {
|
|
29
|
+
prefix?: {
|
|
30
|
+
message?: string;
|
|
31
|
+
};
|
|
32
|
+
tags?: {
|
|
33
|
+
message?: string;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
forceLabelWidth?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare function FilterFormSection({ filterType, onFilterTypeChange, prefixRegister, tagFields, tagKeyRegister, tagValueRegister, getTagKeyValue, getTagValueValue, appendTag, removeTag, errors, forceLabelWidth, }: FilterFormSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare const createFilterValidationSchema: (Joi: typeof import("joi")) => {
|
|
40
|
+
filterType: import("joi").StringSchema<string>;
|
|
41
|
+
prefix: import("joi").AlternativesSchema<any>;
|
|
42
|
+
tags: import("joi").AlternativesSchema<any>;
|
|
43
|
+
};
|
|
44
|
+
export {};
|