[ARVADOS-WORKBENCH2] updated: 1.3.0-138-gb1a6da4a

Git user git at public.curoverse.com
Mon Dec 17 10:21:46 EST 2018


Summary of changes:
 src/store/users/users-actions.ts                   |  9 +++-
 .../dialog-create/dialog-user-create.tsx           |  3 +-
 .../dialog-forms/setup-shell-account-dialog.tsx    | 63 ++++++++++++++++++++++
 .../form-fields/user-form-fields.tsx               |  7 ---
 src/views-components/user-dialog/manage-dialog.tsx | 18 +++++--
 src/views/workbench/workbench.tsx                  |  2 +
 6 files changed, 88 insertions(+), 14 deletions(-)
 create mode 100644 src/views-components/dialog-forms/setup-shell-account-dialog.tsx

       via  b1a6da4a288560a87e0e38ad2fd73fb227e3fc66 (commit)
      from  ba827c8901ad45c3a8af49bf11af20c90bd46376 (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 b1a6da4a288560a87e0e38ad2fd73fb227e3fc66
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Mon Dec 17 16:21:28 2018 +0100

    init-setup-shell-acc-dialog
    
    Feature #14565
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/store/users/users-actions.ts b/src/store/users/users-actions.ts
index 61b5aad4..1a1c58ee 100644
--- a/src/store/users/users-actions.ts
+++ b/src/store/users/users-actions.ts
@@ -17,10 +17,10 @@ export const USERS_PANEL_ID = 'usersPanel';
 export const USER_ATTRIBUTES_DIALOG = 'userAttributesDialog';
 export const USER_CREATE_FORM_NAME = 'userCreateFormName';
 export const USER_MANAGE_DIALOG = 'userManageDialog';
+export const SETUP_SHELL_ACCOUNT_DIALOG = 'setupShellAccountDialog';
 
 export interface UserCreateFormDialogData {
     email: string;
-    identityUrl: string;
     virtualMachineName: string;
     groupVirtualMachine: string;
 }
@@ -39,6 +39,13 @@ export const openUserManage = (uuid: string) =>
         dispatch(dialogActions.OPEN_DIALOG({ id: USER_MANAGE_DIALOG, data }));
     };
 
+export const openSetupShellAccount = (uuid: string) =>
+    (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        const { resources } = getState();
+        const data = getResource<UserResource>(uuid)(resources);
+        dispatch(dialogActions.OPEN_DIALOG({ id: SETUP_SHELL_ACCOUNT_DIALOG, data }));
+    };
+
 export const openUserCreateDialog = () =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
         const userUuid = await services.authService.getUuid();
diff --git a/src/views-components/dialog-create/dialog-user-create.tsx b/src/views-components/dialog-create/dialog-user-create.tsx
index 14365af7..06db5873 100644
--- a/src/views-components/dialog-create/dialog-user-create.tsx
+++ b/src/views-components/dialog-create/dialog-user-create.tsx
@@ -6,7 +6,7 @@ import * as React from 'react';
 import { InjectedFormProps } from 'redux-form';
 import { WithDialogProps } from '~/store/dialog/with-dialog';
 import { FormDialog } from '~/components/form-dialog/form-dialog';
-import { UserEmailField, UserIdentityUrlField, UserVirtualMachineField, UserGroupsVirtualMachineField } from '~/views-components/form-fields/user-form-fields';
+import { UserEmailField, UserVirtualMachineField, UserGroupsVirtualMachineField } from '~/views-components/form-fields/user-form-fields';
 
 export type DialogUserProps = WithDialogProps<{}> & InjectedFormProps<any>;
 
@@ -20,7 +20,6 @@ export const UserRepositoryCreate = (props: DialogUserProps) =>
 
 const UserAddFields = (props: DialogUserProps) => <span>
     <UserEmailField />
-    <UserIdentityUrlField />
     <UserVirtualMachineField data={props.data}/>
     <UserGroupsVirtualMachineField />
 </span>;
