add checkbox field component and change advance form
authorJanicki Artur <artur.janicki@contractors.roche.com>
Thu, 11 Oct 2018 12:11:13 +0000 (14:11 +0200)
committerJanicki Artur <artur.janicki@contractors.roche.com>
Thu, 11 Oct 2018 12:11:13 +0000 (14:11 +0200)
Feature #13827

Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki@contractors.roche.com>

src/components/checkbox-field/checkbox-field.tsx [new file with mode: 0644]
src/store/search-bar/search-bar-actions.ts
src/views-components/form-fields/search-bar-form-fields.tsx

diff --git a/src/components/checkbox-field/checkbox-field.tsx b/src/components/checkbox-field/checkbox-field.tsx
new file mode 100644 (file)
index 0000000..b8f18e7
--- /dev/null
@@ -0,0 +1,27 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { WrappedFieldProps } from 'redux-form';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { FormControlLabel, Checkbox, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
+
+type CssRules = 'checkboxField';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    checkboxField: {
+        
+    }
+});
+
+export const CheckboxField = withStyles(styles)((props: WrappedFieldProps & WithStyles<CssRules> & { label?: string }) =>
+    <FormControlLabel
+        control={
+            <Checkbox
+                checked={props.input.value}
+                onChange={props.input.onChange}
+                color="primary" />
+        }
+        label={props.label} 
+    />);
\ No newline at end of file
index dbc77a84e942ccb18028ac8296acdc934a88b543..7a13197a0e1f3f3a26c3e81ba606eed55fc5a32a 100644 (file)
@@ -25,8 +25,10 @@ export interface SearchBarAdvanceFormData {
     type?: GroupContentsResource;
     cluster?: string;
     project?: string;
+    inTrash: boolean;
     dataFrom: string;
     dataTo: string;
+    saveQuery: boolean;
     searchQuery: string;
 }
 
index 269113218c2bf7434dc5058bd9f37839cecd35a1..8d058ec3e201b73a82fbf1532d7f657e30f79941 100644 (file)
@@ -3,8 +3,9 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { Field } from "redux-form";
+import { Field } from 'redux-form';
 import { TextField } from "~/components/text-field/text-field";
+import { CheckboxField } from '~/components/checkbox-field/checkbox-field';
 import { Checkbox, FormControlLabel } from '@material-ui/core';
 
 export const SearchBarTypeField = () =>
@@ -26,14 +27,9 @@ export const SearchBarProjectField = () =>
         label="Project name" />;
 
 export const SearchBarTrashField = () => 
-    <FormControlLabel
-        control={
-            <Checkbox
-                checked={false}
-                value="true"
-                color="primary"
-            />
-        }
+    <Field
+        name='inTrash'
+        component={CheckboxField}
         label="In trash" />;
 
 export const SearchBarDataFromField = () => 
@@ -61,14 +57,9 @@ export const SearchBarValueField = () =>
         label="Value" />;
 
 export const SearchBarSaveSearchField = () => 
-    <FormControlLabel
-        control={
-            <Checkbox
-                checked={false}
-                value="true"
-                color="primary"
-            />
-        }
+    <Field
+        name='saveQuery'
+        component={CheckboxField}
         label="Save search query" />;
 
 export const SearchBarQuerySearchField = () =>