X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/85836abe716b2403f3b7fe75c551e4ace3995157..b178ea37c7a247a6399ecf1112d5f8c8aae12136:/src/views-components/virtual-machines-dialog/add-login-dialog.tsx

diff --git a/src/views-components/virtual-machines-dialog/add-login-dialog.tsx b/src/views-components/virtual-machines-dialog/add-login-dialog.tsx
index 8d543406..bfc04716 100644
--- a/src/views-components/virtual-machines-dialog/add-login-dialog.tsx
+++ b/src/views-components/virtual-machines-dialog/add-login-dialog.tsx
@@ -7,7 +7,7 @@ import { compose } from "redux";
 import { reduxForm, InjectedFormProps, WrappedFieldProps, Field } from 'redux-form';
 import { withDialog, WithDialogProps } from "store/dialog/with-dialog";
 import { FormDialog } from 'components/form-dialog/form-dialog';
-import { VIRTUAL_MACHINE_ADD_LOGIN_DIALOG, VIRTUAL_MACHINE_ADD_LOGIN_FORM, addVirtualMachineLogin, AddLoginFormData, VIRTUAL_MACHINE_ADD_LOGIN_USER_FIELD, VIRTUAL_MACHINE_ADD_LOGIN_GROUPS_FIELD } from 'store/virtual-machines/virtual-machines-actions';
+import { VIRTUAL_MACHINE_ADD_LOGIN_DIALOG, VIRTUAL_MACHINE_ADD_LOGIN_FORM, addUpdateVirtualMachineLogin, AddLoginFormData, VIRTUAL_MACHINE_ADD_LOGIN_USER_FIELD, VIRTUAL_MACHINE_ADD_LOGIN_GROUPS_FIELD } from 'store/virtual-machines/virtual-machines-actions';
 import { ParticipantSelect } from 'views-components/sharing-dialog/participant-select';
 import { GroupArrayInput } from 'views-components/virtual-machines-dialog/group-array-input';
 
@@ -16,27 +16,27 @@ export const VirtualMachineAddLoginDialog = compose(
     reduxForm<AddLoginFormData>({
         form: VIRTUAL_MACHINE_ADD_LOGIN_FORM,
         onSubmit: (data, dispatch) => {
-            dispatch(addVirtualMachineLogin(data));
+            dispatch(addUpdateVirtualMachineLogin(data));
         }
     })
 )(
     (props: CreateGroupDialogComponentProps) =>
         <FormDialog
-            dialogTitle='Add login permissions'
+            dialogTitle={props.data.updating ? "Update login permission" : "Add login permission"}
             formFields={AddLoginFormFields}
-            submitLabel='Add'
+            submitLabel={props.data.updating ? "Update" : "Add"}
             {...props}
         />
 );
 
-type CreateGroupDialogComponentProps = WithDialogProps<{}> & InjectedFormProps<AddLoginFormData>;
+type CreateGroupDialogComponentProps = WithDialogProps<{updating: boolean}> & InjectedFormProps<AddLoginFormData>;
 
 const AddLoginFormFields = () =>
     <>
         <UserField />
         <GroupArrayInput
             name={VIRTUAL_MACHINE_ADD_LOGIN_GROUPS_FIELD}
-            input={{id:"Add groups to VM login", disabled:false}}
+            input={{id:"Add groups to VM login (eg: docker, sudo)", disabled:false}}
             required={false}
         />
     </>;
@@ -50,7 +50,7 @@ const UserField = () =>
 const UserSelect = ({ input, meta }: WrappedFieldProps) =>
     <ParticipantSelect
         onlyPeople
-        label='Search for users to grant login permission'
+        label='Search for user to grant login permission'
         items={input.value ? [input.value] : []}
         onSelect={input.onChange}
         onDelete={() => (input.onChange(''))} />;
