X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/cb690390d4f253c3bbb9c543e243cf988f39fbb3..f523522e3b9024b706da52bcddbce42a58c56296:/services/workbench2/src/views-components/context-menu/context-menu.tsx

diff --git a/services/workbench2/src/views-components/context-menu/context-menu.tsx b/services/workbench2/src/views-components/context-menu/context-menu.tsx
index aeb69de762..a173399b7b 100644
--- a/services/workbench2/src/views-components/context-menu/context-menu.tsx
+++ b/services/workbench2/src/views-components/context-menu/context-menu.tsx
@@ -10,7 +10,7 @@ import { createAnchorAt } from "components/popover/helpers";
 import { ContextMenuActionSet, ContextMenuAction } from "./context-menu-action-set";
 import { Dispatch } from "redux";
 import { memoize } from "lodash";
-import { sortByProperty } from "common/array-utils";
+import { sortMenuItems, ContextMenuKind, menuDirection } from "./menu-item-sort";
 
 type DataProps = Pick<ContextMenuProps, "anchorEl" | "items" | "open"> & { resource?: ContextMenuResource };
 
@@ -65,59 +65,11 @@ export const ContextMenu = connect(mapStateToProps, mapDispatchToProps, mergePro
 
 const menuActionSets = new Map<string, ContextMenuActionSet>();
 
-export const addMenuActionSet = (name: string, itemSet: ContextMenuActionSet) => {
-    const sorted = itemSet.map(items => items.sort(sortByProperty("name")));
+export const addMenuActionSet = (name: ContextMenuKind, itemSet: ContextMenuActionSet) => {
+    const sorted = itemSet.map(items => sortMenuItems(name, items, menuDirection.VERTICAL));
     menuActionSets.set(name, sorted);
 };
 
 const emptyActionSet: ContextMenuActionSet = [];
 const getMenuActionSet = (resource?: ContextMenuResource): ContextMenuActionSet =>
     resource ? menuActionSets.get(resource.menuKind) || emptyActionSet : emptyActionSet;
-
-export enum ContextMenuKind {
-    API_CLIENT_AUTHORIZATION = "ApiClientAuthorization",
-    ROOT_PROJECT = "RootProject",
-    PROJECT = "Project",
-    FILTER_GROUP = "FilterGroup",
-    READONLY_PROJECT = "ReadOnlyProject",
-    FROZEN_PROJECT = "FrozenProject",
-    FROZEN_PROJECT_ADMIN = "FrozenProjectAdmin",
-    PROJECT_ADMIN = "ProjectAdmin",
-    FILTER_GROUP_ADMIN = "FilterGroupAdmin",
-    RESOURCE = "Resource",
-    FAVORITE = "Favorite",
-    TRASH = "Trash",
-    COLLECTION_FILES = "CollectionFiles",
-    COLLECTION_FILES_MULTIPLE = "CollectionFilesMultiple",
-    READONLY_COLLECTION_FILES = "ReadOnlyCollectionFiles",
-    READONLY_COLLECTION_FILES_MULTIPLE = "ReadOnlyCollectionFilesMultiple",
-    COLLECTION_FILES_NOT_SELECTED = "CollectionFilesNotSelected",
-    COLLECTION_FILE_ITEM = "CollectionFileItem",
-    COLLECTION_DIRECTORY_ITEM = "CollectionDirectoryItem",
-    READONLY_COLLECTION_FILE_ITEM = "ReadOnlyCollectionFileItem",
-    READONLY_COLLECTION_DIRECTORY_ITEM = "ReadOnlyCollectionDirectoryItem",
-    COLLECTION = "Collection",
-    COLLECTION_ADMIN = "CollectionAdmin",
-    READONLY_COLLECTION = "ReadOnlyCollection",
-    OLD_VERSION_COLLECTION = "OldVersionCollection",
-    TRASHED_COLLECTION = "TrashedCollection",
-    PROCESS = "Process",
-    RUNNING_PROCESS_ADMIN = "RunningProcessAdmin",
-    PROCESS_ADMIN = "ProcessAdmin",
-    RUNNING_PROCESS_RESOURCE = "RunningProcessResource",
-    PROCESS_RESOURCE = "ProcessResource",
-    READONLY_PROCESS_RESOURCE = "ReadOnlyProcessResource",
-    PROCESS_LOGS = "ProcessLogs",
-    REPOSITORY = "Repository",
-    SSH_KEY = "SshKey",
-    VIRTUAL_MACHINE = "VirtualMachine",
-    KEEP_SERVICE = "KeepService",
-    USER = "User",
-    GROUPS = "Group",
-    GROUP_MEMBER = "GroupMember",
-    PERMISSION_EDIT = "PermissionEdit",
-    LINK = "Link",
-    WORKFLOW = "Workflow",
-    READONLY_WORKFLOW = "ReadOnlyWorkflow",
-    SEARCH_RESULTS = "SearchResults",
-}
