X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/93926d5be6b62da8d8bedea1c9c3a63fd4e71b31..c2291072ba2e0aa545b1b3f2075bead431fd65b7:/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 d9547d7c60..1654452bf4 100644
--- a/src/views-components/virtual-machines-dialog/add-login-dialog.tsx
+++ b/src/views-components/virtual-machines-dialog/add-login-dialog.tsx
@@ -4,7 +4,7 @@
 
 import React from 'react';
 import { compose } from "redux";
-import { reduxForm, InjectedFormProps, WrappedFieldProps, Field, GenericField } from 'redux-form';
+import { reduxForm, InjectedFormProps, Field, GenericField } 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, addUpdateVirtualMachineLogin, AddLoginFormData, VIRTUAL_MACHINE_ADD_LOGIN_USER_FIELD, VIRTUAL_MACHINE_ADD_LOGIN_GROUPS_FIELD } from 'store/virtual-machines/virtual-machines-actions';
@@ -35,7 +35,7 @@ const AddLoginFormFields = (props) => {
     return <>
         <ParticipantField
             name={VIRTUAL_MACHINE_ADD_LOGIN_USER_FIELD}
-            component={UserSelect}
+            component={props.data.updating ? ReadOnlyUserSelect : UserSelect}
             excludedParticipants={props.data.excludedParticipants}
         />
         <GroupArrayInput
@@ -46,7 +46,6 @@ const AddLoginFormFields = (props) => {
     </>;
 }
 
-
 interface UserFieldProps {
     excludedParticipants: string[];
 }
@@ -56,8 +55,17 @@ const ParticipantField = Field as new () => GenericField<UserFieldProps>;
 const UserSelect = (props) =>
     <ParticipantSelect
         onlyPeople
+        onlyActive
         label='Search for user to grant login permission'
         items={props.input.value ? [props.input.value] : []}
         excludedParticipants={props.excludedParticipants}
         onSelect={props.input.onChange}
         onDelete={() => (props.input.onChange(''))} />;
+
+const ReadOnlyUserSelect = (props) =>
+        <ParticipantSelect
+            onlyPeople
+            onlyActive
+            label='User'
+            items={props.input.value ? [props.input.value] : []}
+            disabled={true} />;
