<Chip
label={this.renderChipValue(item)}
key={index}
- onDelete={() => onDelete ? onDelete(item, index) : undefined} />
+ onDelete={onDelete && !this.props.disabled ? (() => onDelete(item, index)) : undefined} />
);
}
label?: string;
autofocus?: boolean;
onlyPeople?: boolean;
+ disabled?: boolean;
onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
onFocus?: (event: React.FocusEvent<HTMLInputElement>) => void;
onChange={this.handleChange}
onCreate={this.handleCreate}
onSelect={this.handleSelect}
- onDelete={this.handleDelete}
+ onDelete={this.props.onDelete && !this.props.disabled ? this.handleDelete : undefined}
onFocus={this.props.onFocus}
onBlur={this.props.onBlur}
renderChipValue={this.renderChipValue}
- renderSuggestion={this.renderSuggestion} />
+ renderSuggestion={this.renderSuggestion}
+ disabled={this.props.disabled}/>
);
}
return <>
<ParticipantField
name={VIRTUAL_MACHINE_ADD_LOGIN_USER_FIELD}
- component={UserSelect}
+ component={props.data.updating ? ReadOnlyUserSelect : UserSelect}
excludedParticipants={props.data.excludedParticipants}
/>
<GroupArrayInput
</>;
}
-
interface UserFieldProps {
excludedParticipants: string[];
}
excludedParticipants={props.excludedParticipants}
onSelect={props.input.onChange}
onDelete={() => (props.input.onChange(''))} />;
+
+const ReadOnlyUserSelect = (props) =>
+ <ParticipantSelect
+ onlyPeople
+ label='User'
+ items={props.input.value ? [props.input.value] : []}
+ disabled={true} />;