fixed tags
authorPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 23 Oct 2018 13:28:22 +0000 (15:28 +0200)
committerPawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>
Tue, 23 Oct 2018 13:28:22 +0000 (15:28 +0200)
Feature #14391

Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk@contractors.roche.com>

src/views-components/search-bar/search-bar-advanced-view.tsx
src/views-components/search-bar/search-bar-view.tsx

index bfa1e6aa3c0b8f1092a07c4eca1014473eecba12..c658c33bbca3f6c63856cc6e74ab2083e3dd982f 100644 (file)
@@ -66,18 +66,10 @@ interface SearchBarAdvancedViewDataProps {
     pristine: boolean;
 }
 
-export interface Tags {
-    values?: {
-        properties?: { key: string, value: string },
-        value?: string;
-        key?: string;
-    };
-}
-
 interface SearchBarAdvancedViewActionProps {
     setView: (currentView: string) => void;
     saveQuery: (data: SearchBarAdvanceFormData) => void;
-    tags: Tags;
+    tags: any;
 }
 
 type SearchBarAdvancedViewProps = SearchBarAdvancedViewActionProps & SearchBarAdvancedViewDataProps
@@ -161,7 +153,8 @@ export const SearchBarAdvancedView = compose(
                             <Grid container item xs={12} justify='flex-end'>
                                 <div className={classes.buttonWrapper}>
                                     <Button type="submit" className={classes.button}
-                                        disabled={invalid || submitting || pristine || !!((tags.values!.key || tags.values!.value) && !tags.values!.properties)}
+                                    // ToDo: create easier condition
+                                        disabled={invalid || submitting || pristine || !!(tags && tags.values && ((tags.values.key) || (tags.values.value)) && !Object.keys(tags.values).find(el => el !== 'value' && el !== 'key'))}
                                         color="primary"
                                         size='small'
                                         variant="contained">
index b923530aaababc085f803e5a773f15a34c8919ae..68418ba190b6c41a04209e02c03244870238d67a 100644 (file)
@@ -18,7 +18,7 @@ import SearchIcon from '@material-ui/icons/Search';
 import { RemoveIcon, EditSavedQueryIcon } from '~/components/icon/icon';
 import { SearchView } from '~/store/search-bar/search-bar-reducer';
 import { SearchBarBasicView } from '~/views-components/search-bar/search-bar-basic-view';
-import { SearchBarAdvancedView, Tags } from '~/views-components/search-bar/search-bar-advanced-view';
+import { SearchBarAdvancedView } from '~/views-components/search-bar/search-bar-advanced-view';
 import { SearchBarAutocompleteView, SearchBarAutocompleteViewDataProps } from '~/views-components/search-bar/search-bar-autocomplete-view';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { SearchBarAdvanceFormData } from '~/models/search-bar';
@@ -54,7 +54,7 @@ type SearchBarDataProps = {
     currentView: string;
     isPopoverOpen: boolean;
     savedQueries: SearchBarAdvanceFormData[];
-    tags: Tags;
+    tags: any;
 } & SearchBarAutocompleteViewDataProps;
 
 interface SearchBarActionProps {