From 9da78c51275666c685545d29cd92ffa0d32f7b2f Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Wed, 2 Mar 2022 15:44:47 -0500 Subject: [PATCH] 18559: Link from users panel to user profile page. Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- src/routes/routes.ts | 2 ++ src/store/navigation/navigation-action.ts | 4 +++- src/views-components/data-explorer/renderers.tsx | 15 ++++++++++++--- src/views/user-panel/user-panel.tsx | 9 +++++---- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/routes/routes.ts b/src/routes/routes.ts index b0eb7918..205ae08f 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -100,6 +100,8 @@ export const getProcessLogUrl = (uuid: string) => `/process-logs/${uuid}`; export const getGroupUrl = (uuid: string) => `/group/${uuid}`; +export const getUserProfileUrl = (uuid: string) => `/user/${uuid}`; + export interface ResourceRouteParams { id: string; } diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts index 47d8e4fb..776409c0 100644 --- a/src/store/navigation/navigation-action.ts +++ b/src/store/navigation/navigation-action.ts @@ -6,7 +6,7 @@ import { Dispatch, compose, AnyAction } from 'redux'; import { push } from "react-router-redux"; import { ResourceKind, extractUuidKind } from 'models/resource'; import { SidePanelTreeCategory } from '../side-panel-tree/side-panel-tree-actions'; -import { Routes, getProcessLogUrl, getGroupUrl, getNavUrl } from 'routes/routes'; +import { Routes, getProcessLogUrl, getGroupUrl, getNavUrl, getUserProfileUrl } from 'routes/routes'; import { RootState } from 'store/store'; import { ServiceRepository } from 'services/services'; import { pluginConfig } from 'plugins'; @@ -144,6 +144,8 @@ export const navigateToKeepServices = push(Routes.KEEP_SERVICES); export const navigateToUsers = push(Routes.USERS); +export const navigateToUserProfile = compose(push, getUserProfileUrl); + export const navigateToApiClientAuthorizations = push(Routes.API_CLIENT_AUTHORIZATIONS); export const navigateToGroups = push(Routes.GROUPS); diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx index a2acaca4..7cdd9b83 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -195,7 +195,10 @@ const renderIsActive = (props: { uuid: string, kind: ResourceKind, isActive: boo color="primary" checked={props.isActive} disabled={!!props.disabled} - onClick={() => props.toggleIsActive(props.uuid)} />; + onClick={(e) => { + e.stopPropagation(); + props.toggleIsActive(props.uuid) + }} />; } else { return ; } @@ -230,7 +233,10 @@ const renderIsHidden = (props: { color="primary" checked={props.visible} disabled={!props.canManage} - onClick={() => props.setMemberIsHidden(props.memberLinkUuid, props.permissionLinkUuid, !props.visible)} />; + onClick={(e) => { + e.stopPropagation(); + props.setMemberIsHidden(props.memberLinkUuid, props.permissionLinkUuid, !props.visible); + }} />; } else { return ; } @@ -263,7 +269,10 @@ const renderIsAdmin = (props: { uuid: string, isAdmin: boolean, toggleIsAdmin: ( props.toggleIsAdmin(props.uuid)} />; + onClick={(e) => { + e.stopPropagation(); + props.toggleIsAdmin(props.uuid); + }} />; export const ResourceIsAdmin = connect( (state: RootState, props: { uuid: string }) => { diff --git a/src/views/user-panel/user-panel.tsx b/src/views/user-panel/user-panel.tsx index 5fb979a2..be8ef681 100644 --- a/src/views/user-panel/user-panel.tsx +++ b/src/views/user-panel/user-panel.tsx @@ -20,7 +20,7 @@ import { ResourceIsAdmin, ResourceUsername } from "views-components/data-explorer/renderers"; -import { navigateTo } from "store/navigation/navigation-action"; +import { navigateToUserProfile } from "store/navigation/navigation-action"; import { ContextMenuKind } from "views-components/context-menu/context-menu"; import { DataTableDefaultView } from 'components/data-table-default-view/data-table-default-view'; import { createTree } from 'models/tree'; @@ -124,7 +124,7 @@ interface UserPanelDataProps { interface UserPanelActionProps { openUserCreateDialog: () => void; - handleRowDoubleClick: (uuid: string) => void; + handleRowClick: (uuid: string) => void; onContextMenu: (event: React.MouseEvent, item: any) => void; } @@ -136,7 +136,7 @@ const mapStateToProps = (state: RootState) => { const mapDispatchToProps = (dispatch: Dispatch) => ({ openUserCreateDialog: () => dispatch(openUserCreateDialog()), - handleRowDoubleClick: (uuid: string) => dispatch(navigateTo(uuid)), + handleRowClick: (uuid: string) => dispatch(navigateToUserProfile(uuid)), onContextMenu: (event: React.MouseEvent, item: any) => dispatch(openContextMenu(event, item)) }); @@ -165,7 +165,7 @@ export const UserPanel = compose(
, resourceUuid: string) => { + event.stopPropagation(); const resource = getResource(resourceUuid)(this.props.resources); if (resource) { this.props.onContextMenu(event, { -- 2.30.2