1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from "react";
6 import { Field, 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 { SearchBarAdvancedPropertiesView } from 'views-components/search-bar/search-bar-advanced-properties-view';
12 import { PropertyKeyField, } from 'views-components/resource-properties-form/property-key-field';
13 import { PropertyValueField } from 'views-components/resource-properties-form/property-value-field';
14 import { connect } from "react-redux";
15 import { RootState } from "store/store";
16 import { ProjectInput, ProjectCommandInputParameter } from 'views/run-process-panel/inputs/project-input';
18 export const SearchBarTypeField = () =>
21 component={NativeSelectField as any}
23 { key: '', value: 'Any' },
24 { key: ResourceKind.COLLECTION, value: 'Collection' },
25 { key: ResourceKind.PROJECT, value: 'Project' },
26 { key: ResourceKind.PROCESS, value: 'Process' }
30 interface SearchBarClusterFieldProps {
31 clusters: { key: string, value: string }[];
34 export const SearchBarClusterField = connect(
35 (state: RootState) => ({
36 clusters: [{ key: '', value: 'Any' }].concat(
38 .filter(s => s.loggedIn)
43 }))((props: SearchBarClusterFieldProps) => <Field
45 component={NativeSelectField as any}
46 items={props.clusters} />
49 export const SearchBarProjectField = () =>
50 <ProjectInput required={false} input={{
52 label: "Limit search to Project"
53 } as ProjectCommandInputParameter}
54 options={{ showOnlyOwned: false, showOnlyWritable: false }} />
56 export const SearchBarTrashField = () =>
59 component={CheckboxField}
62 export const SearchBarPastVersionsField = () =>
65 component={CheckboxField}
66 label="Past versions" />;
68 export const SearchBarDateFromField = () =>
71 component={DateTextField as any} />;
73 export const SearchBarDateToField = () =>
76 component={DateTextField as any} />;
78 export const SearchBarPropertiesField = () =>
81 component={SearchBarAdvancedPropertiesView as any} />;
83 export const SearchBarKeyField = () =>
84 <PropertyKeyField skipValidation={true} />;
86 export const SearchBarValueField = () =>
87 <PropertyValueField skipValidation={true} />;
89 export const SearchBarSaveSearchField = () =>
92 component={CheckboxField}
93 label="Save query" />;
95 export const SearchBarQuerySearchField = () =>
98 component={TextField as any}
99 label="Query name" />;