@scality/data-browser-library 1.0.0-preview.11 → 1.0.0-preview.13
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 +20 -0
- package/dist/components/DataBrowserUI.js +64 -0
- package/dist/components/__tests__/BucketDetails.test.d.ts +1 -0
- package/dist/components/__tests__/BucketDetails.test.js +421 -0
- package/dist/components/__tests__/BucketList.test.js +389 -164
- package/dist/components/__tests__/BucketOverview.test.js +19 -63
- package/dist/components/__tests__/ObjectList.test.js +719 -219
- package/dist/components/buckets/BucketDetails.d.ts +40 -0
- package/dist/components/buckets/BucketDetails.js +194 -86
- package/dist/components/buckets/BucketList.d.ts +5 -6
- package/dist/components/buckets/BucketList.js +152 -97
- package/dist/components/buckets/BucketOverview.d.ts +6 -0
- package/dist/components/buckets/BucketOverview.js +363 -179
- package/dist/components/buckets/BucketPage.js +1 -5
- package/dist/components/buckets/BucketVersioning.js +3 -0
- package/dist/components/buckets/EmptyBucketButton.js +1 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +2 -1
- package/dist/components/layouts/ArrowNavigation.js +20 -8
- package/dist/components/objects/CreateFolderButton.js +1 -1
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +287 -157
- 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 +813 -0
- package/dist/components/objects/ObjectDetails/index.d.ts +16 -0
- package/dist/components/objects/ObjectDetails/index.js +132 -46
- package/dist/components/objects/ObjectList.d.ts +7 -5
- package/dist/components/objects/ObjectList.js +566 -286
- package/dist/components/objects/UploadButton.js +1 -1
- package/dist/config/types.d.ts +117 -0
- package/dist/contexts/DataBrowserUICustomizationContext.d.ts +27 -0
- package/dist/contexts/DataBrowserUICustomizationContext.js +13 -0
- package/dist/test/testUtils.d.ts +64 -0
- package/dist/test/testUtils.js +100 -1
- package/dist/types/index.d.ts +5 -3
- package/dist/utils/constants.d.ts +7 -0
- package/dist/utils/constants.js +8 -1
- package/dist/utils/useFeatures.js +1 -1
- package/package.json +2 -2
|
@@ -196,7 +196,7 @@ 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
201
|
label: uploadMutation.isPending ? "Uploading..." : "Upload"
|
|
202
202
|
})
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Build-time configuration types injected by RSBuild
|
|
3
3
|
*/
|
|
4
|
+
import type { Bucket } from "@aws-sdk/client-s3";
|
|
5
|
+
import type { TableItem } from "../components/objects/ObjectList";
|
|
4
6
|
export interface S3Configuration {
|
|
5
7
|
endpoint: string;
|
|
6
8
|
region: string;
|
|
@@ -44,3 +46,118 @@ declare global {
|
|
|
44
46
|
const __IS_DEVELOPMENT__: boolean;
|
|
45
47
|
const __IS_PRODUCTION__: boolean;
|
|
46
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Column configuration for lists (bucket list, object list)
|
|
51
|
+
*/
|
|
52
|
+
export interface ColumnConfig<T = unknown> {
|
|
53
|
+
id: keyof T | (string & {});
|
|
54
|
+
header: string;
|
|
55
|
+
width?: number | string;
|
|
56
|
+
render: React.ComponentType<{
|
|
57
|
+
data: T;
|
|
58
|
+
}>;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Action configuration for list-level actions (buttons at top of list)
|
|
62
|
+
*/
|
|
63
|
+
export interface ActionConfig {
|
|
64
|
+
id: string;
|
|
65
|
+
render: () => React.ReactNode;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Tab configuration for detail pages
|
|
69
|
+
*/
|
|
70
|
+
export interface TabConfig {
|
|
71
|
+
id: string;
|
|
72
|
+
title: string;
|
|
73
|
+
path?: string;
|
|
74
|
+
render: () => React.ReactNode;
|
|
75
|
+
hidden?: boolean;
|
|
76
|
+
withoutPadding?: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Field configuration for overview sections
|
|
80
|
+
*
|
|
81
|
+
* Default field IDs by section:
|
|
82
|
+
* - General: "name", "versioning", "location"
|
|
83
|
+
* - Data Protection: "objectLock", "defaultRetention"
|
|
84
|
+
* - Permissions: "owner", "acl", "cors", "public", "bucketPolicy"
|
|
85
|
+
*/
|
|
86
|
+
export interface FieldConfig {
|
|
87
|
+
id: string;
|
|
88
|
+
label?: string;
|
|
89
|
+
render: React.ComponentType<{
|
|
90
|
+
entityName: string;
|
|
91
|
+
}>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Storage class selector props
|
|
95
|
+
*/
|
|
96
|
+
export interface StorageClassSelectorProps {
|
|
97
|
+
value: string;
|
|
98
|
+
onChange: (newValue: string) => void;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Main DataBrowserUI component props
|
|
102
|
+
*/
|
|
103
|
+
export interface DataBrowserUIProps {
|
|
104
|
+
storageClassSelector?: React.ComponentType<StorageClassSelectorProps>;
|
|
105
|
+
extraBucketListColumns?: ColumnConfig<Bucket>[];
|
|
106
|
+
extraBucketListActions?: ActionConfig[];
|
|
107
|
+
extraBucketTabs?: TabConfig[];
|
|
108
|
+
extraBucketOverviewGeneral?: FieldConfig[];
|
|
109
|
+
extraBucketOverviewDataProtection?: FieldConfig[];
|
|
110
|
+
extraBucketOverviewPermissions?: FieldConfig[];
|
|
111
|
+
/**
|
|
112
|
+
* Extra columns for object list.
|
|
113
|
+
*
|
|
114
|
+
* Default column IDs for replacement:
|
|
115
|
+
* - "name" - Name column (file/folder icon, legal hold indicator)
|
|
116
|
+
* - "versionId" - Version ID column (only shown when versions enabled)
|
|
117
|
+
* - "lastModified" - Modified on column
|
|
118
|
+
* - "size" - Size column
|
|
119
|
+
* - "storageClass" - Storage Location column
|
|
120
|
+
*
|
|
121
|
+
* Extra columns are inserted between Version ID and Modified on.
|
|
122
|
+
*/
|
|
123
|
+
extraObjectListColumns?: ColumnConfig<TableItem>[];
|
|
124
|
+
/**
|
|
125
|
+
* Extra actions for object list header.
|
|
126
|
+
*
|
|
127
|
+
* Default action IDs for replacement:
|
|
128
|
+
* - "upload" - Upload button
|
|
129
|
+
* - "createFolder" - Create Folder button
|
|
130
|
+
* - "delete" - Delete Object button
|
|
131
|
+
*/
|
|
132
|
+
extraObjectListActions?: ActionConfig[];
|
|
133
|
+
/**
|
|
134
|
+
* Extra tabs for object details page.
|
|
135
|
+
*
|
|
136
|
+
* Default tab IDs for replacement:
|
|
137
|
+
* - "summary" - Summary tab
|
|
138
|
+
* - "metadata" - Metadata tab
|
|
139
|
+
* - "tags" - Tags tab
|
|
140
|
+
*/
|
|
141
|
+
extraObjectTabs?: TabConfig[];
|
|
142
|
+
/**
|
|
143
|
+
* Extra fields for object summary Information section.
|
|
144
|
+
*
|
|
145
|
+
* Default field IDs for replacement:
|
|
146
|
+
* - "name" - Name field
|
|
147
|
+
* - "versionId" - Version ID field
|
|
148
|
+
* - "size" - Size field
|
|
149
|
+
* - "lastModified" - Modified On field
|
|
150
|
+
* - "etag" - ETag field
|
|
151
|
+
* - "location" - Location field
|
|
152
|
+
*/
|
|
153
|
+
extraObjectSummaryInformation?: FieldConfig[];
|
|
154
|
+
/**
|
|
155
|
+
* Extra fields for object summary Data Protection section.
|
|
156
|
+
*
|
|
157
|
+
* Default field IDs for replacement:
|
|
158
|
+
* - "lock" - Lock (Retention) field
|
|
159
|
+
* - "legalHold" - Legal Hold field
|
|
160
|
+
*/
|
|
161
|
+
extraObjectSummaryDataProtection?: FieldConfig[];
|
|
162
|
+
}
|
|
163
|
+
export type S3EventType = "s3:ObjectCreated:*" | "s3:ObjectCreated:Put" | "s3:ObjectCreated:Post" | "s3:ObjectCreated:Copy" | "s3:ObjectCreated:CompleteMultipartUpload" | "s3:ObjectRemoved:*" | "s3:ObjectRemoved:Delete" | "s3:ObjectRemoved:DeleteMarkerCreated" | "s3:ObjectRestore:*" | "s3:ObjectRestore:Post" | "s3:ObjectRestore:Completed" | "s3:ObjectRestore:Delete" | "s3:LifecycleExpiration:*" | "s3:LifecycleExpiration:Delete" | "s3:LifecycleExpiration:DeleteMarkerCreated" | "s3:LifecycleTransition" | "s3:Replication:*" | "s3:Replication:OperationFailedReplication" | "s3:Replication:OperationMissedThreshold" | "s3:Replication:OperationReplicatedAfterThreshold" | "s3:Replication:OperationNotTracked" | "s3:ObjectTagging:*" | "s3:ObjectTagging:Put" | "s3:ObjectTagging:Delete" | "s3:ReducedRedundancyLostObject" | "s3:IntelligentTiering" | "s3:ObjectAcl:Put" | "s3:TestEvent";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal UI customization context for DataBrowserUI.
|
|
3
|
+
* NOT intended for external use - all configuration should be passed as props to DataBrowserUI.
|
|
4
|
+
*
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
import React from "react";
|
|
8
|
+
import type { DataBrowserUIProps } from "../config/types";
|
|
9
|
+
interface DataBrowserUICustomizationProviderProps {
|
|
10
|
+
config: DataBrowserUIProps;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Internal provider for DataBrowserUI customization options.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const DataBrowserUICustomizationProvider: React.FC<DataBrowserUICustomizationProviderProps>;
|
|
18
|
+
/**
|
|
19
|
+
* Internal hook to access DataBrowserUI customization options (extra columns, actions, tabs, etc.).
|
|
20
|
+
* Always returns a valid configuration object (empty object if no customizations provided).
|
|
21
|
+
*
|
|
22
|
+
* @internal
|
|
23
|
+
* @returns {DataBrowserUIProps} The UI customization options
|
|
24
|
+
* @throws {Error} If used outside of DataBrowserUICustomizationProvider
|
|
25
|
+
*/
|
|
26
|
+
export declare const useDataBrowserUICustomization: () => DataBrowserUIProps;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from "react";
|
|
3
|
+
const DataBrowserUICustomizationContext = /*#__PURE__*/ createContext(void 0);
|
|
4
|
+
const DataBrowserUICustomizationProvider = ({ config, children })=>/*#__PURE__*/ jsx(DataBrowserUICustomizationContext.Provider, {
|
|
5
|
+
value: config,
|
|
6
|
+
children: children
|
|
7
|
+
});
|
|
8
|
+
const useDataBrowserUICustomization = ()=>{
|
|
9
|
+
const context = useContext(DataBrowserUICustomizationContext);
|
|
10
|
+
if (void 0 === context) throw new Error("useDataBrowserUICustomization must be used within DataBrowserUI component. Ensure your component is rendered inside <DataBrowserUI>.");
|
|
11
|
+
return context;
|
|
12
|
+
};
|
|
13
|
+
export { DataBrowserUICustomizationProvider, useDataBrowserUICustomization };
|
package/dist/test/testUtils.d.ts
CHANGED
|
@@ -178,4 +178,68 @@ export declare const mockSuccessSubmit: (mockMutate: jest.Mock) => void;
|
|
|
178
178
|
* @param errorMessage - The error message to return (default: "Network Error")
|
|
179
179
|
*/
|
|
180
180
|
export declare const mockErrorSubmit: (mockMutate: jest.Mock, errorMessage?: string) => void;
|
|
181
|
+
import type { GetBucketAclCommandOutput, GetBucketCorsCommandOutput, GetBucketLifecycleConfigurationCommandOutput, GetBucketLocationCommandOutput, GetObjectLockConfigurationCommandOutput, GetBucketPolicyCommandOutput, GetBucketReplicationCommandOutput, GetBucketTaggingCommandOutput, GetBucketVersioningCommandOutput } from "@aws-sdk/client-s3";
|
|
182
|
+
export type MockQueryResult<T> = {
|
|
183
|
+
data: T | undefined;
|
|
184
|
+
status: "idle" | "pending" | "success" | "error";
|
|
185
|
+
error?: Error | null;
|
|
186
|
+
};
|
|
187
|
+
export type ISVBucketStatusMock = {
|
|
188
|
+
isVeeamBucket: boolean;
|
|
189
|
+
isCommvaultBucket: boolean;
|
|
190
|
+
isISVManaged: boolean;
|
|
191
|
+
isvApplication: string | undefined;
|
|
192
|
+
isLoading: boolean;
|
|
193
|
+
bucketTagsStatus: "idle" | "pending" | "success" | "error";
|
|
194
|
+
};
|
|
195
|
+
export interface BucketMockData {
|
|
196
|
+
versioning: MockQueryResult<GetBucketVersioningCommandOutput>;
|
|
197
|
+
acl: MockQueryResult<GetBucketAclCommandOutput>;
|
|
198
|
+
location: MockQueryResult<GetBucketLocationCommandOutput>;
|
|
199
|
+
cors: MockQueryResult<GetBucketCorsCommandOutput>;
|
|
200
|
+
objectLock: MockQueryResult<GetObjectLockConfigurationCommandOutput>;
|
|
201
|
+
policy: MockQueryResult<GetBucketPolicyCommandOutput>;
|
|
202
|
+
tagging: MockQueryResult<GetBucketTaggingCommandOutput>;
|
|
203
|
+
lifecycle: MockQueryResult<GetBucketLifecycleConfigurationCommandOutput>;
|
|
204
|
+
replication: MockQueryResult<GetBucketReplicationCommandOutput>;
|
|
205
|
+
isvBucketStatus: ISVBucketStatusMock;
|
|
206
|
+
features: boolean;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Creates default bucket mock data for testing
|
|
210
|
+
* @returns Default bucket mock data with all properties set to success state
|
|
211
|
+
*/
|
|
212
|
+
export declare const createDefaultBucketMocks: () => BucketMockData;
|
|
213
|
+
/**
|
|
214
|
+
* Applies bucket mock data to the provided mock functions
|
|
215
|
+
* @param mocks - Object containing all the mocked hook functions
|
|
216
|
+
* @param mockData - Optional partial overrides for the default mock data
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```ts
|
|
220
|
+
* applyBucketMocks(
|
|
221
|
+
* {
|
|
222
|
+
* useGetBucketVersioning: mockUseGetBucketVersioning,
|
|
223
|
+
* useGetBucketAcl: mockUseGetBucketAcl,
|
|
224
|
+
* // ... other mocks
|
|
225
|
+
* },
|
|
226
|
+
* {
|
|
227
|
+
* versioning: { data: { Status: "Suspended" }, status: "success" }
|
|
228
|
+
* }
|
|
229
|
+
* );
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
export declare const applyBucketMocks: (mocks: {
|
|
233
|
+
useGetBucketVersioning: jest.Mock;
|
|
234
|
+
useGetBucketAcl: jest.Mock;
|
|
235
|
+
useGetBucketLocation: jest.Mock;
|
|
236
|
+
useGetBucketCors: jest.Mock;
|
|
237
|
+
useGetBucketObjectLockConfiguration: jest.Mock;
|
|
238
|
+
useGetBucketPolicy: jest.Mock;
|
|
239
|
+
useGetBucketTagging: jest.Mock;
|
|
240
|
+
useGetBucketLifecycle?: jest.Mock;
|
|
241
|
+
useGetBucketReplication?: jest.Mock;
|
|
242
|
+
useISVBucketStatus: jest.Mock;
|
|
243
|
+
useFeatures: jest.Mock;
|
|
244
|
+
}, mockData?: Partial<BucketMockData>) => void;
|
|
181
245
|
export { setupMswServer, overrideHandlers } from "./msw";
|
package/dist/test/testUtils.js
CHANGED
|
@@ -307,4 +307,103 @@ const mockErrorSubmit = (mockMutate, errorMessage = "Network Error")=>{
|
|
|
307
307
|
options?.onError?.(error);
|
|
308
308
|
});
|
|
309
309
|
};
|
|
310
|
-
|
|
310
|
+
const createDefaultBucketMocks = ()=>({
|
|
311
|
+
versioning: {
|
|
312
|
+
data: {
|
|
313
|
+
Status: "Enabled"
|
|
314
|
+
},
|
|
315
|
+
status: "success"
|
|
316
|
+
},
|
|
317
|
+
acl: {
|
|
318
|
+
data: {
|
|
319
|
+
Owner: {
|
|
320
|
+
DisplayName: "test-owner"
|
|
321
|
+
},
|
|
322
|
+
Grants: [
|
|
323
|
+
{
|
|
324
|
+
Grantee: {
|
|
325
|
+
Type: "CanonicalUser",
|
|
326
|
+
DisplayName: "test-grantee"
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
},
|
|
331
|
+
status: "success"
|
|
332
|
+
},
|
|
333
|
+
location: {
|
|
334
|
+
data: {
|
|
335
|
+
LocationConstraint: "us-west-2"
|
|
336
|
+
},
|
|
337
|
+
status: "success"
|
|
338
|
+
},
|
|
339
|
+
cors: {
|
|
340
|
+
data: {
|
|
341
|
+
CORSRules: []
|
|
342
|
+
},
|
|
343
|
+
status: "success"
|
|
344
|
+
},
|
|
345
|
+
objectLock: {
|
|
346
|
+
data: {
|
|
347
|
+
ObjectLockConfiguration: {
|
|
348
|
+
ObjectLockEnabled: "Disabled"
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
status: "success"
|
|
352
|
+
},
|
|
353
|
+
policy: {
|
|
354
|
+
data: void 0,
|
|
355
|
+
error: null,
|
|
356
|
+
status: "success"
|
|
357
|
+
},
|
|
358
|
+
tagging: {
|
|
359
|
+
data: {
|
|
360
|
+
TagSet: []
|
|
361
|
+
},
|
|
362
|
+
status: "success"
|
|
363
|
+
},
|
|
364
|
+
lifecycle: {
|
|
365
|
+
data: {
|
|
366
|
+
Rules: []
|
|
367
|
+
},
|
|
368
|
+
status: "success",
|
|
369
|
+
error: null
|
|
370
|
+
},
|
|
371
|
+
replication: {
|
|
372
|
+
data: {
|
|
373
|
+
ReplicationConfiguration: {
|
|
374
|
+
Role: "arn:aws:iam::123456789012:role/replication-role",
|
|
375
|
+
Rules: []
|
|
376
|
+
}
|
|
377
|
+
},
|
|
378
|
+
status: "success",
|
|
379
|
+
error: null
|
|
380
|
+
},
|
|
381
|
+
isvBucketStatus: {
|
|
382
|
+
isVeeamBucket: false,
|
|
383
|
+
isCommvaultBucket: false,
|
|
384
|
+
isISVManaged: false,
|
|
385
|
+
isvApplication: void 0,
|
|
386
|
+
isLoading: false,
|
|
387
|
+
bucketTagsStatus: "success"
|
|
388
|
+
},
|
|
389
|
+
features: false
|
|
390
|
+
});
|
|
391
|
+
const applyBucketMocks = (mocks, mockData = {})=>{
|
|
392
|
+
const defaults = createDefaultBucketMocks();
|
|
393
|
+
const data = {
|
|
394
|
+
...defaults,
|
|
395
|
+
...mockData
|
|
396
|
+
};
|
|
397
|
+
mocks.useGetBucketVersioning.mockReturnValue(data.versioning);
|
|
398
|
+
mocks.useGetBucketAcl.mockReturnValue(data.acl);
|
|
399
|
+
mocks.useGetBucketLocation.mockReturnValue(data.location);
|
|
400
|
+
mocks.useGetBucketCors.mockReturnValue(data.cors);
|
|
401
|
+
mocks.useGetBucketObjectLockConfiguration.mockReturnValue(data.objectLock);
|
|
402
|
+
mocks.useGetBucketPolicy.mockReturnValue(data.policy);
|
|
403
|
+
mocks.useGetBucketTagging.mockReturnValue(data.tagging);
|
|
404
|
+
mocks.useISVBucketStatus.mockReturnValue(data.isvBucketStatus);
|
|
405
|
+
mocks.useFeatures.mockReturnValue(data.features);
|
|
406
|
+
if (mocks.useGetBucketLifecycle) mocks.useGetBucketLifecycle.mockReturnValue(data.lifecycle);
|
|
407
|
+
if (mocks.useGetBucketReplication) mocks.useGetBucketReplication.mockReturnValue(data.replication);
|
|
408
|
+
};
|
|
409
|
+
export { MockedPutObjectCommand, MockedS3Client, applyBucketMocks, createDefaultBucketMocks, createFactoryTestError, createMockMutationResult, createMockQueryResult, createQueryWrapper, createTestFile, createTestWrapper, findToggleByLabel, mockErrorSubmit, mockOffsetSize, mockS3Client, mockSuccessSubmit, overrideGlobalConfig, overrideHandlers, renderHookWithWrapper, resetGlobalConfig, setupCommonMocks, setupMswServer, setupS3Mocks, submitForm, testConfig, testCredentials, validateFactoryHook, validateHookResult, withGlobalConfig };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
1
|
+
import type { S3ClientConfig } from "@aws-sdk/client-s3";
|
|
2
2
|
import type { AwsCredentialIdentity } from "@aws-sdk/types";
|
|
3
|
-
|
|
3
|
+
import type { S3EventType } from "../config/types";
|
|
4
|
+
export type { BucketCannedACL, BucketLocationConstraint, CopyObjectCommandInput, CopyObjectCommandOutput, CreateBucketCommandInput, CreateBucketCommandOutput, DeleteBucketCommandInput, DeleteBucketCommandOutput, DeleteBucketCorsCommandOutput, DeleteBucketLifecycleCommandOutput, DeleteBucketPolicyCommandOutput, DeleteBucketReplicationCommandOutput, DeleteBucketTaggingCommandOutput, DeleteObjectCommandInput, DeleteObjectCommandOutput, DeleteObjectsCommandInput, DeleteObjectsCommandOutput, DeleteObjectTaggingCommandOutput, GetBucketAclCommandOutput, GetBucketCorsCommandOutput, GetBucketEncryptionCommandOutput, GetBucketLifecycleConfigurationCommandOutput, GetBucketLocationCommandInput, GetBucketLocationCommandOutput, GetBucketNotificationConfigurationCommandOutput, GetBucketPolicyCommandOutput, GetBucketReplicationCommandOutput, GetBucketTaggingCommandOutput, GetBucketVersioningCommandOutput, GetObjectAclCommandOutput, GetObjectAttributesCommandInput, GetObjectAttributesCommandOutput, GetObjectCommandInput, GetObjectCommandOutput, GetObjectLegalHoldCommandOutput, GetObjectLockConfigurationCommandOutput, GetObjectRetentionCommandOutput, GetObjectTaggingCommandOutput, GetObjectTorrentCommandOutput, HeadObjectCommandInput, HeadObjectCommandOutput, ListBucketsCommandOutput, ListMultipartUploadsCommandInput, ListMultipartUploadsCommandOutput, ListObjectsV2CommandInput, ListObjectsV2CommandOutput, ListObjectVersionsCommandInput, ListObjectVersionsCommandOutput, ObjectCannedACL, PutBucketAclCommandInput, PutBucketCorsCommandInput, PutBucketEncryptionCommandInput, PutBucketLifecycleConfigurationCommandInput, PutBucketNotificationConfigurationCommandInput, PutBucketPolicyCommandInput, PutBucketReplicationCommandInput, PutBucketTaggingCommandInput, PutBucketTaggingCommandOutput, PutBucketVersioningCommandInput, PutObjectAclCommandInput, PutObjectCommandInput, PutObjectCommandOutput, PutObjectLegalHoldCommandInput, PutObjectLockConfigurationCommandInput, PutObjectRetentionCommandInput, PutObjectTaggingCommandInput, RestoreObjectCommandInput, RestoreObjectCommandOutput, SelectObjectContentCommandInput, SelectObjectContentCommandOutput, } from "@aws-sdk/client-s3";
|
|
4
5
|
export interface S3BrowserConfig extends Omit<S3ClientConfig, "credentials"> {
|
|
5
6
|
endpoint?: string;
|
|
6
7
|
region: string;
|
|
@@ -11,10 +12,11 @@ export interface S3BrowserConfig extends Omit<S3ClientConfig, "credentials"> {
|
|
|
11
12
|
proxyHost?: string;
|
|
12
13
|
proxyPort?: number;
|
|
13
14
|
publicAclIndicator?: string;
|
|
15
|
+
supportedNotificationEvents?: S3EventType[];
|
|
16
|
+
features?: string[];
|
|
14
17
|
}
|
|
15
18
|
export interface S3Credentials extends AwsCredentialIdentity {
|
|
16
19
|
roleArn?: string;
|
|
17
|
-
features?: string[];
|
|
18
20
|
}
|
|
19
21
|
export type GetConfigFunction = () => S3BrowserConfig & {
|
|
20
22
|
credentials: S3Credentials;
|
|
@@ -10,3 +10,10 @@ export declare const VEEAM_OFFICE_365 = "Veeam Backup for Microsoft 365 (v6, v7)
|
|
|
10
10
|
export declare const VEEAM_OFFICE_365_V8 = "Veeam Backup for Microsoft 365 (v8+)";
|
|
11
11
|
/** Generic identifier for Commvault */
|
|
12
12
|
export declare const COMMVAULT_APPLICATION = "Commvault";
|
|
13
|
+
export declare const BUCKET_ROUTES: {
|
|
14
|
+
readonly bucketPolicy: (bucketName: string) => string;
|
|
15
|
+
readonly lifecycleCreate: (bucketName: string) => string;
|
|
16
|
+
readonly lifecycleEdit: (bucketName: string, ruleId: string) => string;
|
|
17
|
+
readonly replicationCreate: (bucketName: string) => string;
|
|
18
|
+
readonly replicationEdit: (bucketName: string, ruleId: string) => string;
|
|
19
|
+
};
|
package/dist/utils/constants.js
CHANGED
|
@@ -6,4 +6,11 @@ const VEEAM_VBO_APPLICATION = "Veeam Backup for Microsoft 365";
|
|
|
6
6
|
const VEEAM_OFFICE_365 = "Veeam Backup for Microsoft 365 (v6, v7)";
|
|
7
7
|
const VEEAM_OFFICE_365_V8 = "Veeam Backup for Microsoft 365 (v8+)";
|
|
8
8
|
const COMMVAULT_APPLICATION = "Commvault";
|
|
9
|
-
|
|
9
|
+
const BUCKET_ROUTES = {
|
|
10
|
+
bucketPolicy: (bucketName)=>`/buckets/${bucketName}/policy`,
|
|
11
|
+
lifecycleCreate: (bucketName)=>`/buckets/${bucketName}/lifecycle/create`,
|
|
12
|
+
lifecycleEdit: (bucketName, ruleId)=>`/buckets/${bucketName}/lifecycle/edit/${encodeURIComponent(ruleId)}`,
|
|
13
|
+
replicationCreate: (bucketName)=>`/buckets/${bucketName}/replication/create`,
|
|
14
|
+
replicationEdit: (bucketName, ruleId)=>`/buckets/${bucketName}/replication/edit/${encodeURIComponent(ruleId)}`
|
|
15
|
+
};
|
|
16
|
+
export { BUCKET_ROUTES, BUCKET_TAG_APPLICATION, BUCKET_TAG_VEEAM_APPLICATION, COMMVAULT_APPLICATION, VEEAM_BACKUP_REPLICATION, VEEAM_IMMUTABLE_POLICY_NAME, VEEAM_OFFICE_365, VEEAM_OFFICE_365_V8, VEEAM_VBO_APPLICATION };
|
|
@@ -2,6 +2,6 @@ import { useDataBrowserContext } from "../components/index.js";
|
|
|
2
2
|
function useFeatures(feature) {
|
|
3
3
|
const { getS3Config } = useDataBrowserContext();
|
|
4
4
|
const config = getS3Config();
|
|
5
|
-
return config?.
|
|
5
|
+
return config?.features?.includes(feature);
|
|
6
6
|
}
|
|
7
7
|
export { useFeatures };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scality/data-browser-library",
|
|
3
|
-
"version": "1.0.0-preview.
|
|
3
|
+
"version": "1.0.0-preview.13",
|
|
4
4
|
"description": "A modular React component library for browsing S3 buckets and objects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@scality/zenkoclient": "^2.0.0-preview.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@scality/core-ui": "
|
|
41
|
+
"@scality/core-ui": "0.185.0",
|
|
42
42
|
"react": ">=18.0.0",
|
|
43
43
|
"react-dom": ">=18.0.0",
|
|
44
44
|
"react-router-dom": ">=6.0.0",
|