Fix trash panel access
[arvados-workbench2.git] / src / views-components / form-fields / search-bar-form-fields.tsx
index 85abbe19f3f266769bb70b9f1da0e03d847399f1..6fb234980039ce38285a9d30c2f9ef2bb38e750c 100644 (file)
@@ -18,6 +18,8 @@ import { PropertyKeyInput } from '~/views-components/resource-properties-form/pr
 import { PropertyValueInput, PropertyValueFieldProps } from '~/views-components/resource-properties-form/property-value-field';
 import { VocabularyProp, connectVocabulary } from '~/views-components/resource-properties-form/property-field-common';
 import { compose } from 'redux';
+import { connect } from "react-redux";
+import { RootState } from "~/store/store";
 
 export const SearchBarTypeField = () =>
     <Field
@@ -30,16 +32,22 @@ export const SearchBarTypeField = () =>
             { key: ResourceKind.PROCESS, value: 'Process' }
         ]} />;
 
-export const SearchBarClusterField = () =>
-    <Field
+
+interface SearchBarClusterFieldProps {
+    clusters: { key: string, value: string }[];
+}
+
+export const SearchBarClusterField = connect(
+    (state: RootState) => ({
+        clusters: [{key: '', value: 'Any'}].concat(state.auth.sessions.map(s => ({
+            key: s.clusterId,
+            value: s.clusterId
+        })))
+    }))((props: SearchBarClusterFieldProps) => <Field
         name='cluster'
         component={NativeSelectField}
-        items={[
-            { key: '', value: 'Any' },
-            { key: ClusterObjectType.INDIANAPOLIS, value: 'Indianapolis' },
-            { key: ClusterObjectType.KAISERAUGST, value: 'Kaiseraugst' },
-            { key: ClusterObjectType.PENZBERG, value: 'Penzberg' }
-        ]} />;
+        items={props.clusters}/>
+    );
 
 export const SearchBarProjectField = () =>
     <Field