[arvados-workbench2] updated: 2.6.0-51-g55c0fe47

git repository hosting git at public.arvados.org
Fri Jul 7 19:45:21 UTC 2023


Summary of changes:
 .../multiselectToolbar/MultiselectToolbar.tsx      | 24 ++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

       via  55c0fe472ca9938c93a78bbff0e0fb1b5e51a54e (commit)
      from  76fe6edc8d158f67c600f75c6bb351d7a679b71e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 55c0fe472ca9938c93a78bbff0e0fb1b5e51a54e
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Fri Jul 7 15:45:12 2023 -0400

    15768: button filtering algo works badly Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/src/components/multiselectToolbar/MultiselectToolbar.tsx b/src/components/multiselectToolbar/MultiselectToolbar.tsx
index 3fc4e81d..6b16fd31 100644
--- a/src/components/multiselectToolbar/MultiselectToolbar.tsx
+++ b/src/components/multiselectToolbar/MultiselectToolbar.tsx
@@ -120,13 +120,15 @@ function filterActions(actionArray: ContextMenuActionSet, filters: Array<string>
 
 //this might be the least efficient algorithm I've ever written
 function selectActionsByKind(currentResourceKinds: Array<string>, filterSet: TMultiselectActionsFilters) {
-    const result: Array<ContextMenuAction> = [];
+    let result: Array<ContextMenuAction> = [];
+    const fullFilterArray: ContextMenuAction[][] = [];
     //start at currentResourceKinds
     currentResourceKinds.forEach((kind) => {
         //if there is a matching filter set
         if (filterSet[kind]) {
             //filter actions that apply to current kind
             const actions = filterActions(...filterSet[kind]);
+            fullFilterArray.push(actions);
             //if action name isn't in result, push name
             actions.forEach((action) => {
                 if (!result.some((item) => item.name === action.name)) {
@@ -135,8 +137,26 @@ function selectActionsByKind(currentResourceKinds: Array<string>, filterSet: TMu
             });
         }
     });
+    // console.log(result, fullFilterArray);
+    ///take fullFilterSet, make it into an array of string sets
+    const filteredNameSet = fullFilterArray.map((filterArray) => {
+        const resultSet = new Set();
+        filterArray.forEach((action) => resultSet.add(action.name || ''));
+        return resultSet;
+    });
+    console.log('filteredNameSet', filteredNameSet);
+    //filter results so that the name of each action is present in all of this string arrays
+    const filteredResult = result.filter((action) => {
+        for (let i = 0; i < filteredNameSet.length; i++) {
+            if (!filteredNameSet[i].has(action.name)) return false;
+        }
+        return true;
+    });
+
+    console.log('filteredResult', filteredResult);
+
     //return sorted array of actions
-    return result.sort((a, b) => {
+    return filteredResult.sort((a, b) => {
         a.name = a.name || '';
         b.name = b.name || '';
         if (a.name < b.name) {

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list