X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/7e9513099881d63a99a70c69ddd71c5d83567fa4..e4a198bd0cc9ed174cb68345623ce9fbd8923951:/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 febe0ab9..1c8b1da7 100644 --- a/src/views/user-profile-panel/user-profile-panel-root.tsx +++ b/src/views/user-profile-panel/user-profile-panel-root.tsx @@ -4,6 +4,8 @@ import React from 'react'; import { Field, InjectedFormProps } from "redux-form"; +import { DispatchProp } from 'react-redux'; +import { UserResource } from 'models/user'; import { TextField } from "components/text-field/text-field"; import { DataExplorer } from "views-components/data-explorer/data-explorer"; import { NativeSelectField } from "components/select-field/select-field"; @@ -11,35 +13,40 @@ import { StyleRulesCallback, WithStyles, withStyles, - Card, CardContent, Button, Typography, Grid, InputLabel, Tabs, Tab, - Paper + Paper, + Tooltip, + IconButton, } from '@material-ui/core'; import { ArvadosTheme } from 'common/custom-theme'; -import { User } from "models/user"; 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 { GroupsIcon } from 'components/icon/icon'; +import { DetailsIcon, GroupsIcon, MoreOptionsIcon } 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 { DefaultView } from 'components/default-view/default-view'; +import { CopyToClipboardSnackbar } from 'components/copy-to-clipboard-snackbar/copy-to-clipboard-snackbar'; -type CssRules = 'root' | 'adminRoot' | 'gridItem' | 'label' | 'readOnlyValue' | 'title' | 'description' | 'actions' | 'content'; +type CssRules = 'root' | 'emptyRoot' | 'gridItem' | 'label' | 'readOnlyValue' | 'title' | 'description' | 'actions' | 'content' | 'copyIcon'; 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, @@ -65,13 +72,20 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ content: { // reserve space for the tab bar height: `calc(100% - ${theme.spacing.unit * 7}px)`, + }, + copyIcon: { + marginLeft: theme.spacing.unit, + color: theme.palette.grey["500"], + cursor: 'pointer', + display: 'inline', + '& svg': { + fontSize: '1rem' + } } }); export interface UserProfilePanelRootActionProps { - openSetupDialog: (uuid: string) => void; - loginAs: (uuid: string) => void; - openDeactivateDialog: (uuid: string) => void; + handleContextMenu: (event, resource: UserResource) => void; } export interface UserProfilePanelRootDataProps { @@ -79,7 +93,9 @@ export interface UserProfilePanelRootDataProps { isSelf: boolean; isPristine: boolean; isValid: boolean; - initialValues?: User; + isInaccessible: boolean; + userUuid: string; + resources: ResourcesState; localCluster: string; } @@ -94,7 +110,7 @@ const RoleTypes = [ { key: 'Other', value: 'Other' } ]; -type UserProfilePanelRootProps = InjectedFormProps<{}> & UserProfilePanelRootActionProps & UserProfilePanelRootDataProps & WithStyles; +type UserProfilePanelRootProps = InjectedFormProps<{}> & UserProfilePanelRootActionProps & UserProfilePanelRootDataProps & DispatchProp & WithStyles; export enum UserProfileGroupsColumnNames { NAME = "Name", @@ -107,7 +123,6 @@ export enum UserProfileGroupsColumnNames { enum TABS { PROFILE = "PROFILE", GROUPS = "GROUPS", - ADMIN = "ADMIN", } @@ -173,203 +188,166 @@ export const UserProfilePanelRoot = withStyles(styles)( } render() { - return - - - - {this.props.isAdmin && } - - {this.state.value === TABS.PROFILE && - -
- - - - - - - - - - - - - - - - - - - - - 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.isAdmin && this.state.value === TABS.ADMIN && - - - - - - - Setup Account - - - This button sets up a user. After setup, they will be able use Arvados. This dialog box also allows you to optionally set up a shell account for this user. The login name is automatically generated from the user's e-mail address. - +
+ + + - - + + - - - - - - - - - Deactivate - - - As an admin, you can deactivate and reset this user. This will remove all repository/VM permissions for the user. If you "setup" the user again, the user will have to sign the user agreement again. You may also want to reassign data ownership. - + + - - + + - - - - - - - - - Log In - - - As an admin, you can log in as this user. When you’ve finished, you will need to log out and log in again with your own account. - + + + + + - - + + Role + + + + + + + + + + - - - } - ; + +
+ } + {this.state.value === TABS.GROUPS && +
+ + } /> +
} +
; + } } handleChange = (event: React.MouseEvent, value: number) => { this.setState({ value }); } + handleContextMenu = (event: React.MouseEvent, resourceUuid: string) => { + event.stopPropagation(); + const resource = getResource(resourceUuid)(this.props.resources); + if (resource) { + this.props.handleContextMenu(event, resource); + } + } + } );