From 9c63bad6ee07a59a74dcd9769f45db1bc36899b5 Mon Sep 17 00:00:00 2001
From: Alex <33497058+bexsoft@users.noreply.github.com>
Date: Sat, 5 Mar 2022 08:44:28 -0700
Subject: [PATCH] Added select all buckets functionality (#1672)
---
portal-ui/src/icons/SelectAllIcon.tsx | 55 +++++++++++++++++++
portal-ui/src/icons/index.ts | 1 +
.../Buckets/ListBuckets/ListBuckets.tsx | 40 +++++++++++++-
.../screens/Console/Common/IconsScreen.tsx | 6 ++
4 files changed, 100 insertions(+), 2 deletions(-)
create mode 100644 portal-ui/src/icons/SelectAllIcon.tsx
diff --git a/portal-ui/src/icons/SelectAllIcon.tsx b/portal-ui/src/icons/SelectAllIcon.tsx
new file mode 100644
index 000000000..e2fef06f7
--- /dev/null
+++ b/portal-ui/src/icons/SelectAllIcon.tsx
@@ -0,0 +1,55 @@
+// This file is part of MinIO Console Server
+// Copyright (c) 2022 MinIO, Inc.
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+import * as React from "react";
+import { SVGProps } from "react";
+
+const SelectAllIcon = (props: SVGProps) => (
+
+);
+
+export default SelectAllIcon;
diff --git a/portal-ui/src/icons/index.ts b/portal-ui/src/icons/index.ts
index d432c7eff..6994b618f 100644
--- a/portal-ui/src/icons/index.ts
+++ b/portal-ui/src/icons/index.ts
@@ -178,3 +178,4 @@ export { default as AlertCloseIcon } from "./AlertCloseIcon";
export { default as OpenSourceIcon } from "./OpenSourceIcon";
export { default as ArrowRightLink } from "./ArrowRightLink";
export { default as LicenseDocIcon } from "./LicenseDocIcon";
+export { default as SelectAllIcon } from "./SelectAllIcon";
diff --git a/portal-ui/src/screens/Console/Buckets/ListBuckets/ListBuckets.tsx b/portal-ui/src/screens/Console/Buckets/ListBuckets/ListBuckets.tsx
index ac36ad340..e86e82617 100644
--- a/portal-ui/src/screens/Console/Buckets/ListBuckets/ListBuckets.tsx
+++ b/portal-ui/src/screens/Console/Buckets/ListBuckets/ListBuckets.tsx
@@ -22,7 +22,12 @@ import withStyles from "@mui/styles/withStyles";
import { LinearProgress } from "@mui/material";
import Grid from "@mui/material/Grid";
import { Bucket, BucketList } from "../types";
-import { AddIcon, BucketsIcon, LifecycleConfigIcon } from "../../../../icons";
+import {
+ AddIcon,
+ BucketsIcon,
+ LifecycleConfigIcon,
+ SelectAllIcon,
+} from "../../../../icons";
import { setErrorSnackMessage } from "../../../../actions";
import {
containerForHeader,
@@ -176,6 +181,19 @@ const ListBuckets = ({
return null;
};
+ const selectAllBuckets = () => {
+ if (selectedBuckets.length === filteredRecords.length) {
+ setSelectedBuckets([]);
+ return;
+ }
+
+ const selectAllBuckets = filteredRecords.map((bucket) => {
+ return bucket.name;
+ });
+
+ setSelectedBuckets(selectAllBuckets);
+ };
+
const canCreateBucket = hasPermission("*", [IAM_SCOPES.S3_CREATE_BUCKET]);
return (
@@ -212,9 +230,12 @@ const ListBuckets = ({
justifyContent={"flex-end"}
>
{
setBulkSelect(!bulkSelect);
+ setSelectedBuckets([]);
}}
text={""}
icon={}
@@ -222,6 +243,21 @@ const ListBuckets = ({
variant={bulkSelect ? "contained" : "outlined"}
/>
+ {bulkSelect && (
+ }
+ color={"primary"}
+ variant={"outlined"}
+ />
+ )}
+
{
diff --git a/portal-ui/src/screens/Console/Common/IconsScreen.tsx b/portal-ui/src/screens/Console/Common/IconsScreen.tsx
index e7372ad4c..47cd44629 100644
--- a/portal-ui/src/screens/Console/Common/IconsScreen.tsx
+++ b/portal-ui/src/screens/Console/Common/IconsScreen.tsx
@@ -857,6 +857,12 @@ const IconsScreen = ({ classes }: IIconsScreenSimple) => {
SearchIcon
+
+
+
+ SelectAllIcon
+
+