diff --git a/src/views-components/dialog-forms/setup-shell-account-dialog.tsx b/src/views-components/dialog-forms/setup-shell-account-dialog.tsx
new file mode 100644
index 00000000..75f0bb6a
--- /dev/null
+++ b/src/views-components/dialog-forms/setup-shell-account-dialog.tsx
@@ -0,0 +1,63 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+import * as React from 'react';
+import { compose } from "redux";
+import { reduxForm, InjectedFormProps, Field } from 'redux-form';
+import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
+import { FormDialog } from '~/components/form-dialog/form-dialog';
+import { TextField } from '~/components/text-field/text-field';
+import { VirtualMachinesResource } from '~/models/virtual-machines';
+import { USER_LENGTH_VALIDATION } from '~/validators/validators';
+import { InputLabel } from '@material-ui/core';
+import { NativeSelectField } from '~/components/select-field/select-field';
+import { SETUP_SHELL_ACCOUNT_DIALOG, createUser } from '~/store/users/users-actions';
+
+interface SetupShellAccountFormDialogData {
+    email: string;
+    virtualMachineName: string;
+    groupVirtualMachine: string;
+}
+
+export const SetupShellAccountDialog = compose(
+    withDialog(SETUP_SHELL_ACCOUNT_DIALOG),
+    reduxForm<SetupShellAccountFormDialogData>({
+        form: SETUP_SHELL_ACCOUNT_DIALOG,
+        onSubmit: (data, dispatch) => {
+            dispatch(createUser(data));
+        }
+    })
+)(
+    (props: SetupShellAccountDialogComponentProps) =>
+        <FormDialog
+            dialogTitle='Setup shell account'
+            formFields={SetupShellAccountFormFields}
+            submitLabel='Submit'
+            {...props}
+        />
+);
+
+const UserEmailField = ({ data }: any) =>
+    <Field
+        name='email'
+        component={TextField}
+        disabled
+        label={data.email} />;
+
+const UserGroupsVirtualMachineField = () =>
+    <Field
+        name='groups'
+        component={TextField}
+        validate={USER_LENGTH_VALIDATION}
+        label="Groups for virtual machine (comma separated list)" />;
+
+type SetupShellAccountDialogComponentProps = WithDialogProps<{}> & InjectedFormProps<SetupShellAccountFormDialogData>;
+
+const SetupShellAccountFormFields = (props: SetupShellAccountDialogComponentProps) =>
+    <>
+        <UserEmailField data={props.data}/>
+        <UserGroupsVirtualMachineField />
+    </>;
+
+
+
diff --git a/src/views-components/form-fields/user-form-fields.tsx b/src/views-components/form-fields/user-form-fields.tsx
index 85634449..11d7d802 100644
--- a/src/views-components/form-fields/user-form-fields.tsx
+++ b/src/views-components/form-fields/user-form-fields.tsx
@@ -18,13 +18,6 @@ export const UserEmailField = () =>
         autoFocus={true}
         label="Email" />;
 
-export const UserIdentityUrlField = () =>
-    <Field
-        name='identityUrl'
-        component={TextField}
-        validate={USER_LENGTH_VALIDATION}
-        label="Identity URL Prefix" />;
-
 export const UserVirtualMachineField = ({ data }: any) =>
     <div style={{ marginBottom: '21px' }}>
         <InputLabel>Virtual Machine</InputLabel>
diff --git a/src/views-components/user-dialog/manage-dialog.tsx b/src/views-components/user-dialog/manage-dialog.tsx
index 953e312e..ddf73fb3 100644
--- a/src/views-components/user-dialog/manage-dialog.tsx
+++ b/src/views-components/user-dialog/manage-dialog.tsx
@@ -8,9 +8,10 @@ import { WithDialogProps } from "~/store/dialog/with-dialog";
 import { withDialog } from '~/store/dialog/with-dialog';
 import { WithStyles, withStyles } from '@material-ui/core/styles';
 import { ArvadosTheme } from '~/common/custom-theme';
-import { compose } from "redux";
-import { USER_MANAGE_DIALOG } from "~/store/users/users-actions";
+import { compose, Dispatch } from "redux";
+import { USER_MANAGE_DIALOG, openSetupShellAccount } from "~/store/users/users-actions";
 import { UserResource } from "~/models/user";
+import { connect } from "react-redux";
 
 type CssRules = 'spacing';
 
@@ -25,9 +26,18 @@ interface UserManageDataProps {
     data: UserResource;
 }
 
-type UserManageProps = UserManageDataProps & WithStyles<CssRules>;
+interface UserManageActionProps {
+    openSetupShellAccount: (uuid: string) => void;
+}
+
+const mapDispatchToProps = (dispatch: Dispatch) => ({
+    openSetupShellAccount: (uuid: string) => dispatch<any>(openSetupShellAccount(uuid))
+});
+
+type UserManageProps = UserManageDataProps & UserManageActionProps & WithStyles<CssRules>;
 
 export const UserManageDialog = compose(
+    connect(null, mapDispatchToProps),
     withDialog(USER_MANAGE_DIALOG),
     styles)(
         (props: WithDialogProps<UserManageProps> & UserManageProps) =>
@@ -46,7 +56,7 @@ export const UserManageDialog = compose(
                     <Typography variant="body2" className={props.classes.spacing}>
                         As an admin, you can setup a shell account for this user. The login name is automatically generated from the user's e-mail address.
                     </Typography>
-                    <Button variant="contained" color="primary">
+                    <Button variant="contained" color="primary" onClick={() => props.openSetupShellAccount(props.data.uuid)}>
                         {`SETUP SHELL ACCOUNT FOR ${props.data.firstName} ${props.data.lastName}`}
                     </Button>
                 </DialogContent>
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index b9c41bef..cba89b3b 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -80,6 +80,7 @@ import { UserAttributesDialog } from '~/views-components/user-dialog/attributes-
 import { CreateUserDialog } from '~/views-components/dialog-forms/create-user-dialog';
 import { HelpApiClientAuthorizationDialog } from '~/views-components/api-client-authorizations-dialog/help-dialog';
 import { UserManageDialog } from '~/views-components/user-dialog/manage-dialog';
+import { SetupShellAccountDialog } from '~/views-components/dialog-forms/setup-shell-account-dialog';
 
 type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
 
@@ -208,6 +209,7 @@ export const WorkbenchPanel =
             <RepositoryAttributesDialog />
             <RepositoriesSampleGitDialog />
             <RichTextEditorDialog />
+            <SetupShellAccountDialog />
             <SharingDialog />
             <Snackbar />
             <UpdateCollectionDialog />

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list