[ARVADOS-WORKBENCH2] created: 1.2.1-1064-gb7a4d46

Git user git at public.curoverse.com
Mon Dec 3 02:30:56 EST 2018


        at  b7a4d46fe2b011cdb6e38ed42e9f886fee8290b8 (commit)


commit b7a4d46fe2b011cdb6e38ed42e9f886fee8290b8
Author: Pawel Kromplewski <pawel.kromplewski at contractors.roche.com>
Date:   Mon Dec 3 08:30:45 2018 +0100

    Use redux-form in my account view
    
    Feature #14452
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kromplewski <pawel.kromplewski at contractors.roche.com>

diff --git a/src/routes/route-change-handlers.ts b/src/routes/route-change-handlers.ts
index 1f3bd93..400866e 100644
--- a/src/routes/route-change-handlers.ts
+++ b/src/routes/route-change-handlers.ts
@@ -4,10 +4,8 @@
 
 import { History, Location } from 'history';
 import { RootStore } from '~/store/store';
-import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchSshKeysRoute, matchRepositoriesRoute, matchMyAccountRoute } from './routes';
-import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadSshKeys, loadRepositories, loadMyAccount } from '~/store/workbench/workbench-actions';
-import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchSshKeysRoute, matchRepositoriesRoute, matchVirtualMachineRoute } from './routes';
-import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadSshKeys, loadRepositories, loadVirtualMachines } from '~/store/workbench/workbench-actions';
+import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchSshKeysRoute, matchRepositoriesRoute, matchMyAccountRoute, matchVirtualMachineRoute } from './routes';
+import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadSshKeys, loadRepositories, loadMyAccount, loadVirtualMachines } from '~/store/workbench/workbench-actions';
 import { navigateToRootProject } from '~/store/navigation/navigation-action';
 import { loadSharedWithMe, loadRunProcess, loadWorkflow, loadSearchResults } from '~//store/workbench/workbench-actions';
 
diff --git a/src/views/my-account-panel/my-account-panel-root.tsx b/src/views/my-account-panel/my-account-panel-root.tsx
index c12f01a..4587577 100644
--- a/src/views/my-account-panel/my-account-panel-root.tsx
+++ b/src/views/my-account-panel/my-account-panel-root.tsx
@@ -3,7 +3,9 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from 'react';
-import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, TextField, Button, Typography, Grid, Table, TableHead, TableRow, TableCell, TableBody, Tooltip, IconButton } from '@material-ui/core';
+import { Field, InjectedFormProps } from "redux-form";
+import { TextField } from "~/components/text-field/text-field";
+import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Button, Typography, Grid, Table, TableHead, TableRow, TableCell, TableBody, Tooltip, IconButton } from '@material-ui/core';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { User } from "~/models/user";
 
