Merge branch 'master' into 14391-advanced-view-tags
[arvados-workbench2.git] / src / views-components / search-bar / search-bar-advanced-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">