1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
6 import { Field } from "redux-form";
7 import { TextField } from "~/components/text-field/text-field";
8 import { USER_EMAIL_VALIDATION, USER_LENGTH_VALIDATION } from "~/validators/validators";
9 import { NativeSelectField } from "~/components/select-field/select-field";
10 import { InputLabel } from "@material-ui/core";
11 import { VirtualMachinesResource } from "~/models/virtual-machines";
13 export const UserEmailField = () =>
17 validate={USER_EMAIL_VALIDATION}
21 export const UserVirtualMachineField = ({ data }: any) =>
22 <div style={{ marginBottom: '21px' }}>
23 <InputLabel>Virtual Machine</InputLabel>
26 component={NativeSelectField}
27 validate={USER_LENGTH_VALIDATION}
28 items={getVirtualMachinesList(data.items)} />
31 export const UserGroupsVirtualMachineField = () =>
35 validate={USER_LENGTH_VALIDATION}
36 label="Groups for virtual machine (comma separated list)" />;
38 const getVirtualMachinesList = (virtualMachines: VirtualMachinesResource[]) => {
39 const mappedVirtualMachines = virtualMachines.map(it => ({ key: it.hostname, value: it.hostname }));
40 return mappedVirtualMachines;