From 7a0091597196ff8fbce0495607771b8688ffea46 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Fri, 11 Aug 2023 11:12:06 -0400 Subject: [PATCH] 18946: Add userProfileFormMessage Arvados-DCO-1.1-Signed-off-by: Peter Amstutz --- src/common/config.ts | 4 +- .../user-profile-panel-root.tsx | 41 +++++++++++-------- .../user-profile-panel/user-profile-panel.tsx | 28 +++++++------ 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/src/common/config.ts b/src/common/config.ts index c1d56548..eff998ae 100644 --- a/src/common/config.ts +++ b/src/common/config.ts @@ -77,6 +77,7 @@ export interface ClusterConfigJSON { IdleTimeout: string; BannerUUID: string; UserProfileFormFields: {}; + UserProfileFormMessage: string; }; Login: { LoginCluster: string; @@ -307,7 +308,8 @@ export const mockClusterConfigJSON = ( SiteName: '', IdleTimeout: '0s', BannerUUID: "", - UserProfileFormFields: {} + UserProfileFormFields: {}, + UserProfileFormMessage: '', }, Login: { LoginCluster: '', 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 85eaaf0c..4a208371 100644 --- a/src/views/user-profile-panel/user-profile-panel-root.tsx +++ b/src/views/user-profile-panel/user-profile-panel-root.tsx @@ -36,7 +36,7 @@ import { DefaultView } from 'components/default-view/default-view'; import { CopyToClipboardSnackbar } from 'components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar'; import { PermissionResource } from 'models/permission'; -type CssRules = 'root' | 'emptyRoot' | 'gridItem' | 'label' | 'readOnlyValue' | 'title' | 'description' | 'actions' | 'content' | 'copyIcon'; +type CssRules = 'root' | 'emptyRoot' | 'gridItem' | 'label' | 'readOnlyValue' | 'title' | 'description' | 'actions' | 'content' | 'copyIcon' | 'userProfileFormMessage'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { @@ -81,6 +81,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ '& svg': { fontSize: '1rem' } + }, + userProfileFormMessage: { + fontSize: '1.1rem', } }); @@ -97,6 +100,7 @@ export interface UserProfilePanelRootDataProps { userUuid: string; resources: ResourcesState; localCluster: string; + userProfileFormMessage: string; } const RoleTypes = [ @@ -165,7 +169,7 @@ export const userProfileGroupsColumns: DataColumns = ]; const ReadOnlyField = withStyles(styles)( - (props: ({ label: string, input: {value: string} }) & WithStyles ) => ( + (props: ({ label: string, input: { value: string } }) & WithStyles) => ( {props.label} @@ -184,7 +188,7 @@ export const UserProfilePanelRoot = withStyles(styles)( }; componentDidMount() { - this.setState({ value: TABS.PROFILE}); + this.setState({ value: TABS.PROFILE }); } render() { @@ -213,7 +217,7 @@ export const UserProfilePanelRoot = withStyles(styles)( - + + + {this.props.userProfileFormMessage} + + id={USER_PROFILE_PANEL_ID} + data-cy="user-profile-groups-data-explorer" + onRowClick={noop} + onRowDoubleClick={noop} + onContextMenu={noop} + contextMenuColumn={false} + hideColumnSelector + hideSearchInput + paperProps={{ + elevation: 0, + }} + defaultViewIcon={GroupsIcon} + defaultViewMessages={['Group list is empty.']} /> } ; } diff --git a/src/views/user-profile-panel/user-profile-panel.tsx b/src/views/user-profile-panel/user-profile-panel.tsx index a90d44a9..040cbc6f 100644 --- a/src/views/user-profile-panel/user-profile-panel.tsx +++ b/src/views/user-profile-panel/user-profile-panel.tsx @@ -14,20 +14,22 @@ import { matchUserProfileRoute } from 'routes/routes'; import { openUserContextMenu } from 'store/context-menu/context-menu-actions'; const mapStateToProps = (state: RootState): UserProfilePanelRootDataProps => { - const pathname = state.router.location ? state.router.location.pathname : ''; - const match = matchUserProfileRoute(pathname); - const uuid = match ? match.params.id : state.auth.user?.uuid || ''; + const pathname = state.router.location ? state.router.location.pathname : ''; + const match = matchUserProfileRoute(pathname); + const uuid = match ? match.params.id : state.auth.user?.uuid || ''; - return { - isAdmin: state.auth.user!.isAdmin, - isSelf: state.auth.user!.uuid === uuid, - isPristine: isPristine(USER_PROFILE_FORM)(state), - isValid: isValid(USER_PROFILE_FORM)(state), - isInaccessible: getUserProfileIsInaccessible(state.properties) || false, - localCluster: state.auth.localCluster, - userUuid: uuid, - resources: state.resources, -}}; + return { + isAdmin: state.auth.user!.isAdmin, + isSelf: state.auth.user!.uuid === uuid, + isPristine: isPristine(USER_PROFILE_FORM)(state), + isValid: isValid(USER_PROFILE_FORM)(state), + isInaccessible: getUserProfileIsInaccessible(state.properties) || false, + localCluster: state.auth.localCluster, + userUuid: uuid, + resources: state.resources, + userProfileFormMessage: state.auth.config.clusterConfig.Workbench.UserProfileFormMessage, + } +}; const mapDispatchToProps = (dispatch: Dispatch) => ({ handleContextMenu: (event, resource: UserResource) => dispatch(openUserContextMenu(event, resource)), -- 2.30.2