15088: Adds link accounts to drop down. Removes changes to my account
authorEric Biagiotti <ebiagiotti@veritasgenetics.com>
Fri, 3 May 2019 15:27:12 +0000 (11:27 -0400)
committerEric Biagiotti <ebiagiotti@veritasgenetics.com>
Fri, 3 May 2019 15:27:12 +0000 (11:27 -0400)
Arvados-DCO-1.1-Signed-off-by: Eric Biagiotti <ebiagiotti@veritasgenetics.com>

src/views-components/main-app-bar/account-menu.tsx
src/views/my-account-panel/my-account-panel-root.tsx
src/views/my-account-panel/my-account-panel.tsx

index 87bfe0c6db7cd3fe06554e9a66ff3dc789c664e8..93aeadae804aab4fdc12d016937b7834bd4ec5b1 100644 (file)
@@ -17,7 +17,8 @@ import { openRepositoriesPanel } from "~/store/repositories/repositories-actions
 import {
     navigateToSiteManager,
     navigateToSshKeysUser,
-    navigateToMyAccount
+    navigateToMyAccount,
+    navigateToLinkAccount
 } from '~/store/navigation/navigation-action';
 import { openUserVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
 
@@ -75,6 +76,7 @@ export const AccountMenu = withStyles(styles)(
                         <MenuItem onClick={() => dispatch(navigateToSshKeysUser)}>Ssh Keys</MenuItem>
                         <MenuItem onClick={() => dispatch(navigateToSiteManager)}>Site Manager</MenuItem>
                         <MenuItem onClick={() => dispatch(navigateToMyAccount)}>My account</MenuItem>
+                        <MenuItem onClick={() => dispatch(navigateToLinkAccount)}>Link account</MenuItem>
                     </> : null}
                     <MenuItem>
                         <a href={`${workbenchURL.replace(/\/$/, "")}/${wb1URL(currentRoute)}?api_token=${apiToken}`}
index 7dcbe09a57ac6d531403deb42173a694c2b38f46..e84b3b6484d8ba46f57e31c5e3ddc5222b164489 100644 (file)
@@ -6,7 +6,6 @@ import * as 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 {
     StyleRulesCallback,
     WithStyles,
@@ -22,7 +21,7 @@ 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,7 +64,7 @@ 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 }) => (
@@ -84,21 +72,12 @@ const renderField: React.ComponentType<WrappedFieldProps & LocalClusterProp> = (
 );
 
 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}>
index 85f285d60f208798eaafafae226a9c15a7f2b6a4..bd1f58745724b9dbd0a87eb083d31c0dd48fe135 100644 (file)
@@ -3,12 +3,11 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { RootState } from '~/store/store';
-import { Dispatch } from 'redux';
 import { compose } from 'redux';
 import { reduxForm, isPristine, isValid } from 'redux-form';
 import { connect } from 'react-redux';
-import { saveEditedUser, openLinkAccount } from '~/store/my-account/my-account-panel-actions';
-import { MyAccountPanelRoot, MyAccountPanelRootDataProps, MyAccountPanelRootActionProps } from '~/views/my-account-panel/my-account-panel-root';
+import { saveEditedUser } from '~/store/my-account/my-account-panel-actions';
+import { MyAccountPanelRoot, MyAccountPanelRootDataProps } from '~/views/my-account-panel/my-account-panel-root';
 import { MY_ACCOUNT_FORM } from "~/store/my-account/my-account-panel-actions";
 
 const mapStateToProps = (state: RootState): MyAccountPanelRootDataProps => ({
@@ -18,12 +17,8 @@ const mapStateToProps = (state: RootState): MyAccountPanelRootDataProps => ({
     localCluster: state.auth.localCluster
 });
 
-const mapDispatchToProps = (dispatch: Dispatch): MyAccountPanelRootActionProps => ({
-    openLinkAccount: () => dispatch<any>(openLinkAccount())
-});
-
 export const MyAccountPanel = compose(
-    connect(mapStateToProps, mapDispatchToProps),
+    connect(mapStateToProps),
     reduxForm({
         form: MY_ACCOUNT_FORM,
         onSubmit: (data, dispatch) => {