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 UserIdentityUrlField = () =>
25 validate={USER_LENGTH_VALIDATION}
26 label="Identity URL Prefix" />;
28 export const UserVirtualMachineField = ({ data }: any) =>
29 <div style={{ marginBottom: '21px' }}>
30 <InputLabel>Virtual Machine</InputLabel>
33 component={NativeSelectField}
34 validate={USER_LENGTH_VALIDATION}
35 items={getVirtualMachinesList(data.items)} />
38 export const UserGroupsVirtualMachineField = () =>
42 validate={USER_LENGTH_VALIDATION}
43 label="Groups for virtual machine (comma separated list)" />;
45 const getVirtualMachinesList = (virtualMachines: VirtualMachinesResource[]) => {
46 const mappedVirtualMachines = virtualMachines.map(it => ({ key: it.hostname, value: it.hostname }));
47 return mappedVirtualMachines;