[ARVADOS-WORKBENCH2] updated: 1.3.0-33-ga29cf34

Git user git at public.curoverse.com
Thu Dec 6 08:07:41 EST 2018


Summary of changes:
 src/models/user.ts                                 |  4 +--
 src/services/auth-service/auth-service.ts          |  5 ++-
 src/store/my-account/my-account-panel-actions.ts   | 15 ++++-----
 src/store/workbench/workbench-actions.ts           |  4 +--
 src/validators/validators.tsx                      |  2 ++
 .../my-account-panel/my-account-panel-root.tsx     | 36 ++++++++++++----------
 src/views/my-account-panel/my-account-panel.tsx    |  3 +-
 7 files changed, 36 insertions(+), 33 deletions(-)

       via  a29cf3418b6c301c0f531cecb7db4c721e7eb014 (commit)
      from  a1e2b8ba77e4a7273940a3fc542bc42e282618a7 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit a29cf3418b6c301c0f531cecb7db4c721e7eb014
Author: Pawel Kromplewski <pawel.kromplewski at contractors.roche.com>
Date:   Thu Dec 6 14:07:30 2018 +0100

    My Account adjustments
    
    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 dfb4188..60d598d 100644
--- a/src/models/user.ts
+++ b/src/models/user.ts
@@ -4,7 +4,7 @@
 
 import { Resource, ResourceKind } from '~/models/resource';
 
-export type userPrefs = {
+export type UserPrefs = {
     profile?: {
         organization?: string,
         organization_email?: string,
@@ -21,7 +21,7 @@ export interface User {
     uuid: string;
     ownerUuid: string;
     identityUrl: string;
-    prefs: userPrefs;
+    prefs: UserPrefs;
     isAdmin: boolean;
 }
 
diff --git a/src/services/auth-service/auth-service.ts b/src/services/auth-service/auth-service.ts
index 8c2ad5c..22c9dcd 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, userPrefs } from "~/models/user";
+import { User, UserPrefs } from "~/models/user";
 import { AxiosInstance } from "axios";
 import { ApiActions } from "~/services/api/api-actions";
 import * as uuid from "uuid/v4";
@@ -25,7 +25,7 @@ export interface UserDetailsResponse {
     owner_uuid: string;
     is_admin: boolean;
     identity_url: string;
-    prefs: userPrefs;
+    prefs: UserPrefs;
 }
 
 export class AuthService {
@@ -114,7 +114,6 @@ export class AuthService {
             .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,
diff --git a/src/store/my-account/my-account-panel-actions.ts b/src/store/my-account/my-account-panel-actions.ts
index 93c6a3c..34bb269 100644
--- a/src/store/my-account/my-account-panel-actions.ts
+++ b/src/store/my-account/my-account-panel-actions.ts
@@ -8,16 +8,13 @@ import { initialize } from "redux-form";
 import { ServiceRepository } from "~/services/services";
 import { setBreadcrumbs } from "~/store/breadcrumbs/breadcrumbs-actions";
 import { authActions } from "~/store/auth/auth-action";
-import { snackbarActions } from "~/store/snackbar/snackbar-actions";
-import { MY_ACCOUNT_FORM } from "~/views/my-account-panel/my-account-panel-root";
+import { snackbarActions, SnackbarKind } from "~/store/snackbar/snackbar-actions";
+
+export const MY_ACCOUNT_FORM = 'myAccountForm';
 
 export const loadMyAccountPanel = () =>
-    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
-        try {
-            dispatch(setBreadcrumbs([{ label: 'User profile'}]));
-        } catch (e) {
-            return;
-        }
+    (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        dispatch(setBreadcrumbs([{ label: 'User profile'}]));
     };
 
 export const saveEditedUser = (resource: any) =>
@@ -27,7 +24,7 @@ export const saveEditedUser = (resource: any) =>
             services.authService.saveUser(resource);
             dispatch(authActions.USER_DETAILS_SUCCESS(resource));
             dispatch(initialize(MY_ACCOUNT_FORM, resource));
-            dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Profile has been updated." }));
+            dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Profile has been updated.", hideDuration: 2000, kind: SnackbarKind.SUCCESS }));
         } catch(e) {
             return;
         }
diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts
index 9d0140f..49c50f2 100644
--- a/src/store/workbench/workbench-actions.ts
+++ b/src/store/workbench/workbench-actions.ts
@@ -414,8 +414,8 @@ export const loadSshKeys = handleFirstTimeLoad(
     });
 
 export const loadMyAccount = handleFirstTimeLoad(
-    async (dispatch: Dispatch<any>) => {
-        await dispatch(loadMyAccountPanel());
+    (dispatch: Dispatch<any>) => {
+        dispatch(loadMyAccountPanel());
     });
 
 export const loadKeepServices = handleFirstTimeLoad(
diff --git a/src/validators/validators.tsx b/src/validators/validators.tsx
index c601df1..a3f5df2 100644
--- a/src/validators/validators.tsx
+++ b/src/validators/validators.tsx
@@ -26,3 +26,5 @@ export const REPOSITORY_NAME_VALIDATION = [require, maxLength(255)];
 
 export const SSH_KEY_PUBLIC_VALIDATION = [require, isRsaKey, maxLength(1024)];
 export const SSH_KEY_NAME_VALIDATION = [require, maxLength(255)];
+
+export const MY_ACCOUNT_VALIDATION = [require];
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 994a781..c92c48d 100644
--- a/src/views/my-account-panel/my-account-panel-root.tsx
+++ b/src/views/my-account-panel/my-account-panel-root.tsx
@@ -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>;
 
@@ -96,7 +102,7 @@ export const MyAccountPanelRoot = withStyles(styles)(
                                     label="*Organization"
                                     name="prefs.profile.organization"
                                     component={TextField}
-                                    validate={FILES_FIELD_VALIDATION}
+                                    validate={MY_ACCOUNT_VALIDATION}
                                 />
                             </Grid>
                             <Grid item className={classes.gridItem}>
@@ -112,15 +118,7 @@ export const MyAccountPanelRoot = withStyles(styles)(
                                     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>
@@ -140,13 +138,19 @@ export const MyAccountPanelRoot = withStyles(styles)(
                                     label="*E-mail at Organization"
                                     name="prefs.profile.organization_email"
                                     component={TextField}
-                                    validate={FILES_FIELD_VALIDATION}
+                                    validate={MY_ACCOUNT_VALIDATION}
                                 />
                             </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>
diff --git a/src/views/my-account-panel/my-account-panel.tsx b/src/views/my-account-panel/my-account-panel.tsx
index 03caa88..5c2c531 100644
--- a/src/views/my-account-panel/my-account-panel.tsx
+++ b/src/views/my-account-panel/my-account-panel.tsx
@@ -7,7 +7,8 @@ import { compose } from 'redux';
 import { reduxForm, isPristine, isValid } from 'redux-form';
 import { connect } from 'react-redux';
 import { saveEditedUser } from '~/store/my-account/my-account-panel-actions';
-import { MyAccountPanelRoot, MyAccountPanelRootDataProps, MY_ACCOUNT_FORM } from '~/views/my-account-panel/my-account-panel-root';
+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 => ({
     isPristine: isPristine(MY_ACCOUNT_FORM)(state),

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list