[arvados] updated: 2.7.0-6266-gb8aa1aef3a
git repository hosting
git at public.arvados.org
Fri Mar 29 13:48:13 UTC 2024
Summary of changes:
.../context-menu/menu-item-sort.ts | 65 ++++++++++++++++++++--
1 file changed, 61 insertions(+), 4 deletions(-)
via b8aa1aef3a5f883d86d548aee9aecf82d3df82db (commit)
from f093cf66138faec359a95777a91b6a2904469d7d (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 b8aa1aef3a5f883d86d548aee9aecf82d3df82db
Author: Lisa Knox <lisaknox83 at gmail.com>
Date: Fri Mar 29 09:48:10 2024 -0400
21448: applied sort to all context menus in ticket Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox at curii.com>
diff --git a/services/workbench2/src/views-components/context-menu/menu-item-sort.ts b/services/workbench2/src/views-components/context-menu/menu-item-sort.ts
index 7e14fb6ec1..f321b5ed76 100644
--- a/services/workbench2/src/views-components/context-menu/menu-item-sort.ts
+++ b/services/workbench2/src/views-components/context-menu/menu-item-sort.ts
@@ -67,23 +67,80 @@ const processOrder = [
ContextMenuActionNames.ADD_TO_PUBLIC_FAVORITES,
];
+const projectOrder = [
+ ContextMenuActionNames.VIEW_DETAILS,
+ ContextMenuActionNames.OPEN_IN_NEW_TAB,
+ ContextMenuActionNames.COPY_TO_CLIPBOARD,
+ ContextMenuActionNames.OPEN_WITH_3RD_PARTY_CLIENT,
+ ContextMenuActionNames.API_DETAILS,
+ ContextMenuActionNames.NEW_PROJECT,
+ ContextMenuActionNames.EDIT_PROJECT,
+ ContextMenuActionNames.SHARE,
+ ContextMenuActionNames.MOVE_TO,
+ ContextMenuActionNames.REMOVE,
+ ContextMenuActionNames.FREEZE_PROJECT,
+ ContextMenuActionNames.ADD_TO_FAVORITES,
+ ContextMenuActionNames.ADD_TO_PUBLIC_FAVORITES,
+];
+
+const collectionOrder = [
+ ContextMenuActionNames.VIEW_DETAILS,
+ ContextMenuActionNames.OPEN_IN_NEW_TAB,
+ ContextMenuActionNames.COPY_TO_CLIPBOARD,
+ ContextMenuActionNames.OPEN_WITH_3RD_PARTY_CLIENT,
+ ContextMenuActionNames.API_DETAILS,
+ ContextMenuActionNames.NEW_COLLECTION,
+ ContextMenuActionNames.EDIT_COLLECTION,
+ ContextMenuActionNames.SHARE,
+ ContextMenuActionNames.MOVE_TO,
+ ContextMenuActionNames.MAKE_A_COPY,
+ ContextMenuActionNames.MOVE_TO_TRASH,
+ ContextMenuActionNames.ADD_TO_FAVORITES,
+ ContextMenuActionNames.ADD_TO_PUBLIC_FAVORITES,
+];
+
+const workflowOrder = [
+ ContextMenuActionNames.VIEW_DETAILS,
+ ContextMenuActionNames.OPEN_IN_NEW_TAB,
+ ContextMenuActionNames.COPY_TO_CLIPBOARD,
+ ContextMenuActionNames.API_DETAILS,
+ ContextMenuActionNames.RUN_WORKFLOW,
+ ContextMenuActionNames.REMOVE,
+]
+
const kindToOrder: Record<string, ContextMenuActionNames[]> = {
+ [ContextMenuKind.PROCESS]: processOrder,
+ [ContextMenuKind.PROCESS_ADMIN]: processOrder,
[ContextMenuKind.PROCESS_RESOURCE]: processOrder,
+
+ [ContextMenuKind.PROJECT]: projectOrder,
+ [ContextMenuKind.PROJECT_ADMIN]: projectOrder,
+ [ContextMenuKind.FROZEN_PROJECT]: projectOrder,
+ [ContextMenuKind.FROZEN_PROJECT_ADMIN]: projectOrder,
+
+ [ContextMenuKind.COLLECTION]: collectionOrder,
+ [ContextMenuKind.COLLECTION_ADMIN]: collectionOrder,
+ [ContextMenuKind.READONLY_COLLECTION]: collectionOrder,
+ [ContextMenuKind.OLD_VERSION_COLLECTION]: collectionOrder,
+
+ [ContextMenuKind.WORKFLOW]: workflowOrder,
+ [ContextMenuKind.READONLY_WORKFLOW]: workflowOrder,
};
export const sortMenuItems = (menuKind: ContextMenuKind, menuItems: ContextMenuAction[]) => {
- const order = kindToOrder[menuKind];
+
+ const preferredOrder = kindToOrder[menuKind];
//if no specified order, sort by name
- if (!order) return menuItems.sort(sortByProperty("name"));
+ if (!preferredOrder) return menuItems.sort(sortByProperty("name"));
const bucketMap = new Map();
const leftovers: ContextMenuAction[] = [];
- order.forEach((name) => bucketMap.set(name, null));
+ preferredOrder.forEach((name) => bucketMap.set(name, null));
menuItems.forEach((item) => {
if (bucketMap.has(item.name)) bucketMap.set(item.name, item);
else leftovers.push(item);
});
-
+
return Array.from(bucketMap.values()).concat(leftovers).filter((item) => item !== null);
};
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list