@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.
Files changed (256) hide show
  1. package/dist/components/Editor.d.ts +12 -0
  2. package/dist/components/Editor.js +28 -0
  3. package/dist/components/__tests__/BucketCreate.test.d.ts +1 -0
  4. package/dist/components/__tests__/BucketCreate.test.js +408 -0
  5. package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +1 -0
  6. package/dist/components/__tests__/BucketLifecycleFormPage.test.js +618 -0
  7. package/dist/components/__tests__/BucketLifecycleList.test.d.ts +1 -0
  8. package/dist/components/__tests__/BucketLifecycleList.test.js +325 -0
  9. package/dist/components/__tests__/BucketList.test.d.ts +1 -0
  10. package/dist/components/__tests__/BucketList.test.js +415 -0
  11. package/dist/components/__tests__/BucketNotificationCreatePage.test.d.ts +1 -0
  12. package/dist/components/__tests__/BucketNotificationCreatePage.test.js +316 -0
  13. package/dist/components/__tests__/BucketOverview.test.d.ts +1 -0
  14. package/dist/components/__tests__/BucketOverview.test.js +769 -0
  15. package/dist/components/__tests__/BucketPolicyPage.test.d.ts +1 -0
  16. package/dist/components/__tests__/BucketPolicyPage.test.js +268 -0
  17. package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +1 -0
  18. package/dist/components/__tests__/BucketReplicationFormPage.test.js +1757 -0
  19. package/dist/components/__tests__/BucketReplicationList.test.d.ts +1 -0
  20. package/dist/components/__tests__/BucketReplicationList.test.js +344 -0
  21. package/dist/components/__tests__/CreateFolderButton.test.d.ts +1 -0
  22. package/dist/components/__tests__/CreateFolderButton.test.js +147 -0
  23. package/dist/components/__tests__/DeleteBucketButton.test.d.ts +1 -0
  24. package/dist/components/__tests__/DeleteBucketButton.test.js +272 -0
  25. package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.d.ts +1 -0
  26. package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +196 -0
  27. package/dist/components/__tests__/DeleteObjectButton.test.d.ts +1 -0
  28. package/dist/components/__tests__/DeleteObjectButton.test.js +302 -0
  29. package/dist/components/__tests__/EmptyBucketButton.test.d.ts +1 -0
  30. package/dist/components/__tests__/EmptyBucketButton.test.js +302 -0
  31. package/dist/components/__tests__/MetadataSearch.test.d.ts +1 -0
  32. package/dist/components/__tests__/MetadataSearch.test.js +201 -0
  33. package/dist/components/__tests__/ObjectList.test.d.ts +1 -0
  34. package/dist/components/__tests__/ObjectList.test.js +283 -0
  35. package/dist/components/__tests__/UploadButton.test.d.ts +1 -0
  36. package/dist/components/__tests__/UploadButton.test.js +144 -0
  37. package/dist/components/buckets/BucketCreate.d.ts +49 -0
  38. package/dist/components/buckets/BucketCreate.js +237 -0
  39. package/dist/components/buckets/BucketDetails.d.ts +1 -0
  40. package/dist/components/buckets/BucketDetails.js +106 -0
  41. package/dist/components/buckets/BucketLifecycleFormPage.d.ts +15 -0
  42. package/dist/components/buckets/BucketLifecycleFormPage.js +1085 -0
  43. package/dist/components/buckets/BucketLifecycleList.d.ts +10 -0
  44. package/dist/components/buckets/BucketLifecycleList.js +270 -0
  45. package/dist/components/buckets/BucketList.d.ts +15 -0
  46. package/dist/components/buckets/BucketList.js +146 -0
  47. package/dist/components/buckets/BucketLocation.d.ts +3 -0
  48. package/dist/components/buckets/BucketLocation.js +16 -0
  49. package/dist/components/buckets/BucketOverview.d.ts +88 -0
  50. package/dist/components/buckets/BucketOverview.js +291 -0
  51. package/dist/components/buckets/BucketPage.d.ts +2 -0
  52. package/dist/components/buckets/BucketPage.js +47 -0
  53. package/dist/components/buckets/BucketPolicyButton.d.ts +7 -0
  54. package/dist/components/buckets/BucketPolicyButton.js +18 -0
  55. package/dist/components/buckets/BucketPolicyPage.d.ts +1 -0
  56. package/dist/components/buckets/BucketPolicyPage.js +236 -0
  57. package/dist/components/buckets/BucketReplicationFormPage.d.ts +1 -0
  58. package/dist/components/buckets/BucketReplicationFormPage.js +834 -0
  59. package/dist/components/buckets/BucketReplicationList.d.ts +11 -0
  60. package/dist/components/buckets/BucketReplicationList.js +189 -0
  61. package/dist/components/buckets/BucketVersioning.d.ts +4 -0
  62. package/dist/components/buckets/BucketVersioning.js +73 -0
  63. package/dist/components/buckets/DeleteBucketButton.d.ts +8 -0
  64. package/dist/components/buckets/DeleteBucketButton.js +78 -0
  65. package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +18 -0
  66. package/dist/components/buckets/DeleteBucketConfigRuleButton.js +53 -0
  67. package/dist/components/buckets/EmptyBucketButton.d.ts +5 -0
  68. package/dist/components/buckets/EmptyBucketButton.js +232 -0
  69. package/dist/components/buckets/EmptyBucketSummary.d.ts +9 -0
  70. package/dist/components/buckets/EmptyBucketSummary.js +60 -0
  71. package/dist/components/buckets/EmptyBucketSummaryList.d.ts +13 -0
  72. package/dist/components/buckets/EmptyBucketSummaryList.js +140 -0
  73. package/dist/components/buckets/__tests__/BucketVersioning.test.d.ts +1 -0
  74. package/dist/components/buckets/__tests__/BucketVersioning.test.js +163 -0
  75. package/dist/components/buckets/notifications/BucketNotificationCreatePage.d.ts +1 -0
  76. package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +234 -0
  77. package/dist/components/buckets/notifications/EventsSection.d.ts +1 -0
  78. package/dist/components/buckets/notifications/EventsSection.js +123 -0
  79. package/dist/components/buckets/notifications/events.d.ts +12 -0
  80. package/dist/components/buckets/notifications/events.js +27 -0
  81. package/dist/components/index.d.ts +21 -0
  82. package/dist/components/index.js +22 -0
  83. package/dist/components/layouts/ArrowNavigation.d.ts +4 -0
  84. package/dist/components/layouts/ArrowNavigation.js +16 -0
  85. package/dist/components/layouts/BrowserPageLayout.d.ts +12 -0
  86. package/dist/components/layouts/BrowserPageLayout.js +51 -0
  87. package/dist/components/objects/CreateFolderButton.d.ts +29 -0
  88. package/dist/components/objects/CreateFolderButton.js +118 -0
  89. package/dist/components/objects/DeleteObjectButton.d.ts +8 -0
  90. package/dist/components/objects/DeleteObjectButton.js +191 -0
  91. package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +2 -0
  92. package/dist/components/objects/ObjectDetails/ObjectMetadata.js +356 -0
  93. package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +3 -0
  94. package/dist/components/objects/ObjectDetails/ObjectSummary.js +241 -0
  95. package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +3 -0
  96. package/dist/components/objects/ObjectDetails/ObjectTags.js +272 -0
  97. package/dist/components/objects/ObjectDetails/index.d.ts +9 -0
  98. package/dist/components/objects/ObjectDetails/index.js +75 -0
  99. package/dist/components/objects/ObjectList.d.ts +40 -0
  100. package/dist/components/objects/ObjectList.js +453 -0
  101. package/dist/components/objects/ObjectLock/EditRetentionButton.d.ts +4 -0
  102. package/dist/components/objects/ObjectLock/EditRetentionButton.js +32 -0
  103. package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.d.ts +3 -0
  104. package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +211 -0
  105. package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +9 -0
  106. package/dist/components/objects/ObjectLock/ObjectLockSettings.js +158 -0
  107. package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +8 -0
  108. package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +39 -0
  109. package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.d.ts +1 -0
  110. package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +204 -0
  111. package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.d.ts +1 -0
  112. package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +374 -0
  113. package/dist/components/objects/ObjectPage.d.ts +1 -0
  114. package/dist/components/objects/ObjectPage.js +45 -0
  115. package/dist/components/objects/UploadButton.d.ts +34 -0
  116. package/dist/components/objects/UploadButton.js +229 -0
  117. package/dist/components/providers/DataBrowserProvider.d.ts +20 -0
  118. package/dist/components/providers/DataBrowserProvider.js +42 -0
  119. package/dist/components/search/MetadataSearch.d.ts +5 -0
  120. package/dist/components/search/MetadataSearch.js +162 -0
  121. package/dist/components/search/SearchHints.d.ts +8 -0
  122. package/dist/components/search/SearchHints.js +21 -0
  123. package/dist/components/ui/ArrayFieldActions.d.ts +36 -0
  124. package/dist/components/ui/ArrayFieldActions.js +43 -0
  125. package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +16 -0
  126. package/dist/components/ui/ConfirmDeleteRuleModal.js +43 -0
  127. package/dist/components/ui/DeleteObjectModalContent.d.ts +5 -0
  128. package/dist/components/ui/DeleteObjectModalContent.js +71 -0
  129. package/dist/components/ui/FilterFormSection.d.ts +44 -0
  130. package/dist/components/ui/FilterFormSection.js +159 -0
  131. package/dist/components/ui/Search.elements.d.ts +17 -0
  132. package/dist/components/ui/Search.elements.js +59 -0
  133. package/dist/components/ui/Table.elements.d.ts +36 -0
  134. package/dist/components/ui/Table.elements.js +87 -0
  135. package/dist/config/factory.d.ts +63 -0
  136. package/dist/config/factory.js +74 -0
  137. package/dist/config/types.d.ts +46 -0
  138. package/dist/config/types.js +0 -0
  139. package/dist/hooks/__tests__/useISVBucketDetection.test.d.ts +1 -0
  140. package/dist/hooks/__tests__/useISVBucketDetection.test.js +188 -0
  141. package/dist/hooks/__tests__/useIsBucketEmpty.test.d.ts +1 -0
  142. package/dist/hooks/__tests__/useIsBucketEmpty.test.js +122 -0
  143. package/dist/hooks/bucketConfiguration.d.ts +168 -0
  144. package/dist/hooks/bucketConfiguration.js +67 -0
  145. package/dist/hooks/bucketOperations.d.ts +36 -0
  146. package/dist/hooks/bucketOperations.js +12 -0
  147. package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.d.ts +1 -0
  148. package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +276 -0
  149. package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.d.ts +1 -0
  150. package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +259 -0
  151. package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.d.ts +1 -0
  152. package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +166 -0
  153. package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.d.ts +1 -0
  154. package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +200 -0
  155. package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.d.ts +1 -0
  156. package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +179 -0
  157. package/dist/hooks/factories/index.d.ts +18 -0
  158. package/dist/hooks/factories/index.js +5 -0
  159. package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +13 -0
  160. package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +76 -0
  161. package/dist/hooks/factories/useCreateS3LoginHook.d.ts +8 -0
  162. package/dist/hooks/factories/useCreateS3LoginHook.js +22 -0
  163. package/dist/hooks/factories/useCreateS3MutationHook.d.ts +5 -0
  164. package/dist/hooks/factories/useCreateS3MutationHook.js +50 -0
  165. package/dist/hooks/factories/useCreateS3QueryHook.d.ts +3 -0
  166. package/dist/hooks/factories/useCreateS3QueryHook.js +51 -0
  167. package/dist/hooks/index.d.ts +13 -0
  168. package/dist/hooks/index.js +13 -0
  169. package/dist/hooks/loginOperations.d.ts +21 -0
  170. package/dist/hooks/loginOperations.js +9 -0
  171. package/dist/hooks/objectOperations.d.ts +190 -0
  172. package/dist/hooks/objectOperations.js +67 -0
  173. package/dist/hooks/presignedOperations.d.ts +73 -0
  174. package/dist/hooks/presignedOperations.js +72 -0
  175. package/dist/hooks/useBatchObjectLegalHold.d.ts +11 -0
  176. package/dist/hooks/useBatchObjectLegalHold.js +45 -0
  177. package/dist/hooks/useDeleteBucketConfigRule.d.ts +26 -0
  178. package/dist/hooks/useDeleteBucketConfigRule.js +46 -0
  179. package/dist/hooks/useEmptyBucket.d.ts +27 -0
  180. package/dist/hooks/useEmptyBucket.js +116 -0
  181. package/dist/hooks/useISVBucketDetection.d.ts +15 -0
  182. package/dist/hooks/useISVBucketDetection.js +27 -0
  183. package/dist/hooks/useIsBucketEmpty.d.ts +7 -0
  184. package/dist/hooks/useIsBucketEmpty.js +36 -0
  185. package/dist/hooks/useLoginMutation.d.ts +21 -0
  186. package/dist/hooks/useLoginMutation.js +9 -0
  187. package/dist/hooks/useS3Client.d.ts +1 -0
  188. package/dist/hooks/useS3Client.js +13 -0
  189. package/dist/hooks/useTableRowSelection.d.ts +9 -0
  190. package/dist/hooks/useTableRowSelection.js +45 -0
  191. package/dist/index.d.ts +6 -0
  192. package/dist/index.js +6 -0
  193. package/dist/schemas/bucketPolicySchema.json +321 -0
  194. package/dist/test/msw/handlers/deleteBucket.d.ts +1 -0
  195. package/dist/test/msw/handlers/deleteBucket.js +14 -0
  196. package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -0
  197. package/dist/test/msw/handlers/getBucketAcl.js +96 -0
  198. package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -0
  199. package/dist/test/msw/handlers/getBucketLocation.js +23 -0
  200. package/dist/test/msw/handlers/getBucketPolicy.d.ts +11 -0
  201. package/dist/test/msw/handlers/getBucketPolicy.js +72 -0
  202. package/dist/test/msw/handlers/headObject.d.ts +1 -0
  203. package/dist/test/msw/handlers/headObject.js +17 -0
  204. package/dist/test/msw/handlers/listBuckets.d.ts +1 -0
  205. package/dist/test/msw/handlers/listBuckets.js +24 -0
  206. package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -0
  207. package/dist/test/msw/handlers/listObjectVersions.js +83 -0
  208. package/dist/test/msw/handlers/listObjects.d.ts +1 -0
  209. package/dist/test/msw/handlers/listObjects.js +66 -0
  210. package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -0
  211. package/dist/test/msw/handlers/objectLegalHold.js +24 -0
  212. package/dist/test/msw/handlers/objectRetention.d.ts +1 -0
  213. package/dist/test/msw/handlers/objectRetention.js +27 -0
  214. package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -0
  215. package/dist/test/msw/handlers/putBucketAcl.js +18 -0
  216. package/dist/test/msw/handlers/putObject.d.ts +1 -0
  217. package/dist/test/msw/handlers/putObject.js +16 -0
  218. package/dist/test/msw/handlers.d.ts +4 -0
  219. package/dist/test/msw/handlers.js +109 -0
  220. package/dist/test/msw/index.d.ts +2 -0
  221. package/dist/test/msw/index.js +3 -0
  222. package/dist/test/msw/server.d.ts +4 -0
  223. package/dist/test/msw/server.js +20 -0
  224. package/dist/test/msw/utils.d.ts +2 -0
  225. package/dist/test/msw/utils.js +13 -0
  226. package/dist/test/setup.d.ts +1 -0
  227. package/dist/test/setup.js +90 -0
  228. package/dist/test/testUtils.d.ts +181 -0
  229. package/dist/test/testUtils.js +310 -0
  230. package/dist/test/utils/errorHandling.test.d.ts +1 -0
  231. package/dist/test/utils/errorHandling.test.js +423 -0
  232. package/dist/types/index.d.ts +51 -0
  233. package/dist/types/index.js +0 -0
  234. package/dist/utils/constants.d.ts +12 -0
  235. package/dist/utils/constants.js +9 -0
  236. package/dist/utils/deletion/index.d.ts +2 -0
  237. package/dist/utils/deletion/index.js +2 -0
  238. package/dist/utils/deletion/messages.d.ts +5 -0
  239. package/dist/utils/deletion/messages.js +29 -0
  240. package/dist/utils/deletion/types.d.ts +11 -0
  241. package/dist/utils/deletion/types.js +0 -0
  242. package/dist/utils/errorHandling.d.ts +63 -0
  243. package/dist/utils/errorHandling.js +84 -0
  244. package/dist/utils/hooks.d.ts +2 -0
  245. package/dist/utils/hooks.js +26 -0
  246. package/dist/utils/index.d.ts +4 -0
  247. package/dist/utils/index.js +4 -0
  248. package/dist/utils/proxyMiddleware.d.ts +18 -0
  249. package/dist/utils/proxyMiddleware.js +56 -0
  250. package/dist/utils/s3Client.d.ts +5 -0
  251. package/dist/utils/s3Client.js +36 -0
  252. package/dist/utils/s3RuleUtils.d.ts +53 -0
  253. package/dist/utils/s3RuleUtils.js +101 -0
  254. package/dist/utils/useFeatures.d.ts +1 -0
  255. package/dist/utils/useFeatures.js +7 -0
  256. package/package.json +84 -0
