[arvados] updated: 2.7.0-6269-ge2041e8190

git repository hosting git at public.arvados.org
Fri Mar 29 15:08:14 UTC 2024


Summary of changes:
 .../multiselect-toolbar/MultiselectToolbar.tsx     | 23 +++++++++-------------
 1 file changed, 9 insertions(+), 14 deletions(-)

       via  e2041e819042f1051fc026aaee2c73823824fc56 (commit)
      from  5e5d32ab61b3a6e063ca43fbedb0483257affa22 (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 e2041e819042f1051fc026aaee2c73823824fc56
Author: Lisa Knox <lisaknox83 at gmail.com>
Date:   Fri Mar 29 11:08:11 2024 -0400

    21448: ms toolbar sorted Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>

diff --git a/services/workbench2/src/components/multiselect-toolbar/MultiselectToolbar.tsx b/services/workbench2/src/components/multiselect-toolbar/MultiselectToolbar.tsx
index ff4e6072fb..5b39e925bf 100644
--- a/services/workbench2/src/components/multiselect-toolbar/MultiselectToolbar.tsx
+++ b/services/workbench2/src/components/multiselect-toolbar/MultiselectToolbar.tsx
@@ -34,7 +34,8 @@ import { Process } from "store/processes/process";
 import { PublicFavoritesState } from "store/public-favorites/public-favorites-reducer";
 import { isExactlyOneSelected } from "store/multiselect/multiselect-actions";
 import { IntersectionObserverWrapper } from "./ms-toolbar-overflow-wrapper";
-import { ContextMenuKind } from 'views-components/context-menu/menu-item-sort';
+import { ContextMenuKind, sortMenuItems } from 'views-components/context-menu/menu-item-sort';
+import { sortByProperty } from "common/array-utils";
 
 const WIDTH_TRANSITION = 150
 
@@ -96,6 +97,7 @@ export const MultiselectToolbar = connect(
     withStyles(styles)((props: MultiselectToolbarProps & WithStyles<CssRules>) => {
         const { classes, checkedList, singleSelectedUuid, iconProps, user, disabledButtons } = props;
         const singleResourceKind = singleSelectedUuid ? [resourceToMsResourceKind(singleSelectedUuid, iconProps.resources, user)] : null
+        console.log(singleResourceKind)
         const currentResourceKinds = singleResourceKind ? singleResourceKind : Array.from(selectedToKindSet(checkedList));
         const currentPathIsTrash = window.location.pathname === "/trash";
         const [isTransitioning, setIsTransitioning] = useState(false);
@@ -111,12 +113,15 @@ export const MultiselectToolbar = connect(
                 handleTransition()
         }, [checkedList])
 
-        const actions =
+        const rawActions =
             currentPathIsTrash && selectedToKindSet(checkedList).size
                 ? [msToggleTrashAction]
                 : selectActionsByKind(currentResourceKinds as string[], multiselectActionsFilters).filter((action) =>
                         singleSelectedUuid === null ? action.isForMulti : true
                     );
+                    
+        const actions =
+            singleResourceKind && singleResourceKind.length ? sortMenuItems(singleResourceKind[0] as ContextMenuKind, rawActions) : rawActions.sort(sortByProperty('name'));
 
         return (
             <React.Fragment>
@@ -273,7 +278,7 @@ const resourceToMsResourceKind = (uuid: string, resources: ResourcesState, user:
     }
 }; 
 
-function selectActionsByKind(currentResourceKinds: Array<string>, filterSet: TMultiselectActionsFilters) {
+function selectActionsByKind(currentResourceKinds: Array<string>, filterSet: TMultiselectActionsFilters): MultiSelectMenuAction[] {
     const rawResult: Set<MultiSelectMenuAction> = new Set();
     const resultNames = new Set();
     const allFiltersArray: MultiSelectMenuAction[][] = []
@@ -303,17 +308,7 @@ function selectActionsByKind(currentResourceKinds: Array<string>, filterSet: TMu
         return true;
     });
 
-    return filteredResult.sort((a, b) => {
-        const nameA = a.name || "";
-        const nameB = b.name || "";
-        if (nameA < nameB) {
-            return -1;
-        }
-        if (nameA > nameB) {
-            return 1;
-        }
-        return 0;
-    });
+    return filteredResult;
 }
 
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list