X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/864465d579c4b2caf06fce87b1861674758135f6..c59724a9e5d4c9241df58d9d60541a63f0f06b80:/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 0beeab4f..4a208371 100644 --- a/src/views/user-profile-panel/user-profile-panel-root.tsx +++ b/src/views/user-profile-panel/user-profile-panel-root.tsx @@ -24,27 +24,29 @@ import { IconButton, } from '@material-ui/core'; import { ArvadosTheme } from 'common/custom-theme'; -import { DataTableDefaultView } from 'components/data-table-default-view/data-table-default-view'; -import { PROFILE_EMAIL_VALIDATION } from "validators/validators"; +import { PROFILE_EMAIL_VALIDATION, PROFILE_URL_VALIDATION } from "validators/validators"; import { USER_PROFILE_PANEL_ID } from 'store/user-profile/user-profile-actions'; import { noop } from 'lodash'; -import { CopyIcon, GroupsIcon, MoreOptionsIcon } from 'components/icon/icon'; +import { DetailsIcon, GroupsIcon, MoreVerticalIcon } from 'components/icon/icon'; import { DataColumns } from 'components/data-table/data-table'; -import { ResourceLinkHeadUuid, ResourceLinkHeadPermissionLevel, ResourceLinkHead, ResourceLinkDelete, ResourceLinkTailIsVisible } from 'views-components/data-explorer/renderers'; +import { ResourceLinkHeadUuid, ResourceLinkHeadPermissionLevel, ResourceLinkHead, ResourceLinkDelete, ResourceLinkTailIsVisible, UserResourceAccountStatus } from 'views-components/data-explorer/renderers'; import { createTree } from 'models/tree'; import { getResource, ResourcesState } from 'store/resources/resources'; -import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions'; -import CopyToClipboard from 'react-copy-to-clipboard'; +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' | 'adminRoot' | '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: { width: '100%', overflow: 'auto' }, - adminRoot: { - // ...theme.mixins.gutters() + emptyRoot: { + width: '100%', + overflow: 'auto', + padding: theme.spacing.unit * 4, }, gridItem: { height: 45, @@ -79,6 +81,9 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ '& svg': { fontSize: '1rem' } + }, + userProfileFormMessage: { + fontSize: '1.1rem', } }); @@ -91,9 +96,11 @@ export interface UserProfilePanelRootDataProps { isSelf: boolean; isPristine: boolean; isValid: boolean; + isInaccessible: boolean; userUuid: string; - resources: ResourcesState + resources: ResourcesState; localCluster: string; + userProfileFormMessage: string; } const RoleTypes = [ @@ -123,7 +130,7 @@ enum TABS { } -export const userProfileGroupsColumns: DataColumns = [ +export const userProfileGroupsColumns: DataColumns = [ { name: UserProfileGroupsColumnNames.NAME, selected: true, @@ -162,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} @@ -181,137 +188,141 @@ export const UserProfilePanelRoot = withStyles(styles)( }; componentDidMount() { - this.setState({ value: TABS.PROFILE}); - } - - onCopy = (message: string) => { - this.props.dispatch(snackbarActions.OPEN_SNACKBAR({ - message, - hideDuration: 2000, - kind: SnackbarKind.SUCCESS - })); + this.setState({ value: TABS.PROFILE }); } render() { - return - - - - - {this.state.value === TABS.PROFILE && - - - - - {this.props.userUuid} - - - this.onCopy!("Copied")}> - - - - - - - - - this.handleContextMenu(event, this.props.userUuid)}> - - - - - -
- - - - - - - - - - - - - - - - - - - - - Role - + if (this.props.isInaccessible) { + return ( + + + + + + ); + } else { + return + + + + + {this.state.value === TABS.PROFILE && + + + + + {this.props.userUuid} + + - - - - - - - + + + + + + this.handleContextMenu(event, this.props.userUuid)}> + + + + - - - } - {this.state.value === TABS.GROUPS && -
- + + + + + + + + + + + + + + + {this.props.userProfileFormMessage} + + + + + + + + + Role + + + + + + + + + + + + + + + } + {this.state.value === TABS.GROUPS && +
+ - } /> -
} - ; + defaultViewIcon={GroupsIcon} + defaultViewMessages={['Group list is empty.']} /> +
} +
; + } } handleChange = (event: React.MouseEvent, value: number) => {