@@ -0,0 +1,10 @@
1
+ import type { LifecycleRule } from "@aws-sdk/client-s3";
2
+ interface BucketLifecycleListProps {
3
+ bucketName: string;
4
+ lifecycleRules: LifecycleRule[];
5
+ lifecycleStatus?: "idle" | "loading" | "error" | "success";
6
+ onCreateRule?: () => void;
7
+ onEditRule?: (ruleId: string) => void;
8
+ }
9
+ export declare function BucketLifecycleList({ bucketName, lifecycleRules, lifecycleStatus, onCreateRule, onEditRule, }: BucketLifecycleListProps): import("react/jsx-runtime").JSX.Element;
10
+ export {};
@@ -0,0 +1,270 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { ConstrainedText, FormattedDateTime, Icon, Stack, Tooltip, Wrap, spacing } from "@scality/core-ui";
3
+ import { Box, Button, Table } from "@scality/core-ui/dist/next";
4
+ import { useMemo } from "react";
5
+ import { useDeleteBucketLifecycle, useSetBucketLifecycle } from "../../hooks/bucketConfiguration.js";
6
+ import { DeleteBucketConfigRuleButton } from "./DeleteBucketConfigRuleButton.js";
7
+ import { useTableRowSelection } from "../../hooks/useTableRowSelection.js";
8
+ const pluralizeDays = (days)=>1 === days ? `${days} day` : `${days} days`;
9
+ const formatActions = (rule)=>{
10
+ const actions = [];
11
+ if (rule.Expiration) {
12
+ if (rule.Expiration.Days) actions.push({
13
+ text: `Expire current (${pluralizeDays(rule.Expiration.Days)})`,
14
+ description: `Expire current versions of objects after ${pluralizeDays(rule.Expiration.Days)}`
15
+ });
16
+ else if (rule.Expiration.Date) actions.push({
17
+ text: "Expire current",
18
+ description: "Expire current versions of objects on date",
19
+ date: rule.Expiration.Date
20
+ });
21
+ else if (rule.Expiration.ExpiredObjectDeleteMarker) actions.push({
22
+ text: "Delete expired markers",
23
+ description: "Delete expired object delete markers"
24
+ });
25
+ }
26
+ if (rule.NoncurrentVersionExpiration?.NoncurrentDays) {
27
+ const keepText = rule.NoncurrentVersionExpiration.NewerNoncurrentVersions ? `, keep ${rule.NoncurrentVersionExpiration.NewerNoncurrentVersions}` : "";
28
+ const keepDescription = rule.NoncurrentVersionExpiration.NewerNoncurrentVersions ? `, keep ${rule.NoncurrentVersionExpiration.NewerNoncurrentVersions} newest versions` : "";
29
+ actions.push({
30
+ text: `Expire noncurrent (${pluralizeDays(rule.NoncurrentVersionExpiration.NoncurrentDays)}${keepText})`,
31
+ description: `Permanently delete noncurrent versions of objects after ${pluralizeDays(rule.NoncurrentVersionExpiration.NoncurrentDays)}${keepDescription}`
32
+ });
33
+ }
34
+ if (rule.Transitions && rule.Transitions.length > 0) rule.Transitions.forEach((transition)=>{
35
+ if (transition.Days) actions.push({
36
+ text: `Transition current (${pluralizeDays(transition.Days)})`,
37
+ description: `Transition current versions of objects after ${pluralizeDays(transition.Days)}`
38
+ });
39
+ else if (transition.Date) actions.push({
40
+ text: "Transition current",
41
+ description: "Transition current versions of objects on date",
42
+ date: transition.Date
43
+ });
44
+ });
45
+ if (rule.NoncurrentVersionTransitions && rule.NoncurrentVersionTransitions.length > 0) rule.NoncurrentVersionTransitions.forEach((transition)=>{
46
+ if (transition.NoncurrentDays) {
47
+ const keepText = transition.NewerNoncurrentVersions ? `, keep ${transition.NewerNoncurrentVersions}` : "";
48
+ const keepDescription = transition.NewerNoncurrentVersions ? `, keep ${transition.NewerNoncurrentVersions} newest versions` : "";
49
+ actions.push({
50
+ text: `Transition noncurrent (${pluralizeDays(transition.NoncurrentDays)}${keepText})`,
51
+ description: `Transition noncurrent versions of objects after ${pluralizeDays(transition.NoncurrentDays)}${keepDescription}`
52
+ });
53
+ }
54
+ });
55
+ if (rule.AbortIncompleteMultipartUpload?.DaysAfterInitiation) actions.push({
56
+ text: `Abort Incomplete MPU (${pluralizeDays(rule.AbortIncompleteMultipartUpload.DaysAfterInitiation)})`,
57
+ description: `Abort incomplete multipart uploads after ${pluralizeDays(rule.AbortIncompleteMultipartUpload.DaysAfterInitiation)}`
58
+ });
59
+ return actions.length > 0 ? actions : [
60
+ {
61
+ text: "-",
62
+ description: "-"
63
+ }
64
+ ];
65
+ };
66
+ function BucketLifecycleList({ bucketName, lifecycleRules, lifecycleStatus, onCreateRule, onEditRule }) {
67
+ const updateLifecycleMutation = useSetBucketLifecycle();
68
+ const deleteLifecycleMutation = useDeleteBucketLifecycle();
69
+ const columns = useMemo(()=>[
70
+ {
71
+ Header: "Rule ID",
72
+ accessor: "ID",
73
+ id: "id",
74
+ Cell: ({ value })=>/*#__PURE__*/ jsx(ConstrainedText, {
75
+ text: value || "-",
76
+ lineClamp: 2
77
+ }),
78
+ cellStyle: {
79
+ flex: "1",
80
+ width: "unset"
81
+ }
82
+ },
83
+ {
84
+ Header: "Status",
85
+ accessor: "Status",
86
+ id: "status",
87
+ Cell: ({ value })=>{
88
+ const statusText = "Enabled" === value ? "Active" : "Disabled" === value ? "Inactive" : value;
89
+ return /*#__PURE__*/ jsx("span", {
90
+ children: statusText || "-"
91
+ });
92
+ },
93
+ cellStyle: {
94
+ width: "unset",
95
+ flex: "0.5"
96
+ }
97
+ },
98
+ {
99
+ Header: "Actions",
100
+ accessor: "Actions",
101
+ id: "actions",
102
+ Cell: ({ value })=>{
103
+ if (!value || 0 === value.length || 1 === value.length && "-" === value[0].text) return /*#__PURE__*/ jsx("span", {
104
+ children: "-"
105
+ });
106
+ const firstAction = value[0];
107
+ const remainingCount = value.length - 1;
108
+ const renderWithDate = (text, date)=>{
109
+ if (date) return /*#__PURE__*/ jsxs(Fragment, {
110
+ children: [
111
+ text,
112
+ " (",
113
+ /*#__PURE__*/ jsx(FormattedDateTime, {
114
+ format: "date",
115
+ value: "string" == typeof date ? new Date(date) : date
116
+ }),
117
+ ")"
118
+ ]
119
+ });
120
+ return text;
121
+ };
122
+ const renderAction = (action)=>renderWithDate(action.text, action.date);
123
+ const renderDescription = (action)=>renderWithDate(action.description, action.date);
124
+ const multiActionTooltip = /*#__PURE__*/ jsx("ul", {
125
+ style: {
126
+ margin: 0,
127
+ paddingLeft: "1.5rem"
128
+ },
129
+ children: value.map((action, index)=>/*#__PURE__*/ jsx("li", {
130
+ children: renderDescription(action)
131
+ }, index))
132
+ });
133
+ if (value.length > 1) return /*#__PURE__*/ jsxs(Stack, {
134
+ gap: "r4",
135
+ direction: "horizontal",
136
+ children: [
137
+ /*#__PURE__*/ jsxs("span", {
138
+ children: [
139
+ renderAction(firstAction),
140
+ ", +",
141
+ remainingCount
142
+ ]
143
+ }),
144
+ /*#__PURE__*/ jsx(Tooltip, {
145
+ overlay: multiActionTooltip,
146
+ placement: "top",
147
+ overlayStyle: {
148
+ maxWidth: "30rem"
149
+ },
150
+ children: /*#__PURE__*/ jsx("span", {
151
+ style: {
152
+ cursor: "help"
153
+ },
154
+ children: /*#__PURE__*/ jsx(Icon, {
155
+ name: "Info",
156
+ size: "sm"
157
+ })
158
+ })
159
+ })
160
+ ]
161
+ });
162
+ return /*#__PURE__*/ jsx("span", {
163
+ children: renderAction(firstAction)
164
+ });
165
+ },
166
+ cellStyle: {
167
+ width: "unset",
168
+ flex: "1.5"
169
+ }
170
+ },
171
+ {
172
+ Header: "",
173
+ accessor: "ID",
174
+ id: "operations",
175
+ cellStyle: {
176
+ flex: "0.5",
177
+ textAlign: "right",
178
+ paddingRight: spacing.r16,
179
+ width: "unset"
180
+ },
181
+ Cell: ({ value })=>/*#__PURE__*/ jsxs(Box, {
182
+ display: "flex",
183
+ gap: spacing.r8,
184
+ justifyContent: "flex-end",
185
+ children: [
186
+ /*#__PURE__*/ jsx(Button, {
187
+ icon: /*#__PURE__*/ jsx(Icon, {
188
+ name: "Edit"
189
+ }),
190
+ variant: "secondary",
191
+ type: "button",
192
+ onClick: (e)=>{
193
+ e.stopPropagation();
194
+ onEditRule?.(value);
195
+ },
196
+ "aria-label": "Edit rule",
197
+ tooltip: {
198
+ overlay: "Edit rule"
199
+ }
200
+ }),
201
+ /*#__PURE__*/ jsx(DeleteBucketConfigRuleButton, {
202
+ bucketName: bucketName,
203
+ ruleId: value,
204
+ rules: lifecycleRules,
205
+ ruleType: "lifecycle",
206
+ updateMutation: updateLifecycleMutation,
207
+ deleteMutation: deleteLifecycleMutation,
208
+ buildUpdateInput: (remainingRules)=>({
209
+ LifecycleConfiguration: {
210
+ Rules: remainingRules
211
+ }
212
+ }),
213
+ successMessage: "Lifecycle rule deleted successfully",
214
+ errorMessage: "Failed to delete lifecycle rule"
215
+ })
216
+ ]
217
+ })
218
+ }
219
+ ], [
220
+ bucketName,
221
+ lifecycleRules,
222
+ onEditRule
223
+ ]);
224
+ const tableData = useMemo(()=>lifecycleRules.map((rule)=>({
225
+ ID: rule.ID || "-",
226
+ Status: rule.Status || "Disabled",
227
+ Actions: formatActions(rule),
228
+ rule
229
+ })), [
230
+ lifecycleRules
231
+ ]);
232
+ const { selectedId, onRowSelected } = useTableRowSelection(tableData);
233
+ return /*#__PURE__*/ jsxs(Table, {
234
+ columns: columns,
235
+ data: tableData,
236
+ status: lifecycleStatus,
237
+ defaultSortingKey: "id",
238
+ entityName: {
239
+ en: {
240
+ singular: "lifecycle rule",
241
+ plural: "lifecycle rules"
242
+ }
243
+ },
244
+ children: [
245
+ /*#__PURE__*/ jsx(Wrap, {
246
+ padding: spacing.r16,
247
+ children: /*#__PURE__*/ jsx(Box, {
248
+ display: "flex",
249
+ justifyContent: "flex-end",
250
+ children: /*#__PURE__*/ jsx(Button, {
251
+ icon: /*#__PURE__*/ jsx(Icon, {
252
+ name: "Create-add"
253
+ }),
254
+ label: "Create Rule",
255
+ variant: "primary",
256
+ onClick: onCreateRule,
257
+ type: "button"
258
+ })
259
+ })
260
+ }),
261
+ /*#__PURE__*/ jsx(Table.SingleSelectableContent, {
262
+ rowHeight: "h48",
263
+ separationLineVariant: "backgroundLevel1",
264
+ selectedId: selectedId?.toString(),
265
+ onRowSelected: onRowSelected
266
+ })
267
+ ]
268
+ });
269
+ }
270
+ export { BucketLifecycleList };
@@ -0,0 +1,15 @@
1
+ import type { Bucket } from "@aws-sdk/client-s3";
2
+ import type { Column } from "@scality/core-ui/dist/components/tablev2/Tablev2.component";
3
+ interface BucketListProps<TData extends Bucket & Record<string, unknown> = Bucket & Record<string, unknown>> {
4
+ buckets: Bucket[];
5
+ bucketStatus?: "idle" | "loading" | "error" | "success";
6
+ selectedBucketName?: string | null;
7
+ onBucketSelect?: (bucketName: string) => void;
8
+ onCreateBucket?: () => void;
9
+ onNavigateToBucket?: (bucketName: string) => void;
10
+ renderBucketLocation?: (bucketName: string) => React.ReactNode;
11
+ additionalColumns?: Column<TData>[];
12
+ transformBucketData?: (bucket: Bucket) => TData;
13
+ }
14
+ export declare function BucketList<TData extends Bucket & Record<string, unknown> = Bucket & Record<string, unknown>>({ buckets, bucketStatus, selectedBucketName, onBucketSelect, onCreateBucket, onNavigateToBucket, renderBucketLocation, additionalColumns, transformBucketData, }: BucketListProps<TData>): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,146 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { ConstrainedText, FormattedDateTime, Icon, Link, Wrap, spacing } from "@scality/core-ui";
3
+ import { Box, Button, Table } from "@scality/core-ui/dist/next";
4
+ import { useMemo } from "react";
5
+ const SEARCH_QUERY_PARAM = "search";
6
+ function BucketList({ buckets, bucketStatus, selectedBucketName, onBucketSelect, onCreateBucket, onNavigateToBucket, renderBucketLocation, additionalColumns, transformBucketData }) {
7
+ const columns = useMemo(()=>{
8
+ const baseColumns = [
9
+ {
10
+ Header: "Bucket Name",
11
+ accessor: "Name",
12
+ id: "name",
13
+ Cell: ({ value, row })=>{
14
+ const name = value || row.original?.Name;
15
+ if (!name) return /*#__PURE__*/ jsx("span", {
16
+ children: "-"
17
+ });
18
+ return /*#__PURE__*/ jsx(ConstrainedText, {
19
+ text: /*#__PURE__*/ jsx(Link, {
20
+ onClick: (e)=>{
21
+ e.stopPropagation();
22
+ onNavigateToBucket?.(name);
23
+ },
24
+ children: name
25
+ }),
26
+ lineClamp: 2
27
+ });
28
+ },
29
+ cellStyle: {
30
+ flex: "1",
31
+ width: "unset"
32
+ }
33
+ },
34
+ {
35
+ Header: "Storage Location",
36
+ accessor: "Name",
37
+ id: "location",
38
+ Cell ({ value }) {
39
+ return renderBucketLocation ? renderBucketLocation(value) : /*#__PURE__*/ jsx("span", {
40
+ children: "-"
41
+ });
42
+ },
43
+ cellStyle: {
44
+ width: "unset",
45
+ flex: "1.2"
46
+ }
47
+ }
48
+ ];
49
+ if (additionalColumns) baseColumns.push(...additionalColumns);
50
+ baseColumns.push({
51
+ Header: "Created on",
52
+ accessor: "CreationDate",
53
+ id: "date",
54
+ cellStyle: {
55
+ flex: "1",
56
+ textAlign: "right",
57
+ paddingRight: spacing.r16,
58
+ width: "unset"
59
+ },
60
+ Cell: ({ value, row })=>{
61
+ const date = value || row.original?.CreationDate;
62
+ if (!date) return /*#__PURE__*/ jsx("span", {
63
+ children: "-"
64
+ });
65
+ return /*#__PURE__*/ jsx(FormattedDateTime, {
66
+ format: "date-time-second",
67
+ value: new Date(date)
68
+ });
69
+ }
70
+ });
71
+ return baseColumns;
72
+ }, [
73
+ onNavigateToBucket,
74
+ renderBucketLocation,
75
+ additionalColumns
76
+ ]);
77
+ const tableData = useMemo(()=>buckets.map((bucket)=>{
78
+ if (transformBucketData) return transformBucketData(bucket);
79
+ const { Name, CreationDate, ...rest } = bucket;
80
+ return {
81
+ Name,
82
+ CreationDate,
83
+ ...rest
84
+ };
85
+ }), [
86
+ buckets,
87
+ transformBucketData
88
+ ]);
89
+ const selectedId = useMemo(()=>{
90
+ if (buckets && selectedBucketName) return buckets.findIndex((bucket)=>bucket.Name === selectedBucketName);
91
+ return null;
92
+ }, [
93
+ selectedBucketName,
94
+ buckets
95
+ ]);
96
+ return /*#__PURE__*/ jsxs(Table, {
97
+ columns: columns,
98
+ data: tableData,
99
+ status: bucketStatus,
100
+ defaultSortingKey: "CreationDate",
101
+ entityName: {
102
+ en: {
103
+ singular: "bucket",
104
+ plural: "buckets"
105
+ }
106
+ },
107
+ children: [
108
+ /*#__PURE__*/ jsxs(Wrap, {
109
+ padding: spacing.r16,
110
+ children: [
111
+ /*#__PURE__*/ jsx(Box, {
112
+ display: "flex",
113
+ justifyContent: "space-between",
114
+ alignItems: "center",
115
+ gap: spacing.r4,
116
+ children: /*#__PURE__*/ jsx(Table.SearchWithQueryParams, {
117
+ queryParams: SEARCH_QUERY_PARAM
118
+ })
119
+ }),
120
+ /*#__PURE__*/ jsx(Box, {
121
+ gap: "r16",
122
+ children: /*#__PURE__*/ jsx(Button, {
123
+ icon: /*#__PURE__*/ jsx(Icon, {
124
+ name: "Create-add"
125
+ }),
126
+ label: "Create Bucket",
127
+ variant: "primary",
128
+ onClick: onCreateBucket,
129
+ type: "submit"
130
+ })
131
+ })
132
+ ]
133
+ }),
134
+ /*#__PURE__*/ jsx(Table.SingleSelectableContent, {
135
+ rowHeight: "h40",
136
+ selectedId: selectedId?.toString(),
137
+ onRowSelected: (row)=>{
138
+ const isSelected = selectedBucketName === row.original.Name;
139
+ if (!isSelected && row.original.Name) onBucketSelect?.(row.original.Name);
140
+ },
141
+ separationLineVariant: "backgroundLevel1"
142
+ })
143
+ ]
144
+ });
145
+ }
146
+ export { BucketList };
@@ -0,0 +1,3 @@
1
+ export declare const BucketLocation: ({ bucketName }: {
2
+ bucketName: string;
3
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useGetBucketLocation } from "../../hooks/index.js";
3
+ import { Loader } from "@scality/core-ui";
4
+ const BucketLocation = ({ bucketName })=>{
5
+ const { data: bucketLocation, status } = useGetBucketLocation({
6
+ Bucket: bucketName
7
+ });
8
+ if ("pending" === status) return /*#__PURE__*/ jsx(Loader, {});
9
+ if ("error" === status) return /*#__PURE__*/ jsx("div", {
10
+ children: "Error"
11
+ });
12
+ return /*#__PURE__*/ jsx("div", {
13
+ children: bucketLocation?.LocationConstraint || "us-east-1"
14
+ });
15
+ };
16
+ export { BucketLocation };
@@ -0,0 +1,88 @@
1
+ import React from "react";
2
+ interface BucketOverviewContextValue {
3
+ bucketName: string;
4
+ }
5
+ /**
6
+ * Context for BucketOverview component.
7
+ *
8
+ * **Important**: Always use `useBucketOverviewContext()` hook instead of accessing this context directly.
9
+ * The hook provides proper error handling if the context is not available.
10
+ *
11
+ * This context is exported for testing purposes only.
12
+ */
13
+ export declare const BucketOverviewContext: React.Context<BucketOverviewContextValue | null>;
14
+ export declare function useBucketOverviewContext(): BucketOverviewContextValue;
15
+ interface BucketOverviewProps {
16
+ bucketName: string;
17
+ children: React.ReactNode;
18
+ }
19
+ interface ActionsProps {
20
+ onEmptyBucket?: () => void;
21
+ onDeleteBucket?: () => void;
22
+ renderEmptyButton?: (bucketName: string) => React.ReactNode;
23
+ renderDeleteButton?: (bucketName: string) => React.ReactNode;
24
+ isEmptyBucketDisabled?: boolean;
25
+ isDeleteBucketDisabled?: boolean;
26
+ }
27
+ declare const Actions: React.FC<ActionsProps>;
28
+ interface SectionProps {
29
+ title: string;
30
+ children: React.ReactNode;
31
+ }
32
+ declare const Section: React.FC<SectionProps>;
33
+ interface FieldProps {
34
+ label: string;
35
+ value?: React.ReactNode;
36
+ loading?: boolean;
37
+ error?: boolean;
38
+ errorMessage?: string;
39
+ children?: React.ReactNode;
40
+ actions?: React.ReactNode;
41
+ }
42
+ declare const Field: React.FC<FieldProps>;
43
+ interface SectionsProps {
44
+ children: React.ReactNode;
45
+ }
46
+ declare const Sections: React.FC<SectionsProps>;
47
+ interface GeneralSectionProps {
48
+ nameField?: React.ReactNode;
49
+ versioningField?: React.ReactNode;
50
+ locationField?: React.ReactNode;
51
+ renderName?: (bucketName: string) => React.ReactNode;
52
+ renderVersioning?: (bucketName: string) => React.ReactNode;
53
+ renderLocation?: (bucketName: string) => React.ReactNode;
54
+ }
55
+ declare const GeneralSection: React.FC<GeneralSectionProps>;
56
+ interface DataProtectionSectionProps {
57
+ objectLockField?: React.ReactNode;
58
+ defaultRetentionField?: React.ReactNode;
59
+ renderObjectLock?: (bucketName: string) => React.ReactNode;
60
+ renderDefaultRetention?: (bucketName: string) => React.ReactNode;
61
+ }
62
+ declare const DataProtectionSection: React.FC<DataProtectionSectionProps>;
63
+ interface PermissionsSectionProps {
64
+ onEditPolicy?: (bucketName: string) => void;
65
+ ownerField?: React.ReactNode;
66
+ aclField?: React.ReactNode;
67
+ corsField?: React.ReactNode;
68
+ publicField?: React.ReactNode;
69
+ bucketPolicyField?: React.ReactNode;
70
+ renderOwner?: (bucketName: string) => React.ReactNode;
71
+ renderAcl?: (bucketName: string) => React.ReactNode;
72
+ renderCors?: (bucketName: string) => React.ReactNode;
73
+ renderPublic?: (bucketName: string) => React.ReactNode;
74
+ renderBucketPolicy?: (bucketName: string, onEditPolicy?: (name: string) => void) => React.ReactNode;
75
+ }
76
+ declare const PermissionsSection: React.FC<PermissionsSectionProps>;
77
+ type BucketOverviewComponent = React.FC<BucketOverviewProps> & {
78
+ Actions: typeof Actions;
79
+ Sections: typeof Sections;
80
+ Section: typeof Section;
81
+ Field: typeof Field;
82
+ GeneralSection: typeof GeneralSection;
83
+ DataProtectionSection: typeof DataProtectionSection;
84
+ PermissionsSection: typeof PermissionsSection;
85
+ };
86
+ declare const BucketOverview: BucketOverviewComponent;
87
+ export { BucketOverview };
88
+ export { Section as BucketOverviewSection, Field as BucketOverviewField };