merge checkbox
authorPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Thu, 11 Oct 2018 12:29:03 +0000 (14:29 +0200)
committerPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Thu, 11 Oct 2018 12:29:03 +0000 (14:29 +0200)
Feature #14308

Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk@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..48737ee
--- /dev/null
@@ -0,0 +1,28 @@
+// 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}
+                disabled={props.meta.submitting}
+                color="primary" />
+        }
+        label={props.label} 
+    />);
\ No newline at end of file
index a0765528290032ec963bd6ef9d6d3bbce320669d..c8f9768a8478b4eeae112a5147452fd4cf5f5f15 100644 (file)
@@ -26,8 +26,10 @@ export interface SearchBarAdvanceFormData {
     type?: GroupContentsResource;
     cluster?: string;
     project?: string;
+    inTrash: boolean;
     dataFrom: string;
     dataTo: string;
+    saveQuery: boolean;
     searchQuery: string;
 }
 
index b7f3978711590faec97dd54f12870815ff2a9555..210affcfdcf6db232177283554bf2eee98dd78c8 100644 (file)
@@ -3,9 +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 { Checkbox, FormControlLabel } from '@material-ui/core';
+import { CheckboxField } from '~/components/checkbox-field/checkbox-field';
 
 export const SearchBarTypeField = () =>
     <Field
@@ -26,14 +26,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 +56,9 @@ export const SearchBarValueField = () =>
         label="Value" />;
 
 export const SearchBarSaveSearchField = () => 
-    <FormControlLabel
-        control={
-            <Checkbox
-                checked={true}
-                value="true"
-                color="primary"
-            />
-        }
+    <Field
+        name='saveQuery'
+        component={CheckboxField}
         label="Save search query" />;
 
 export const SearchBarQuerySearchField = () =>