X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/addb01b6d7636a8963ddb1eff4799ebc96f44739..46b878b9773789f7a953f58f3de2cc4bf370e153:/src/views/user-profile-panel/user-profile-panel-root.tsx 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..82c20728 100644 --- a/src/views/user-profile-panel/user-profile-panel-root.tsx +++ b/src/views/user-profile-panel/user-profile-panel-root.tsx @@ -31,7 +31,7 @@ import { DataColumns } from 'components/data-table/data-table'; import { ResourceLinkHeadUuid, ResourceLinkHeadPermissionLevel, ResourceLinkHead, ResourceLinkDelete, ResourceLinkTailIsVisible } from 'views-components/data-explorer/renderers'; import { createTree } from 'models/tree'; -type CssRules = 'root' | 'adminRoot' | 'gridItem' | 'label' | 'title' | 'description' | 'actions' | 'content'; +type CssRules = 'root' | 'adminRoot' | 'gridItem' | 'label' | 'readOnlyValue' | 'title' | 'description' | 'actions' | 'content'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { @@ -46,7 +46,11 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ marginBottom: 20 }, label: { - fontSize: '0.675rem' + fontSize: '0.675rem', + color: theme.palette.grey['600'] + }, + readOnlyValue: { + fontSize: '0.875rem', }, title: { fontSize: '1.1rem', @@ -71,6 +75,8 @@ export interface UserProfilePanelRootActionProps { } export interface UserProfilePanelRootDataProps { + isAdmin: boolean; + isSelf: boolean; isPristine: boolean; isValid: boolean; initialValues?: User; @@ -78,6 +84,7 @@ export interface UserProfilePanelRootDataProps { } const RoleTypes = [ + { key: '', value: '' }, { key: 'Bio-informatician', value: 'Bio-informatician' }, { key: 'Data Scientist', value: 'Data Scientist' }, { key: 'Analyst', value: 'Analyst' }, @@ -89,11 +96,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", @@ -102,6 +104,13 @@ export enum UserProfileGroupsColumnNames { REMOVE = "Remove", } +enum TABS { + PROFILE = "PROFILE", + GROUPS = "GROUPS", + ADMIN = "ADMIN", + +} + export const userProfileGroupsColumns: DataColumns = [ { name: UserProfileGroupsColumnNames.NAME, @@ -140,121 +149,130 @@ export const userProfileGroupsColumns: DataColumns = [ }, ]; +const ReadOnlyField = withStyles(styles)( + (props: ({ label: string, input: {value: string} }) & WithStyles ) => ( + + + {props.label} + + + {props.input.value} + + + ) +); + export const UserProfilePanelRoot = withStyles(styles)( class extends React.Component { state = { - value: 0, + value: TABS.PROFILE, }; componentDidMount() { - this.setState({ value: 0 }); + this.setState({ value: TABS.PROFILE}); } render() { return - {/* - Logged in as - */} - - - - + + + + {this.props.isAdmin && } - {this.state.value === 0 && - // - -
- - - - - - - - - - - - - - - - - - - - - Role - - - - - - - - - - + {this.state.value === TABS.PROFILE && + + + + + + + + + + + + + + + + + + + + + + + Role + + + + + + + + + - - - //
+ + + } - {this.state.value === 1 && + {this.state.value === TABS.GROUPS &&
} />
} - {this.state.value === 2 && + {this.props.isAdmin && this.state.value === TABS.ADMIN && @@ -352,17 +370,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 - // }); - // } - } } );