@@ -15,7 +17,7 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
         overflow: 'auto'
     },
     gridItem: {
-        minHeight: 45,
+        height: 45,
         marginBottom: 20
     },
     title: {
@@ -30,7 +32,9 @@ export interface MyAccountPanelRootDataProps {
     user?: User;
 }
 
-type MyAccountPanelRootProps = MyAccountPanelRootActionProps & MyAccountPanelRootDataProps & WithStyles<CssRules>;
+export const MY_ACCOUNT_FORM = 'myAccountForm';
+
+type MyAccountPanelRootProps = InjectedFormProps<MyAccountPanelRootActionProps> & MyAccountPanelRootDataProps & WithStyles<CssRules>;
 
 export const MyAccountPanelRoot = withStyles(styles)(
     ({ classes, user }: MyAccountPanelRootProps) => {
@@ -41,75 +45,75 @@ export const MyAccountPanelRoot = withStyles(styles)(
                 <Grid container direction="row" spacing={24}>
                     <Grid item xs={6}>
                         <Grid item className={classes.gridItem}>
-                            <TextField
+                            <Field
                                 label="E-mail"
                                 name="email"
-                                fullWidth
+                                component={TextField}
                                 value={user!.email}
                                 disabled
                             />
                         </Grid>
                         <Grid item className={classes.gridItem}>
-                            <TextField
+                            <Field
                                 label="First name"
                                 name="firstName"
-                                fullWidth
+                                component={TextField}
                                 value={user!.firstName}
                                 disabled
                             />
                         </Grid>
                         <Grid item className={classes.gridItem}>
-                            <TextField
+                            <Field
                                 label="Identity URL"
                                 name="identityUrl"
-                                fullWidth
+                                component={TextField}
                                 value={user!.identityUrl}
                                 disabled
                             />
                         </Grid>
                         <Grid item className={classes.gridItem}>
-                            <TextField
+                            <Field
                                 label="Organization"
                                 name="organization"
                                 value={user!.prefs.profile!.organization}
-                                fullWidth
+                                component={TextField}
                             />
                         </Grid>
                         <Grid item className={classes.gridItem}>
-                            <TextField
+                            <Field
                                 label="Website"
                                 name="website"
                                 value={user!.prefs.profile!.website_url}
-                                fullWidth
+                                component={TextField}
                             />
                         </Grid>
                         <Grid item className={classes.gridItem}>
-                            <TextField
+                            <Field
                                 label="Role"
                                 name="role"
                                 value={user!.prefs.profile!.role}
-                                fullWidth
+                                component={TextField}
                             />
                         </Grid>
                     </Grid>
                     <Grid item xs={6}>
                         <Grid item className={classes.gridItem} />
                         <Grid item className={classes.gridItem}>
-                            <TextField
+                            <Field
                                 label="Last name"
                                 name="lastName"
-                                fullWidth
+                                component={TextField}
                                 value={user!.lastName}
                                 disabled
                             />
                         </Grid>
                         <Grid item className={classes.gridItem} />
                         <Grid item className={classes.gridItem}>
-                            <TextField
+                            <Field
                                 label="E-mail at Organization"
                                 name="organizationEmail"
                                 value={user!.prefs.profile!.organization_email}
-                                fullWidth
+                                component={TextField}
                             />
                         </Grid>
                     </Grid>
diff --git a/src/views/my-account-panel/my-account-panel.tsx b/src/views/my-account-panel/my-account-panel.tsx
index 508a4c7..adc2f69 100644
--- a/src/views/my-account-panel/my-account-panel.tsx
+++ b/src/views/my-account-panel/my-account-panel.tsx
@@ -3,9 +3,10 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { RootState } from '~/store/store';
-import { Dispatch } from 'redux';
+import { Dispatch, compose } from 'redux';
+import { reduxForm, reset } from 'redux-form';
 import { connect } from 'react-redux';
-import { MyAccountPanelRoot, MyAccountPanelRootDataProps, MyAccountPanelRootActionProps } from '~/views/my-account-panel/my-account-panel-root';
+import { MyAccountPanelRoot, MyAccountPanelRootDataProps, MyAccountPanelRootActionProps, MY_ACCOUNT_FORM } from '~/views/my-account-panel/my-account-panel-root';
 
 const mapStateToProps = (state: RootState): MyAccountPanelRootDataProps => ({
     user: state.auth.user
@@ -15,4 +16,10 @@ const mapDispatchToProps = (dispatch: Dispatch): MyAccountPanelRootActionProps =
 
 });
 
-export const MyAccountPanel = connect(mapStateToProps, mapDispatchToProps)(MyAccountPanelRoot);
\ No newline at end of file
+export const MyAccountPanel = compose(connect(mapStateToProps, mapDispatchToProps), reduxForm({
+    form: MY_ACCOUNT_FORM,
+    onSubmit: (data, dispatch) => {
+        // dispatch(moveProject(data));
+
+    }
+}))(MyAccountPanelRoot);
\ No newline at end of file

commit 4ea2ff188ec745966387ce8bbe14880bfeede863
Merge: 92dd5d3 b223ff6
Author: Pawel Kromplewski <pawel.kromplewski at contractors.roche.com>
Date:   Mon Dec 3 08:29:41 2018 +0100

    Merge branch 'master' into 14452-my-account
    
    refs #14452
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kromplewski <pawel.kromplewski at contractors.roche.com>

diff --cc src/models/user.ts
index eed135a,9f9c534..dfb4188
--- a/src/models/user.ts
+++ b/src/models/user.ts
@@@ -20,8 -10,7 +20,9 @@@ export interface User 
      lastName: string;
      uuid: string;
      ownerUuid: string;
 +    identityUrl: string;
 +    prefs: userPrefs;
+     isAdmin: boolean;
  }
  
  export const getUserFullname = (user?: User) => {
diff --cc src/routes/route-change-handlers.ts
index f2aed2d,22d0b7c..1f3bd93
--- a/src/routes/route-change-handlers.ts
+++ b/src/routes/route-change-handlers.ts
@@@ -4,8 -4,8 +4,10 @@@
  
  import { History, Location } from 'history';
  import { RootStore } from '~/store/store';
 +import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchSshKeysRoute, matchRepositoriesRoute, matchMyAccountRoute } from './routes';
 +import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadSshKeys, loadRepositories, loadMyAccount } from '~/store/workbench/workbench-actions';
+ import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchSshKeysRoute, matchRepositoriesRoute, matchVirtualMachineRoute } from './routes';
+ import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadSshKeys, loadRepositories, loadVirtualMachines } from '~/store/workbench/workbench-actions';
  import { navigateToRootProject } from '~/store/navigation/navigation-action';
  import { loadSharedWithMe, loadRunProcess, loadWorkflow, loadSearchResults } from '~//store/workbench/workbench-actions';
  
