21224: changed user card toolbar item order
authorLisa Knox <lisaknox83@gmail.com>
Thu, 16 May 2024 18:10:08 +0000 (14:10 -0400)
committerLisa Knox <lisaknox83@gmail.com>
Thu, 16 May 2024 18:10:08 +0000 (14:10 -0400)
Arvados-DCO-1.1-Signed-off-by: Lisa Knox <lisa.knox@curii.com>

services/workbench2/src/views-components/context-menu/menu-item-sort.ts
services/workbench2/src/views-components/multiselect-toolbar/ms-user-details-action-set.ts

index 0e06be1685aef6b8bf3e3d707aca51d4eab45e74..f60842c94eaa3c82020f45e342601ece704b145d 100644 (file)
@@ -121,6 +121,12 @@ const workflowOrder = [
     ContextMenuActionNames.DELETE_WORKFLOW,
 ]
 
+const rootProjectOrder = [
+    ContextMenuActionNames.VIEW_DETAILS,
+    ContextMenuActionNames.USER_ACCOUNT,
+    ContextMenuActionNames.API_DETAILS,
+];
+
 const defaultMultiOrder = [
     ContextMenuActionNames.MOVE_TO,
     ContextMenuActionNames.MAKE_A_COPY,
@@ -148,6 +154,9 @@ const kindToOrder: Record<string, ContextMenuActionNames[]> = {
 
     [ContextMenuKind.WORKFLOW]: workflowOrder,
     [ContextMenuKind.READONLY_WORKFLOW]: workflowOrder,
+
+    [ContextMenuKind.ROOT_PROJECT]: rootProjectOrder,
+    [ContextMenuKind.ROOT_PROJECT_ADMIN]: rootProjectOrder,
 };
 
 export const menuDirection = {
index ff54d26dd21f0cd23b18f4f7500efc7e724371b7..8ed9b9df035ee65fb017a81db94b560d134dc0e1 100644 (file)
@@ -2,54 +2,40 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { AdvancedIcon, AttributesIcon, UserPanelIcon } from 'components/icon/icon';
+import { AdvancedIcon, DetailsIcon, UserPanelIcon } from 'components/icon/icon';
+import { toggleDetailsPanel } from 'store/details-panel/details-panel-action';
 import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab';
 import { navigateToUserProfile } from 'store/navigation/navigation-action';
 import { ContextMenuActionNames } from "views-components/context-menu/context-menu-action-set";
 import { MultiSelectMenuActionSet } from './ms-menu-actions';
-import { Dispatch } from 'redux';
-import { RootState } from 'store/store';
-import { ServiceRepository } from 'services/services';
-import { dialogActions } from 'store/dialog/dialog-actions';
-import { UserResource } from 'models/user';
-import { getResource } from 'store/resources/resources';
-
-const USER_ATTRIBUTES_DIALOG = 'userAttributesDialog';
-
-const msOpenUserAttributes = (uuid: string) =>
-    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
-        const { resources } = getState();
-        const data = getResource<UserResource>(uuid)(resources);
-        dispatch(dialogActions.OPEN_DIALOG({ id: USER_ATTRIBUTES_DIALOG, data }));
-    };
 
 export const UserDetailsActionSet: MultiSelectMenuActionSet= [
     [
         {
-            name: ContextMenuActionNames.ATTRIBUTES,
-            icon: AttributesIcon,
+            name: ContextMenuActionNames.VIEW_DETAILS,
+            icon: DetailsIcon,
             hasAlts: false,
             isForMulti: false,
             execute: (dispatch, resources) => {
-                dispatch<any>(msOpenUserAttributes(resources[0].uuid));
+                dispatch<any>(toggleDetailsPanel(resources[0].uuid));
             },
         },
         {
-            name: ContextMenuActionNames.API_DETAILS,
-            icon: AdvancedIcon,
+            name: ContextMenuActionNames.USER_ACCOUNT,
+            icon: UserPanelIcon,
             hasAlts: false,
             isForMulti: false,
             execute: (dispatch, resources) => {
-                dispatch<any>(openAdvancedTabDialog(resources[0].uuid));
+                dispatch<any>(navigateToUserProfile(resources[0].uuid));
             },
         },
         {
-            name: ContextMenuActionNames.USER_ACCOUNT,
-            icon: UserPanelIcon,
+            name: ContextMenuActionNames.API_DETAILS,
+            icon: AdvancedIcon,
             hasAlts: false,
             isForMulti: false,
             execute: (dispatch, resources) => {
-                dispatch<any>(navigateToUserProfile(resources[0].uuid));
+                dispatch<any>(openAdvancedTabDialog(resources[0].uuid));
             },
         },
     ],