15768: cleanup Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox@curii.com>
authorLisa Knox <lisaknox83@gmail.com>
Mon, 22 May 2023 15:42:08 +0000 (11:42 -0400)
committerLisa Knox <lisaknox83@gmail.com>
Mon, 22 May 2023 15:42:08 +0000 (11:42 -0400)
src/components/multiselectToolbar/MultiselectToolbar.tsx
src/store/processes/processes-actions.ts

index 2409bc9ce73b3ac308e0f0c8ecb585cbd7d53230..fc036b29644291a5cb7b5220e2f547857eaafffd 100644 (file)
@@ -86,7 +86,8 @@ export const MultiselectToolbar = connect(
     withStyles(styles)((props: MultiselectToolbarProps & WithStyles<CssRules>) => {
         // console.log(props);
         const { classes, actions, isVisible, checkedList } = props;
-        const currentResourceKinds = Array.from(new Set(selectedToArray(checkedList).map((element) => extractUuidKind(element))));
+
+        const currentResourceKinds = Array.from(selectedToKindSet(checkedList));
         const buttons = actions.filter((action) => currentResourceKinds.length && currentResourceKinds.every((kind) => action.relevantKinds.has(kind as ResourceKind)));
 
         return (
@@ -105,7 +106,7 @@ export const MultiselectToolbar = connect(
     })
 );
 
-function selectedToArray<T>(checkedList: TCheckedList): Array<string> {
+function selectedToArray(checkedList: TCheckedList): Array<string> {
     const arrayifiedSelectedList: Array<string> = [];
     for (const [key, value] of Object.entries(checkedList)) {
         if (value === true) {
@@ -115,6 +116,16 @@ function selectedToArray<T>(checkedList: TCheckedList): Array<string> {
     return arrayifiedSelectedList;
 }
 
+function selectedToKindSet(checkedList: TCheckedList): Set<string> {
+    const setifiedList = new Set<string>();
+    for (const [key, value] of Object.entries(checkedList)) {
+        if (value === true) {
+            setifiedList.add(extractUuidKind(key) as string);
+        }
+    }
+    return setifiedList;
+}
+
 function mapStateToProps(state: RootState) {
     const { isVisible, checkedList } = state.multiselect;
     return {
@@ -133,6 +144,6 @@ function mapDispatchToProps(dispatch: Dispatch) {
 }
 
 function removeMulti(dispatch: Dispatch, checkedList: TCheckedList): void {
-    const list: Array<string> = selectedToArray(checkedList);
-    dispatch<any>(list.length === 1 ? openRemoveProcessDialog(list[0]) : openRemoveManyProcessesDialog(list));
+    const selectedList: Array<string> = selectedToArray(checkedList);
+    dispatch<any>(selectedList.length === 1 ? openRemoveProcessDialog(selectedList[0]) : openRemoveManyProcessesDialog(selectedList));
 }
index 8e481687626afd7dc4569ceec0328c2fa9a0891d..1d3be43533f52612b3e45e118bd36b8171339328 100644 (file)
@@ -302,7 +302,7 @@ export const openRemoveManyProcessesDialog = (list: Array<string>) => (dispatch:
             id: REMOVE_MANY_PROCESSES_DIALOG,
             data: {
                 title: 'Remove processes permanently',
-                text: `Are you sure you want to remove all ${list.length} processes?`,
+                text: `Are you sure you want to remove these ${list.length} processes?`,
                 confirmButtonLabel: 'Remove',
                 list,
             },