@@@ -27,9 -27,9 +29,10 @@@ const handleLocationChange = (store: Ro
      const searchResultsMatch = matchSearchResultsRoute(pathname);
      const sharedWithMeMatch = matchSharedWithMeRoute(pathname);
      const runProcessMatch = matchRunProcessRoute(pathname);
+     const virtualMachineMatch = matchVirtualMachineRoute(pathname);
      const workflowMatch = matchWorkflowRoute(pathname);
      const sshKeysMatch = matchSshKeysRoute(pathname);
 +    const myAccountMatch = matchMyAccountRoute(pathname);
  
      if (projectMatch) {
          store.dispatch(loadProject(projectMatch.params.id));
diff --cc src/routes/routes.ts
index 988b4cb,71cdfda..a27b427
--- a/src/routes/routes.ts
+++ b/src/routes/routes.ts
@@@ -19,10 -19,10 +19,11 @@@ export const Routes = 
      REPOSITORIES: '/repositories',
      SHARED_WITH_ME: '/shared-with-me',
      RUN_PROCESS: '/run-process',
+     VIRTUAL_MACHINES: '/virtual-machines',
      WORKFLOWS: '/workflows',
      SEARCH_RESULTS: '/search-results',
 -    SSH_KEYS: `/ssh-keys`
 +    SSH_KEYS: `/ssh-keys`,
 +    MY_ACCOUNT: '/my-account'
  };
  
  export const getResourceUrl = (uuid: string) => {
diff --cc src/services/auth-service/auth-service.ts
index d4e81e4,edc6e24..6faaf99
--- a/src/services/auth-service/auth-service.ts
+++ b/src/services/auth-service/auth-service.ts
@@@ -13,8 -13,7 +13,9 @@@ export const USER_FIRST_NAME_KEY = 'use
  export const USER_LAST_NAME_KEY = 'userLastName';
  export const USER_UUID_KEY = 'userUuid';
  export const USER_OWNER_UUID_KEY = 'userOwnerUuid';
+ export const USER_IS_ADMIN = 'isAdmin';
 +export const USER_IDENTITY_URL = 'identityUrl';
 +export const USER_PREFS = 'prefs';
  
  export interface UserDetailsResponse {
      email: string;
@@@ -58,12 -59,12 +63,14 @@@ export class AuthService 
          const email = localStorage.getItem(USER_EMAIL_KEY);
          const firstName = localStorage.getItem(USER_FIRST_NAME_KEY);
          const lastName = localStorage.getItem(USER_LAST_NAME_KEY);
-         const uuid = localStorage.getItem(USER_UUID_KEY);
-         const ownerUuid = localStorage.getItem(USER_OWNER_UUID_KEY);
+         const uuid = this.getUuid();
+         const ownerUuid = this.getOwnerUuid();
+         const isAdmin = this.getIsAdmin();
 +        const identityUrl = localStorage.getItem(USER_IDENTITY_URL);
 +        const prefs = JSON.parse(localStorage.getItem(USER_PREFS) || '{"profile": {}}');
+ 
 -        return email && firstName && lastName && uuid && ownerUuid
 -            ? { email, firstName, lastName, uuid, ownerUuid, isAdmin }
 +        return email && firstName && lastName && uuid && ownerUuid && identityUrl && prefs
-             ? { email, firstName, lastName, uuid, ownerUuid, identityUrl, prefs }
++            ? { email, firstName, lastName, uuid, ownerUuid, isAdmin, identityUrl, prefs }
              : undefined;
      }
  
@@@ -73,8 -74,7 +80,9 @@@
          localStorage.setItem(USER_LAST_NAME_KEY, user.lastName);
          localStorage.setItem(USER_UUID_KEY, user.uuid);
          localStorage.setItem(USER_OWNER_UUID_KEY, user.ownerUuid);
+         localStorage.setItem(USER_IS_ADMIN, JSON.stringify(user.isAdmin));
 +        localStorage.setItem(USER_IDENTITY_URL, user.identityUrl);
 +        localStorage.setItem(USER_PREFS, JSON.stringify(user.prefs));
      }
  
      public removeUser() {
@@@ -83,8 -83,7 +91,9 @@@
          localStorage.removeItem(USER_LAST_NAME_KEY);
          localStorage.removeItem(USER_UUID_KEY);
          localStorage.removeItem(USER_OWNER_UUID_KEY);
+         localStorage.removeItem(USER_IS_ADMIN);
 +        localStorage.removeItem(USER_IDENTITY_URL);
 +        localStorage.removeItem(USER_PREFS);
      }
  
      public login() {
@@@ -112,8 -109,7 +121,9 @@@
                      lastName: resp.data.last_name,
                      uuid: resp.data.uuid,
                      ownerUuid: resp.data.owner_uuid,
 -                    isAdmin: resp.data.is_admin
++                    isAdmin: resp.data.is_admin,
 +                    identityUrl: resp.data.identity_url,
 +                    prefs
                  };
              })
              .catch(e => {
diff --cc src/store/auth/auth-reducer.test.ts
index 592191c,a4017db..b9f768f
--- a/src/store/auth/auth-reducer.test.ts
+++ b/src/store/auth/auth-reducer.test.ts
@@@ -30,8 -30,7 +30,9 @@@ describe('auth-reducer', () => 
              lastName: "Doe",
              uuid: "uuid",
              ownerUuid: "ownerUuid",
 +            identityUrl: "identityUrl",
-             prefs: {}
++            prefs: {},
+             isAdmin: false
          };
          const state = reducer(initialState, authActions.INIT({ user, token: "token" }));
          expect(state).toEqual({
@@@ -60,8 -60,7 +62,9 @@@
              lastName: "Doe",
              uuid: "uuid",
              ownerUuid: "ownerUuid",
 +            identityUrl: "identityUrl",
-             prefs: {}
++            prefs: {},
+             isAdmin: false
          };
  
          const state = reducer(initialState, authActions.USER_DETAILS_SUCCESS(user));
diff --cc src/views-components/main-app-bar/account-menu.tsx
index b93bfcf,ca88021..0aedee9
--- a/src/views-components/main-app-bar/account-menu.tsx
+++ b/src/views-components/main-app-bar/account-menu.tsx
@@@ -12,7 -12,8 +12,8 @@@ import { logout } from '~/store/auth/au
  import { RootState } from "~/store/store";
  import { openCurrentTokenDialog } from '~/store/current-token-dialog/current-token-dialog-actions';
  import { openRepositoriesPanel } from "~/store/repositories/repositories-actions";
 -import { navigateToSshKeys } from '~/store/navigation/navigation-action';
 +import { navigateToSshKeys, navigateToMyAccount } from '~/store/navigation/navigation-action';
+ import { openVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
  
  interface AccountMenuProps {
      user?: User;
diff --cc src/views/workbench/workbench.tsx
index 8542e6c,3914f64..2cff431
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@@ -128,9 -128,9 +129,10 @@@ export const WorkbenchPanel 
                                  <Route path={Routes.RUN_PROCESS} component={RunProcessPanel} />
                                  <Route path={Routes.WORKFLOWS} component={WorkflowPanel} />
                                  <Route path={Routes.SEARCH_RESULTS} component={SearchResultsPanel} />
+                                 <Route path={Routes.VIRTUAL_MACHINES} component={VirtualMachinePanel} />
                                  <Route path={Routes.REPOSITORIES} component={RepositoriesPanel} />
                                  <Route path={Routes.SSH_KEYS} component={SshKeyPanel} />
 +                                <Route path={Routes.MY_ACCOUNT} component={MyAccountPanel} />
                              </Switch>
                          </Grid>
                      </Grid>

commit 92dd5d32b573b5c90f3ce72dc207f6d0e7f21178
Author: Pawel Kromplewski <pawel.kromplewski at contractors.roche.com>
Date:   Thu Nov 29 13:47:09 2018 +0100

    Create my account view
    
    Feature #14452
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kromplewski <pawel.kromplewski at contractors.roche.com>

diff --git a/src/models/user.ts b/src/models/user.ts
index c2f21e5..eed135a 100644
--- a/src/models/user.ts
+++ b/src/models/user.ts
@@ -4,12 +4,24 @@
 
 import { Resource, ResourceKind } from '~/models/resource';
 
+export type userPrefs = {
+    profile?: {
+        organization?: string,
+        organization_email?: string,
+        lab?: string,
+        website_url?: string,
+        role?: string
+    }
+};
+
 export interface User {
     email: string;
     firstName: string;
     lastName: string;
     uuid: string;
     ownerUuid: string;
+    identityUrl: string;
+    prefs: userPrefs;
 }
 
 export const getUserFullname = (user?: User) => {
diff --git a/src/routes/route-change-handlers.ts b/src/routes/route-change-handlers.ts
index c7f3555..f2aed2d 100644
--- a/src/routes/route-change-handlers.ts
+++ b/src/routes/route-change-handlers.ts
@@ -4,8 +4,8 @@
 
 import { History, Location } from 'history';
 import { RootStore } from '~/store/store';
-import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchSshKeysRoute, matchRepositoriesRoute } from './routes';
-import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadSshKeys, loadRepositories } from '~/store/workbench/workbench-actions';
+import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchSshKeysRoute, matchRepositoriesRoute, matchMyAccountRoute } from './routes';
+import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadSshKeys, loadRepositories, loadMyAccount } from '~/store/workbench/workbench-actions';
 import { navigateToRootProject } from '~/store/navigation/navigation-action';
 import { loadSharedWithMe, loadRunProcess, loadWorkflow, loadSearchResults } from '~//store/workbench/workbench-actions';
 
@@ -29,6 +29,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
     const runProcessMatch = matchRunProcessRoute(pathname);
     const workflowMatch = matchWorkflowRoute(pathname);
     const sshKeysMatch = matchSshKeysRoute(pathname);
+    const myAccountMatch = matchMyAccountRoute(pathname);
 
     if (projectMatch) {
         store.dispatch(loadProject(projectMatch.params.id));
@@ -56,5 +57,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         store.dispatch(loadRepositories);
     } else if (sshKeysMatch) {
         store.dispatch(loadSshKeys);
+    } else if (myAccountMatch) {
+        store.dispatch(loadMyAccount);
     }
 };
diff --git a/src/routes/routes.ts b/src/routes/routes.ts
index c9c2ae2..988b4cb 100644
--- a/src/routes/routes.ts
+++ b/src/routes/routes.ts
@@ -21,7 +21,8 @@ export const Routes = {
     RUN_PROCESS: '/run-process',
     WORKFLOWS: '/workflows',
     SEARCH_RESULTS: '/search-results',
-    SSH_KEYS: `/ssh-keys`
+    SSH_KEYS: `/ssh-keys`,
+    MY_ACCOUNT: '/my-account'
 };
 
 export const getResourceUrl = (uuid: string) => {
@@ -84,3 +85,6 @@ export const matchRepositoriesRoute = (route: string) =>
     
 export const matchSshKeysRoute = (route: string) =>
     matchPath(route, { path: Routes.SSH_KEYS });
+
+export const matchMyAccountRoute = (route: string) =>
+    matchPath(route, { path: Routes.MY_ACCOUNT });
diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts
index 50760bb..d4e81e4 100644
--- a/src/services/auth-service/auth-service.ts
+++ b/src/services/auth-service/auth-service.ts
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { User } from "~/models/user";
+import { User, userPrefs } from "~/models/user";
 import { AxiosInstance } from "axios";
 import { ApiActions, ProgressFn } from "~/services/api/api-actions";
 import * as uuid from "uuid/v4";
@@ -13,6 +13,8 @@ export const USER_FIRST_NAME_KEY = 'userFirstName';
 export const USER_LAST_NAME_KEY = 'userLastName';
 export const USER_UUID_KEY = 'userUuid';
 export const USER_OWNER_UUID_KEY = 'userOwnerUuid';
+export const USER_IDENTITY_URL = 'identityUrl';
+export const USER_PREFS = 'prefs';
 
 export interface UserDetailsResponse {
     email: string;
@@ -21,6 +23,8 @@ export interface UserDetailsResponse {
     uuid: string;
     owner_uuid: string;
     is_admin: boolean;
+    identity_url: string;
+    prefs: userPrefs;
 }
 
 export class AuthService {
@@ -56,9 +60,10 @@ export class AuthService {
         const lastName = localStorage.getItem(USER_LAST_NAME_KEY);
         const uuid = localStorage.getItem(USER_UUID_KEY);
         const ownerUuid = localStorage.getItem(USER_OWNER_UUID_KEY);
-
-        return email && firstName && lastName && uuid && ownerUuid
-            ? { email, firstName, lastName, uuid, ownerUuid }
+        const identityUrl = localStorage.getItem(USER_IDENTITY_URL);
+        const prefs = JSON.parse(localStorage.getItem(USER_PREFS) || '{"profile": {}}');
+        return email && firstName && lastName && uuid && ownerUuid && identityUrl && prefs
+            ? { email, firstName, lastName, uuid, ownerUuid, identityUrl, prefs }
             : undefined;
     }
 
@@ -68,6 +73,8 @@ export class AuthService {
         localStorage.setItem(USER_LAST_NAME_KEY, user.lastName);
         localStorage.setItem(USER_UUID_KEY, user.uuid);
         localStorage.setItem(USER_OWNER_UUID_KEY, user.ownerUuid);
+        localStorage.setItem(USER_IDENTITY_URL, user.identityUrl);
+        localStorage.setItem(USER_PREFS, JSON.stringify(user.prefs));
     }
 
     public removeUser() {
@@ -76,6 +83,8 @@ export class AuthService {
         localStorage.removeItem(USER_LAST_NAME_KEY);
         localStorage.removeItem(USER_UUID_KEY);
         localStorage.removeItem(USER_OWNER_UUID_KEY);
+        localStorage.removeItem(USER_IDENTITY_URL);
+        localStorage.removeItem(USER_PREFS);
     }
 
     public login() {
@@ -95,12 +104,16 @@ export class AuthService {
             .get<UserDetailsResponse>('/users/current')
             .then(resp => {
                 this.actions.progressFn(reqId, false);
+                const prefs = resp.data.prefs.profile ? resp.data.prefs : { profile: {}};
+                console.log(resp.data);
                 return {
                     email: resp.data.email,
                     firstName: resp.data.first_name,
                     lastName: resp.data.last_name,
                     uuid: resp.data.uuid,
-                    ownerUuid: resp.data.owner_uuid
+                    ownerUuid: resp.data.owner_uuid,
+                    identityUrl: resp.data.identity_url,
+                    prefs
                 };
             })
             .catch(e => {
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index 28559b1..a2046f3 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -161,5 +161,4 @@ export const loadSshKeysPanel = () =>
         }
     };
 
-
 export type AuthAction = UnionOf<typeof authActions>;
diff --git a/src/store/auth/auth-reducer.test.ts b/src/store/auth/auth-reducer.test.ts
index 25ce2c1..592191c 100644
--- a/src/store/auth/auth-reducer.test.ts
+++ b/src/store/auth/auth-reducer.test.ts
@@ -29,7 +29,9 @@ describe('auth-reducer', () => {
             firstName: "John",
             lastName: "Doe",
             uuid: "uuid",
-            ownerUuid: "ownerUuid"
+            ownerUuid: "ownerUuid",
+            identityUrl: "identityUrl",
+            prefs: {}
         };
         const state = reducer(initialState, authActions.INIT({ user, token: "token" }));
         expect(state).toEqual({
@@ -57,7 +59,9 @@ describe('auth-reducer', () => {
             firstName: "John",
             lastName: "Doe",
             uuid: "uuid",
-            ownerUuid: "ownerUuid"
+            ownerUuid: "ownerUuid",
+            identityUrl: "identityUrl",
+            prefs: {}
         };
 
         const state = reducer(initialState, authActions.USER_DETAILS_SUCCESS(user));
diff --git a/src/store/my-account/my-account-panel-actions.ts b/src/store/my-account/my-account-panel-actions.ts
new file mode 100644
index 0000000..cb1584c
--- /dev/null
+++ b/src/store/my-account/my-account-panel-actions.ts
@@ -0,0 +1,17 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { RootState } from "~/store/store";
+import { ServiceRepository } from "~/services/services";
+import { setBreadcrumbs } from "~/store/breadcrumbs/breadcrumbs-actions";
+
+export const loadMyAccountPanel = () =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        try {
+            dispatch(setBreadcrumbs([{ label: 'User profile'}]));
+        } catch (e) {
+            return;
+        }
+    };
\ No newline at end of file
diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts
index fc08f3a..0b6713b 100644
--- a/src/store/navigation/navigation-action.ts
+++ b/src/store/navigation/navigation-action.ts
@@ -65,3 +65,5 @@ export const navigateToSearchResults = push(Routes.SEARCH_RESULTS);
 export const navigateToRepositories = push(Routes.REPOSITORIES);
 
 export const navigateToSshKeys= push(Routes.SSH_KEYS);
+
+export const navigateToMyAccount = push(Routes.MY_ACCOUNT);
diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts
index 5e33661..dc54e4b 100644
--- a/src/store/workbench/workbench-actions.ts
+++ b/src/store/workbench/workbench-actions.ts
@@ -40,6 +40,7 @@ import { loadSharedWithMePanel } from '~/store/shared-with-me-panel/shared-with-
 import { CopyFormDialogData } from '~/store/copy-dialog/copy-dialog';
 import { loadWorkflowPanel, workflowPanelActions } from '~/store/workflow-panel/workflow-panel-actions';
 import { loadSshKeysPanel } from '~/store/auth/auth-action';
+import { loadMyAccountPanel } from '~/store/my-account/my-account-panel-actions';
 import { workflowPanelColumns } from '~/views/workflow-panel/workflow-panel-view';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
 import { getProgressIndicator } from '~/store/progress-indicator/progress-indicator-reducer';
@@ -403,6 +404,11 @@ export const loadSshKeys = handleFirstTimeLoad(
         await dispatch(loadSshKeysPanel());
     });
 
+export const loadMyAccount = handleFirstTimeLoad(
+    async (dispatch: Dispatch<any>) => {
+        await dispatch(loadMyAccountPanel());
+    });
+
 const finishLoadingProject = (project: GroupContentsResource | string) =>
     async (dispatch: Dispatch<any>) => {
         const uuid = typeof project === 'string' ? project : project.uuid;
diff --git a/src/views-components/main-app-bar/account-menu.tsx b/src/views-components/main-app-bar/account-menu.tsx
index f00c678..b93bfcf 100644
--- a/src/views-components/main-app-bar/account-menu.tsx
+++ b/src/views-components/main-app-bar/account-menu.tsx
@@ -12,7 +12,7 @@ import { logout } from '~/store/auth/auth-action';
 import { RootState } from "~/store/store";
 import { openCurrentTokenDialog } from '~/store/current-token-dialog/current-token-dialog-actions';
 import { openRepositoriesPanel } from "~/store/repositories/repositories-actions";
-import { navigateToSshKeys } from '~/store/navigation/navigation-action';
+import { navigateToSshKeys, navigateToMyAccount } from '~/store/navigation/navigation-action';
 
 interface AccountMenuProps {
     user?: User;
@@ -35,7 +35,7 @@ export const AccountMenu = connect(mapStateToProps)(
                 <MenuItem onClick={() => dispatch(openRepositoriesPanel())}>Repositories</MenuItem>
                 <MenuItem onClick={() => dispatch(openCurrentTokenDialog)}>Current token</MenuItem>
                 <MenuItem onClick={() => dispatch(navigateToSshKeys)}>Ssh Keys</MenuItem>
-                <MenuItem>My account</MenuItem>
+                <MenuItem onClick={() => dispatch(navigateToMyAccount)}>My account</MenuItem>
                 <MenuItem onClick={() => dispatch(logout())}>Logout</MenuItem>
             </DropdownMenu>
             : null);
diff --git a/src/views/my-account-panel/my-account-panel-root.tsx b/src/views/my-account-panel/my-account-panel-root.tsx
new file mode 100644
index 0000000..c12f01a
--- /dev/null
+++ b/src/views/my-account-panel/my-account-panel-root.tsx
@@ -0,0 +1,119 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, TextField, Button, Typography, Grid, Table, TableHead, TableRow, TableCell, TableBody, Tooltip, IconButton } from '@material-ui/core';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { User } from "~/models/user";
+
+type CssRules = 'root' | 'gridItem' | 'title';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+        width: '100%',
+        overflow: 'auto'
+    },
+    gridItem: {
+        minHeight: 45,
+        marginBottom: 20
+    },
+    title: {
+        marginBottom: theme.spacing.unit * 3,
+        color: theme.palette.grey["600"]
+    }
+});
+
+export interface MyAccountPanelRootActionProps {}
+
+export interface MyAccountPanelRootDataProps {
+    user?: User;
+}
+
+type MyAccountPanelRootProps = MyAccountPanelRootActionProps & MyAccountPanelRootDataProps & WithStyles<CssRules>;
+
+export const MyAccountPanelRoot = withStyles(styles)(
+    ({ classes, user }: MyAccountPanelRootProps) => {
+        console.log(user);
+        return <Card className={classes.root}>
+            <CardContent>
+                <Typography variant="title" className={classes.title}>User profile</Typography>
+                <Grid container direction="row" spacing={24}>
+                    <Grid item xs={6}>
+                        <Grid item className={classes.gridItem}>
+                            <TextField
+                                label="E-mail"
+                                name="email"
+                                fullWidth
+                                value={user!.email}
+                                disabled
+                            />
+                        </Grid>
+                        <Grid item className={classes.gridItem}>
+                            <TextField
+                                label="First name"
+                                name="firstName"
+                                fullWidth
+                                value={user!.firstName}
+                                disabled
+                            />
+                        </Grid>
+                        <Grid item className={classes.gridItem}>
+                            <TextField
+                                label="Identity URL"
+                                name="identityUrl"
+                                fullWidth
+                                value={user!.identityUrl}
+                                disabled
+                            />
+                        </Grid>
+                        <Grid item className={classes.gridItem}>
+                            <TextField
+                                label="Organization"
+                                name="organization"
+                                value={user!.prefs.profile!.organization}
+                                fullWidth
+                            />
+                        </Grid>
+                        <Grid item className={classes.gridItem}>
+                            <TextField
+                                label="Website"
+                                name="website"
+                                value={user!.prefs.profile!.website_url}
+                                fullWidth
+                            />
+                        </Grid>
+                        <Grid item className={classes.gridItem}>
+                            <TextField
+                                label="Role"
+                                name="role"
+                                value={user!.prefs.profile!.role}
+                                fullWidth
+                            />
+                        </Grid>
+                    </Grid>
+                    <Grid item xs={6}>
+                        <Grid item className={classes.gridItem} />
+                        <Grid item className={classes.gridItem}>
+                            <TextField
+                                label="Last name"
+                                name="lastName"
+                                fullWidth
+                                value={user!.lastName}
+                                disabled
+                            />
+                        </Grid>
+                        <Grid item className={classes.gridItem} />
+                        <Grid item className={classes.gridItem}>
+                            <TextField
+                                label="E-mail at Organization"
+                                name="organizationEmail"
+                                value={user!.prefs.profile!.organization_email}
+                                fullWidth
+                            />
+                        </Grid>
+                    </Grid>
+                </Grid>
+            </CardContent>
+        </Card>;}
+);
\ No newline at end of file
diff --git a/src/views/my-account-panel/my-account-panel.tsx b/src/views/my-account-panel/my-account-panel.tsx
new file mode 100644
index 0000000..508a4c7
--- /dev/null
+++ b/src/views/my-account-panel/my-account-panel.tsx
@@ -0,0 +1,18 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { RootState } from '~/store/store';
+import { Dispatch } from 'redux';
+import { connect } from 'react-redux';
+import { MyAccountPanelRoot, MyAccountPanelRootDataProps, MyAccountPanelRootActionProps } from '~/views/my-account-panel/my-account-panel-root';
+
+const mapStateToProps = (state: RootState): MyAccountPanelRootDataProps => ({
+    user: state.auth.user
+});
+
+const mapDispatchToProps = (dispatch: Dispatch): MyAccountPanelRootActionProps => ({
+
+});
+
+export const MyAccountPanel = connect(mapStateToProps, mapDispatchToProps)(MyAccountPanelRoot);
\ No newline at end of file
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 84c8e24..8542e6c 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -45,6 +45,7 @@ import SplitterLayout from 'react-splitter-layout';
 import { WorkflowPanel } from '~/views/workflow-panel/workflow-panel';
 import { SearchResultsPanel } from '~/views/search-results-panel/search-results-panel';
 import { SshKeyPanel } from '~/views/ssh-key-panel/ssh-key-panel';
+import { MyAccountPanel } from '~/views/my-account-panel/my-account-panel';
 import { SharingDialog } from '~/views-components/sharing-dialog/sharing-dialog';
 import { AdvancedTabDialog } from '~/views-components/advanced-tab-dialog/advanced-tab-dialog';
 import { ProcessInputDialog } from '~/views-components/process-input-dialog/process-input-dialog';
@@ -129,6 +130,7 @@ export const WorkbenchPanel =
                                 <Route path={Routes.SEARCH_RESULTS} component={SearchResultsPanel} />
                                 <Route path={Routes.REPOSITORIES} component={RepositoriesPanel} />
                                 <Route path={Routes.SSH_KEYS} component={SshKeyPanel} />
+                                <Route path={Routes.MY_ACCOUNT} component={MyAccountPanel} />
                             </Switch>
                         </Grid>
                     </Grid>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list