// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import React from 'react'; import { Field, InjectedFormProps } from "redux-form"; 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"; import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Button, Typography, Grid, InputLabel, Tabs, Tab, Paper } 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 { MY_ACCOUNT_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 { 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'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { width: '100%', overflow: 'auto' }, adminRoot: { // ...theme.mixins.gutters() }, gridItem: { height: 45, marginBottom: 20 }, label: { fontSize: '0.675rem' }, title: { fontSize: '1.1rem', }, description: { color: theme.palette.grey["600"] }, actions: { display: 'flex', justifyContent: 'flex-end' }, content: { // reserve space for the tab bar height: `calc(100% - ${theme.spacing.unit * 7}px)`, } }); export interface UserProfilePanelRootActionProps { openSetupShellAccount: (uuid: string) => void; loginAs: (uuid: string) => void; openDeactivateDialog: (uuid: string) => void; } export interface UserProfilePanelRootDataProps { isPristine: boolean; isValid: boolean; initialValues?: User; localCluster: string; } const RoleTypes = [ { key: 'Bio-informatician', value: 'Bio-informatician' }, { key: 'Data Scientist', value: 'Data Scientist' }, { key: 'Analyst', value: 'Analyst' }, { key: 'Researcher', value: 'Researcher' }, { key: 'Software Developer', value: 'Software Developer' }, { key: 'System Administrator', value: 'System Administrator' }, { key: 'Other', value: 'Other' } ]; 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", VISIBLE = "Visible to other members", UUID = "UUID", REMOVE = "Remove", } export const userProfileGroupsColumns: DataColumns = [ { name: UserProfileGroupsColumnNames.NAME, selected: true, configurable: true, filters: createTree(), render: uuid => }, { name: UserProfileGroupsColumnNames.PERMISSION, selected: true, configurable: true, filters: createTree(), render: uuid => }, { name: UserProfileGroupsColumnNames.VISIBLE, selected: true, configurable: true, filters: createTree(), render: uuid => }, { name: UserProfileGroupsColumnNames.UUID, selected: true, configurable: true, filters: createTree(), render: uuid => }, { name: UserProfileGroupsColumnNames.REMOVE, selected: true, configurable: true, filters: createTree(), render: uuid => }, ]; export const UserProfilePanelRoot = withStyles(styles)( class extends React.Component { state = { value: 0, }; componentDidMount() { this.setState({ value: 0 }); } render() { return {/* Logged in as */} {this.state.value === 0 && //
Role
//
} {this.state.value === 1 &&
} />
} {this.state.value === 2 && 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. }
; } handleChange = (event: React.MouseEvent, value: number) => { 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 // }); // } } } );