From 925a083d8e82281a6d1de1f1021a88da147e5bac Mon Sep 17 00:00:00 2001 From: Stephen Smith Date: Wed, 2 Mar 2022 17:21:31 -0500 Subject: [PATCH] 18559: Fix user profile form initialization & cleanup Arvados-DCO-1.1-Signed-off-by: Stephen Smith --- .../user-profile/user-profile-actions.ts | 5 ++-- src/views/user-panel/user-panel.tsx | 2 +- .../user-profile-panel-root.tsx | 23 +------------------ 3 files changed, 5 insertions(+), 25 deletions(-) diff --git a/src/store/user-profile/user-profile-actions.ts b/src/store/user-profile/user-profile-actions.ts index 103456f3..82e90a2b 100644 --- a/src/store/user-profile/user-profile-actions.ts +++ b/src/store/user-profile/user-profile-actions.ts @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import { RootState } from "store/store"; import { Dispatch } from 'redux'; -import { reset } from "redux-form"; +import { initialize, reset } from "redux-form"; import { ServiceRepository } from "services/services"; import { bindDataExplorerActions } from "store/data-explorer/data-explorer-action"; import { propertiesActions } from 'store/properties/properties-actions'; @@ -25,9 +25,10 @@ export const loadUserProfilePanel = (userUuid?: string) => // Get user uuid from route or use current user uuid const uuid = userUuid || getState().auth.user?.uuid; if (uuid) { + await dispatch(propertiesActions.SET_PROPERTY({ key: USER_PROFILE_PANEL_ID, value: uuid })); const user = await services.userService.get(uuid); + dispatch(initialize(USER_PROFILE_FORM, user)); dispatch(updateResources([user])); - await dispatch(propertiesActions.SET_PROPERTY({ key: USER_PROFILE_PANEL_ID, value: uuid })); dispatch(UserProfileGroupsActions.REQUEST_ITEMS()); } } diff --git a/src/views/user-panel/user-panel.tsx b/src/views/user-panel/user-panel.tsx index be8ef681..9f4d4ce4 100644 --- a/src/views/user-panel/user-panel.tsx +++ b/src/views/user-panel/user-panel.tsx @@ -157,7 +157,7 @@ export const UserPanel = compose( render() { const { value } = this.state; return - + diff --git a/src/views/user-profile-panel/user-profile-panel-root.tsx b/src/views/user-profile-panel/user-profile-panel-root.tsx index c0c80e3c..a725333d 100644 --- a/src/views/user-profile-panel/user-profile-panel-root.tsx +++ b/src/views/user-profile-panel/user-profile-panel-root.tsx @@ -89,11 +89,6 @@ const RoleTypes = [ type UserProfilePanelRootProps = InjectedFormProps<{}> & UserProfilePanelRootActionProps & UserProfilePanelRootDataProps & WithStyles; -// type LocalClusterProp = { localCluster: string }; -// const renderField: React.ComponentType = ({ input, localCluster }) => ( -// {localCluster === input.value.substring(0, 5) ? "" : "federated"} user {input.value} -// ); - export enum UserProfileGroupsColumnNames { NAME = "Name", PERMISSION = "Permission", @@ -152,10 +147,7 @@ export const UserProfilePanelRoot = withStyles(styles)( render() { return - {/* - Logged in as - */} - + @@ -254,7 +246,6 @@ export const UserProfilePanelRoot = withStyles(styles)( id={USER_PROFILE_PANEL_ID} onRowClick={noop} onRowDoubleClick={noop} - // onContextMenu={this.handleContextMenu} contextMenuColumn={false} hideColumnSelector hideSearchInput @@ -352,17 +343,5 @@ export const UserProfilePanelRoot = withStyles(styles)( this.setState({ value }); } - handleContextMenu = (event: React.MouseEvent, resourceUuid: string) => { - // const resource = getResource(resourceUuid)(this.props.resources); - // if (resource) { - // this.props.onContextMenu(event, { - // name: '', - // uuid: resource.uuid, - // ownerUuid: resource.ownerUuid, - // kind: resource.kind, - // menuKind: ContextMenuKind.USER - // }); - // } - } } ); -- 2.30.2