18559: Link from users panel to user profile page.
authorStephen Smith <stephen@curii.com>
Wed, 2 Mar 2022 20:44:47 +0000 (15:44 -0500)
committerStephen Smith <stephen@curii.com>
Wed, 2 Mar 2022 20:44:47 +0000 (15:44 -0500)
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen@curii.com>

src/routes/routes.ts
src/store/navigation/navigation-action.ts
src/views-components/data-explorer/renderers.tsx
src/views/user-panel/user-panel.tsx

index b0eb7918e1482fd066db6d8bb62bb60a4187a379..205ae08fdd3c21978dddb1cc8316d3512d9e0ad8 100644 (file)
@@ -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;
 }
index 47d8e4fb9548f3677f8acaa145859e30a6aed3db..776409c01a1969604aa2d55898c84fd84c94a613 100644 (file)
@@ -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);
index a2acaca4525e6bceb6d65f869dae09f986412c21..7cdd9b835a6b0aad5cfefff1de6dbc6b0361d965 100644 (file)
@@ -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 <Typography />;
     }
@@ -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 <Typography />;
     }
@@ -263,7 +269,10 @@ const renderIsAdmin = (props: { uuid: string, isAdmin: boolean, toggleIsAdmin: (
     <Checkbox
         color="primary"
         checked={props.isAdmin}
-        onClick={() => props.toggleIsAdmin(props.uuid)} />;
+        onClick={(e) => {
+            e.stopPropagation();
+            props.toggleIsAdmin(props.uuid);
+        }} />;
 
 export const ResourceIsAdmin = connect(
     (state: RootState, props: { uuid: string }) => {
index 5fb979a2194c62af81a0de64b37cdc509096ead0..be8ef6812cce0b38c040e44b458fc08b69c0eaa1 100644 (file)
@@ -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<HTMLElement>, item: any) => void;
 }
 
@@ -136,7 +136,7 @@ const mapStateToProps = (state: RootState) => {
 
 const mapDispatchToProps = (dispatch: Dispatch) => ({
     openUserCreateDialog: () => dispatch<any>(openUserCreateDialog()),
-    handleRowDoubleClick: (uuid: string) => dispatch<any>(navigateTo(uuid)),
+    handleRowClick: (uuid: string) => dispatch<any>(navigateToUserProfile(uuid)),
     onContextMenu: (event: React.MouseEvent<HTMLElement>, item: any) => dispatch<any>(openContextMenu(event, item))
 });
 
@@ -165,7 +165,7 @@ export const UserPanel = compose(
                         <div className={this.props.classes.content}>
                             <DataExplorer
                                 id={USERS_PANEL_ID}
-                                onRowClick={noop}
+                                onRowClick={this.props.handleRowClick}
                                 onRowDoubleClick={noop}
                                 onContextMenu={this.handleContextMenu}
                                 contextMenuColumn={true}
@@ -194,6 +194,7 @@ export const UserPanel = compose(
             }
 
             handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
+                event.stopPropagation();
                 const resource = getResource<UserResource>(resourceUuid)(this.props.resources);
                 if (resource) {
                     this.props.onContextMenu(event, {