18834: Fixed failing tests
[arvados-workbench2.git] / src / views / my-account-panel / my-account-panel-root.tsx
index 7dcbe09a57ac6d531403deb42173a694c2b38f46..283b9accb4e1cbaa4d3ca392644fcaf93067d1d9 100644 (file)
@@ -2,11 +2,10 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
+import React from 'react';
 import { Field, InjectedFormProps, WrappedFieldProps } from "redux-form";
-import { TextField } from "~/components/text-field/text-field";
-import { NativeSelectField } from "~/components/select-field/select-field";
-import { DetailsAttribute } from '~/components/details-attribute/details-attribute';
+import { TextField } from "components/text-field/text-field";
+import { NativeSelectField } from "components/select-field/select-field";
 import {
     StyleRulesCallback,
     WithStyles,
@@ -18,11 +17,11 @@ import {
     Grid,
     InputLabel
 } from '@material-ui/core';
-import { ArvadosTheme } from '~/common/custom-theme';
-import { User } from "~/models/user";
-import { MY_ACCOUNT_VALIDATION } from "~/validators/validators";
+import { ArvadosTheme } from 'common/custom-theme';
+import { User } from "models/user";
+import { MY_ACCOUNT_VALIDATION } from "validators/validators";
 
-type CssRules = 'root' | 'gridItem' | 'label' | 'title' | 'actions' | 'link';
+type CssRules = 'root' | 'gridItem' | 'label' | 'title' | 'actions';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     root: {
@@ -40,24 +39,13 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
         marginBottom: theme.spacing.unit * 3,
         color: theme.palette.grey["600"]
     },
-    link: {
-        lineHeight:'2.1',
-        whiteSpace: 'nowrap',
-        fontSize: '1rem',
-        color: theme.palette.primary.main,
-        '&:hover': {
-            cursor: 'pointer'
-        }
-    },
     actions: {
         display: 'flex',
         justifyContent: 'flex-end'
     }
 });
 
-export interface MyAccountPanelRootActionProps {
-    openLinkAccount: () => void;
- }
+export interface MyAccountPanelRootActionProps { }
 
 export interface MyAccountPanelRootDataProps {
     isPristine: boolean;
@@ -76,36 +64,27 @@ const RoleTypes = [
     { key: 'Other', value: 'Other' }
 ];
 
-type MyAccountPanelRootProps = InjectedFormProps & MyAccountPanelRootActionProps & MyAccountPanelRootDataProps & WithStyles<CssRules>;
+type MyAccountPanelRootProps = InjectedFormProps<MyAccountPanelRootActionProps> & MyAccountPanelRootDataProps & WithStyles<CssRules>;
 
 type LocalClusterProp = { localCluster: string };
 const renderField: React.ComponentType<WrappedFieldProps & LocalClusterProp> = ({ input, localCluster }) => (
-    <span>{localCluster === input.value.substr(0, 5) ? "" : "federated"} user {input.value}</span>
+    <span>{localCluster === input.value.substring(0, 5) ? "" : "federated"} user {input.value}</span>
 );
 
 export const MyAccountPanelRoot = withStyles(styles)(
-    ({ classes, isValid, handleSubmit, reset, isPristine, invalid, submitting, localCluster, openLinkAccount}: MyAccountPanelRootProps) => {
+    ({ classes, isValid, handleSubmit, reset, isPristine, invalid, submitting, localCluster }: MyAccountPanelRootProps) => {
         return <Card className={classes.root}>
             <CardContent>
-                <Grid container spacing={24}>
-                    <Grid item className={classes.gridItem}>
-                        <Typography variant="title" className={classes.title}>
-                            Logged in as <Field name="uuid" component={renderField} localCluster={localCluster} />
-                        </Typography>
-                    </Grid>
-                    <Grid item className={classes.gridItem}>
-                        <span onClick={() => openLinkAccount()}>
-                            <DetailsAttribute classLabel={classes.link} label='Link account' />
-                        </span>
-                    </Grid>
-                </Grid>
+                <Typography variant="title" className={classes.title}>
+                    Logged in as <Field name="uuid" component={renderField} localCluster={localCluster} />
+                </Typography>
                 <form onSubmit={handleSubmit}>
                     <Grid container spacing={24}>
                         <Grid item className={classes.gridItem} sm={6} xs={12}>
                             <Field
                                 label="First name"
                                 name="firstName"
-                                component={TextField}
+                                component={TextField as any}
                                 disabled
                             />
                         </Grid>
@@ -113,7 +92,7 @@ export const MyAccountPanelRoot = withStyles(styles)(
                             <Field
                                 label="Last name"
                                 name="lastName"
-                                component={TextField}
+                                component={TextField as any}
                                 disabled
                             />
                         </Grid>
@@ -121,7 +100,7 @@ export const MyAccountPanelRoot = withStyles(styles)(
                             <Field
                                 label="E-mail"
                                 name="email"
-                                component={TextField}
+                                component={TextField as any}
                                 disabled
                             />
                         </Grid>
@@ -129,7 +108,7 @@ export const MyAccountPanelRoot = withStyles(styles)(
                             <Field
                                 label="Username"
                                 name="username"
-                                component={TextField}
+                                component={TextField as any}
                                 disabled
                             />
                         </Grid>
@@ -137,7 +116,7 @@ export const MyAccountPanelRoot = withStyles(styles)(
                             <Field
                                 label="Organization"
                                 name="prefs.profile.organization"
-                                component={TextField}
+                                component={TextField as any}
                                 validate={MY_ACCOUNT_VALIDATION}
                                 required
                             />
@@ -146,7 +125,7 @@ export const MyAccountPanelRoot = withStyles(styles)(
                             <Field
                                 label="E-mail at Organization"
                                 name="prefs.profile.organization_email"
-                                component={TextField}
+                                component={TextField as any}
                                 validate={MY_ACCOUNT_VALIDATION}
                                 required
                             />
@@ -156,7 +135,7 @@ export const MyAccountPanelRoot = withStyles(styles)(
                             <Field
                                 id="prefs.profile.role"
                                 name="prefs.profile.role"
-                                component={NativeSelectField}
+                                component={NativeSelectField as any}
                                 items={RoleTypes}
                             />
                         </Grid>
@@ -164,7 +143,7 @@ export const MyAccountPanelRoot = withStyles(styles)(
                             <Field
                                 label="Website"
                                 name="prefs.profile.website_url"
-                                component={TextField}
+                                component={TextField as any}
                             />
                         </Grid>
                         <Grid container direction="row" justify="flex-end" >