add native select field, data text field and search bar model
[arvados-workbench2.git] / src / views-components / form-fields / search-bar-form-fields.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import * as React from "react";
6 import { Field } from 'redux-form';
7 import { TextField, DataTextField } from "~/components/text-field/text-field";
8 import { CheckboxField } from '~/components/checkbox-field/checkbox-field';
9 import { NativeSelectField } from '~/components/select-field/select-field';
10 import { ResourceKind } from '~/models/resource';
11 import { ClusterObjectType } from '~/models/search-bar';
12
13 export const SearchBarTypeField = () =>
14     <Field
15         name='type'
16         component={NativeSelectField}
17         items={[
18             { key: '', value: 'Any'},
19             { key: ResourceKind.COLLECTION, value: 'Collection'},
20             { key: ResourceKind.PROJECT, value: 'Project' },
21             { key: ResourceKind.PROCESS, value: 'Process' }
22         ]}/>;
23
24 export const SearchBarClusterField = () =>
25     <Field
26         name='cluster'
27         component={NativeSelectField}
28         items={[
29             { key: '', value: 'Any' },
30             { key: ClusterObjectType.INDIANAPOLIS, value: 'Indianapolis' },
31             { key: ClusterObjectType.KAISERAUGST, value: 'Kaiseraugst' },
32             { key: ClusterObjectType.PENZBERG, value: 'Penzberg' }
33         ]} />;
34
35 export const SearchBarProjectField = () => 
36     <div>Box</div>;
37
38 export const SearchBarTrashField = () => 
39     <Field
40         name='inTrash'
41         component={CheckboxField}
42         label="In trash" />;
43
44 export const SearchBarDataFromField = () => 
45     <Field
46         name='dateFrom'
47         component={DataTextField} />;
48
49 export const SearchBarDataToField = () =>
50     <Field
51         name='dateTo'
52         component={DataTextField} />;
53
54 export const SearchBarKeyField = () => 
55     <Field
56         name='key'
57         component={TextField}
58         label="Key" />;
59
60 export const SearchBarValueField = () => 
61     <Field
62         name='value'
63         component={TextField}
64         label="Value" />;
65
66 export const SearchBarSaveSearchField = () => 
67     <Field
68         name='saveQuery'
69         component={CheckboxField}
70         label="Save search query" />;
71
72 export const SearchBarQuerySearchField = () => 
73     <Field
74         name='searchQuery'
75         component={TextField}
76         label="Search query name" />;