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, WrappedFieldProps, FieldArray } from 'redux-form';
7 import { TextField, DateTextField } 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 import { HomeTreePicker } from '~/views-components/projects-tree-picker/home-tree-picker';
13 import { SEARCH_BAR_ADVANCE_FORM_PICKER_ID } from '~/store/search-bar/search-bar-actions';
14 import { SearchBarAdvancedPropertiesView } from '~/views-components/search-bar/search-bar-advanced-properties-view';
15 import { TreeItem } from "~/components/tree/tree";
16 import { ProjectsTreePickerItem } from "~/views-components/projects-tree-picker/generic-projects-tree-picker";
18 export const SearchBarTypeField = () =>
21 component={NativeSelectField}
23 { key: '', value: 'Any' },
24 { key: ResourceKind.COLLECTION, value: 'Collection' },
25 { key: ResourceKind.PROJECT, value: 'Project' },
26 { key: ResourceKind.PROCESS, value: 'Process' }
29 export const SearchBarClusterField = () =>
32 component={NativeSelectField}
34 { key: '', value: 'Any' },
35 { key: ClusterObjectType.INDIANAPOLIS, value: 'Indianapolis' },
36 { key: ClusterObjectType.KAISERAUGST, value: 'Kaiseraugst' },
37 { key: ClusterObjectType.PENZBERG, value: 'Penzberg' }
40 export const SearchBarProjectField = () =>
43 component={ProjectsPicker} />;
45 const ProjectsPicker = (props: WrappedFieldProps) =>
46 <div style={{ height: '100px', display: 'flex', flexDirection: 'column', overflow: 'overlay' }}>
48 pickerId={SEARCH_BAR_ADVANCE_FORM_PICKER_ID}
50 (_: any, { id }: TreeItem<ProjectsTreePickerItem>) => {
51 props.input.onChange(id);
56 export const SearchBarTrashField = () =>
59 component={CheckboxField}
62 export const SearchBarDateFromField = () =>
65 component={DateTextField} />;
67 export const SearchBarDateToField = () =>
70 component={DateTextField} />;
72 export const SearchBarPropertiesField = () =>
75 component={SearchBarAdvancedPropertiesView} />;
77 export const SearchBarKeyField = () =>
83 export const SearchBarValueField = () =>
89 export const SearchBarSaveSearchField = () =>
92 component={CheckboxField}
93 label="Save query" />;
95 export const SearchBarQuerySearchField = () =>
99 label="Query name" />;