X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/df1ebc0e3184afd3fb66414651fc1aec713928bf..a11b5dcc047426ea20e785496dbb8d1c5e2fe98e:/services/workbench2/src/views-components/context-menu/action-sets/user-action-set.ts diff --git a/services/workbench2/src/views-components/context-menu/action-sets/user-action-set.ts b/services/workbench2/src/views-components/context-menu/action-sets/user-action-set.ts index c00b7f1f28..0108ff7e50 100644 --- a/services/workbench2/src/views-components/context-menu/action-sets/user-action-set.ts +++ b/services/workbench2/src/views-components/context-menu/action-sets/user-action-set.ts @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set"; +import { ContextMenuActionSet } from 'views-components/context-menu/context-menu-action-set'; import { AdvancedIcon, ProjectIcon, @@ -12,76 +12,84 @@ import { LoginAsIcon, AdminMenuIcon, ActiveIcon, -} from "components/icon/icon"; +} from 'components/icon/icon'; import { openAdvancedTabDialog } from 'store/advanced-tab/advanced-tab'; -import { loginAs, openUserAttributes, openUserProjects } from "store/users/users-actions"; -import { openSetupDialog, openDeactivateDialog, openActivateDialog } from "store/user-profile/user-profile-actions"; -import { navigateToUserProfile } from "store/navigation/navigation-action"; -import { canActivateUser, canDeactivateUser, canSetupUser, isAdmin, needsUserProfileLink, isOtherUser } from "store/context-menu/context-menu-filters"; +import { loginAs, openUserAttributes, openUserProjects } from 'store/users/users-actions'; +import { openSetupDialog, openDeactivateDialog, openActivateDialog } from 'store/user-profile/user-profile-actions'; +import { navigateToUserProfile } from 'store/navigation/navigation-action'; +import { + canActivateUser, + canDeactivateUser, + canSetupUser, + isAdmin, + needsUserProfileLink, + isOtherUser, +} from 'store/context-menu/context-menu-filters'; -export const userActionSet: ContextMenuActionSet = [[{ - name: "Attributes", - icon: AttributesIcon, - execute: (dispatch, { uuid }) => { - dispatch(openUserAttributes(uuid)); - } -}, { - name: "Project", - icon: ProjectIcon, - execute: (dispatch, { uuid }) => { - dispatch(openUserProjects(uuid)); - } -}, { - name: "API Details", - icon: AdvancedIcon, - execute: (dispatch, { uuid }) => { - dispatch(openAdvancedTabDialog(uuid)); - } -}, { - name: "Account Settings", - icon: UserPanelIcon, - execute: (dispatch, { uuid }) => { - dispatch(navigateToUserProfile(uuid)); - }, - filters: [needsUserProfileLink] -}],[{ - name: "Activate User", - icon: ActiveIcon, - execute: (dispatch, { uuid }) => { - dispatch(openActivateDialog(uuid)); - }, - filters: [ - isAdmin, - canActivateUser, - ], -}, { - name: "Setup User", - icon: AdminMenuIcon, - execute: (dispatch, { uuid }) => { - dispatch(openSetupDialog(uuid)); - }, - filters: [ - isAdmin, - canSetupUser, - ], -}, { - name: "Deactivate User", - icon: DeactivateUserIcon, - execute: (dispatch, { uuid }) => { - dispatch(openDeactivateDialog(uuid)); - }, - filters: [ - isAdmin, - canDeactivateUser, +export const userActionSet: ContextMenuActionSet = [ + [ + { + name: 'Attributes', + icon: AttributesIcon, + execute: (dispatch, resources) => { + dispatch(openUserAttributes(resources[0].uuid)); + }, + }, + { + name: 'Project', + icon: ProjectIcon, + execute: (dispatch, resources) => { + dispatch(openUserProjects(resources[0].uuid)); + }, + }, + { + name: 'API Details', + icon: AdvancedIcon, + execute: (dispatch, resources) => { + dispatch(openAdvancedTabDialog(resources[0].uuid)); + }, + }, + { + name: 'Account Settings', + icon: UserPanelIcon, + execute: (dispatch, resources) => { + dispatch(navigateToUserProfile(resources[0].uuid)); + }, + filters: [needsUserProfileLink], + }, ], -}, { - name: "Login As User", - icon: LoginAsIcon, - execute: (dispatch, { uuid }) => { - dispatch(loginAs(uuid)); - }, - filters: [ - isAdmin, - isOtherUser, + [ + { + name: 'Activate User', + icon: ActiveIcon, + execute: (dispatch, resources) => { + dispatch(openActivateDialog(resources[0].uuid)); + }, + filters: [isAdmin, canActivateUser], + }, + { + name: 'Setup User', + icon: AdminMenuIcon, + execute: (dispatch, resources) => { + dispatch(openSetupDialog(resources[0].uuid)); + }, + filters: [isAdmin, canSetupUser], + }, + { + name: 'Deactivate User', + icon: DeactivateUserIcon, + execute: (dispatch, resources) => { + dispatch(openDeactivateDialog(resources[0].uuid)); + }, + filters: [isAdmin, canDeactivateUser], + }, + { + name: 'Login As User', + icon: LoginAsIcon, + execute: (dispatch, resources) => { + dispatch(loginAs(resources[0].uuid)); + }, + filters: [isAdmin, isOtherUser], + }, ], -}]]; +];