X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/71b9264c1720e619f8cfcb297a7848ece420c61c..3f7e1a8afad27920adf8f03ce82eeb1ae58aa84f:/src/views-components/context-menu/action-sets/user-action-set.ts?ds=sidebyside diff --git a/src/views-components/context-menu/action-sets/user-action-set.ts b/src/views-components/context-menu/action-sets/user-action-set.ts index d2b97d15..c00b7f1f 100644 --- a/src/views-components/context-menu/action-sets/user-action-set.ts +++ b/src/views-components/context-menu/action-sets/user-action-set.ts @@ -2,10 +2,22 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { ContextMenuActionSet } from "~/views-components/context-menu/context-menu-action-set"; -import { AdvancedIcon, ProjectIcon, AttributesIcon, UserPanelIcon } from "~/components/icon/icon"; -import { openAdvancedTabDialog } from '~/store/advanced-tab/advanced-tab'; -import { openUserAttributes, openUserProjects, openUserManagement } from "~/store/users/users-actions"; +import { ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set"; +import { + AdvancedIcon, + ProjectIcon, + AttributesIcon, + DeactivateUserIcon, + UserPanelIcon, + LoginAsIcon, + AdminMenuIcon, + ActiveIcon, +} 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"; export const userActionSet: ContextMenuActionSet = [[{ name: "Attributes", @@ -20,15 +32,56 @@ export const userActionSet: ContextMenuActionSet = [[{ dispatch(openUserProjects(uuid)); } }, { - name: "Advanced", + name: "API Details", icon: AdvancedIcon, execute: (dispatch, { uuid }) => { dispatch(openAdvancedTabDialog(uuid)); } }, { - name: "Manage", + name: "Account Settings", icon: UserPanelIcon, execute: (dispatch, { uuid }) => { - dispatch(openUserManagement(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, + ], +}, { + name: "Login As User", + icon: LoginAsIcon, + execute: (dispatch, { uuid }) => { + dispatch(loginAs(uuid)); + }, + filters: [ + isAdmin, + isOtherUser, + ], }]];