Post merge fixes
[arvados-workbench2.git] / src / views / my-account-panel / my-account-panel-root.tsx
index 994a7819adaad8bd0ff14f95abd0e296bcf33c54..a0b29fb4b41f6764285c08378a8ee1649d3efd20 100644 (file)
@@ -19,7 +19,7 @@ import {
 } from '@material-ui/core';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { User } from "~/models/user";
-import { require } from "~/validators/require";
+import { MY_ACCOUNT_VALIDATION} from "~/validators/validators";
 
 type CssRules = 'root' | 'gridItem' | 'label' | 'title' | 'actions';
 
@@ -53,9 +53,15 @@ export interface MyAccountPanelRootDataProps {
     initialValues?: User;
 }
 
-export const MY_ACCOUNT_FORM = 'myAccountForm';
-
-const FILES_FIELD_VALIDATION = [require];
+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 MyAccountPanelRootProps = InjectedFormProps<MyAccountPanelRootActionProps> & MyAccountPanelRootDataProps & WithStyles<CssRules>;
 
@@ -93,10 +99,11 @@ export const MyAccountPanelRoot = withStyles(styles)(
                             </Grid>
                             <Grid item className={classes.gridItem}>
                                 <Field
-                                    label="*Organization"
+                                    label="Organization"
                                     name="prefs.profile.organization"
                                     component={TextField}
-                                    validate={FILES_FIELD_VALIDATION}
+                                    validate={MY_ACCOUNT_VALIDATION}
+                                    required
                                 />
                             </Grid>
                             <Grid item className={classes.gridItem}>
@@ -107,20 +114,12 @@ export const MyAccountPanelRoot = withStyles(styles)(
                                 />
                             </Grid>
                             <Grid item className={classes.gridItem}>
-                                <InputLabel className={classes.label} htmlFor="prefs.profile.role">Organization</InputLabel>
+                                <InputLabel className={classes.label} htmlFor="prefs.profile.role">Role</InputLabel>
                                 <Field
                                     id="prefs.profile.role"
                                     name="prefs.profile.role"
                                     component={NativeSelectField}
-                                    items={[
-                                        {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'}
-                                    ]}
+                                    items={RoleTypes}
                                 />
                             </Grid>
                         </Grid>
@@ -137,16 +136,23 @@ export const MyAccountPanelRoot = withStyles(styles)(
                             <Grid item className={classes.gridItem} />
                             <Grid item className={classes.gridItem}>
                                 <Field
-                                    label="*E-mail at Organization"
+                                    label="E-mail at Organization"
                                     name="prefs.profile.organization_email"
                                     component={TextField}
-                                    validate={FILES_FIELD_VALIDATION}
+                                    validate={MY_ACCOUNT_VALIDATION}
+                                    required
                                 />
                             </Grid>
                         </Grid>
                         <Grid item xs={12} className={classes.actions}>
                             <Button color="primary" onClick={reset} disabled={isPristine}>Discard changes</Button>
-                            <Button color="primary" variant="contained" type="submit" disabled={isPristine || invalid || submitting}>Save changes</Button>
+                            <Button
+                                color="primary"
+                                variant="contained"
+                                type="submit"
+                                disabled={isPristine || invalid || submitting}>
+                                    Save changes
+                            </Button>
                         </Grid>
                     </Grid>
                 </form>