[ARVADOS-WORKBENCH2] updated: 1.2.0-954-g78b19f1

Git user git at public.curoverse.com
Tue Nov 27 09:23:03 EST 2018


Summary of changes:
 src/store/search-bar/search-bar-actions.test.ts          | 16 ++++++++--------
 src/store/search-bar/search-bar-actions.ts               | 14 +++++++++++---
 .../search-bar/search-bar-advanced-view.tsx              |  9 ++++++---
 src/views-components/search-bar/search-bar-view.tsx      |  3 ++-
 src/views-components/search-bar/search-bar.tsx           |  5 ++++-
 5 files changed, 31 insertions(+), 16 deletions(-)

       via  78b19f14709d84ba099f36a6b11b4fd64912e039 (commit)
      from  2340918b3b75be5e9c60ced6136265216eac2d74 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 78b19f14709d84ba099f36a6b11b4fd64912e039
Author: Daniel Kos <daniel.kos at contractors.roche.com>
Date:   Tue Nov 27 15:22:58 2018 +0100

    Add query name showing on save query checked only
    
    Feature #14280
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos at contractors.roche.com>

diff --git a/src/store/search-bar/search-bar-actions.test.ts b/src/store/search-bar/search-bar-actions.test.ts
index d936caf..aa6e475 100644
--- a/src/store/search-bar/search-bar-actions.test.ts
+++ b/src/store/search-bar/search-bar-actions.test.ts
@@ -2,15 +2,15 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { getAdvancedDataFromQuery, getQueryFromAdvancedData, parseQuery } from "~/store/search-bar/search-bar-actions";
+import { getAdvancedDataFromQuery, getQueryFromAdvancedData, parseSearchQuery } from "~/store/search-bar/search-bar-actions";
 import { ResourceKind } from "~/models/resource";
 import { ClusterObjectType } from "~/models/search-bar";
 
 describe('search-bar-actions', () => {
-    describe('parseQuery', () => {
+    describe('parseSearchQuery', () => {
         it('should correctly parse query #1', () => {
             const q = 'val0 is:trashed val1';
-            const r = parseQuery(q);
+            const r = parseSearchQuery(q);
             expect(r.hasKeywords).toBeTruthy();
             expect(r.values).toEqual(['val0', 'val1']);
             expect(r.properties).toEqual({
@@ -20,7 +20,7 @@ describe('search-bar-actions', () => {
 
         it('should correctly parse query #2 (value with keyword should be ignored)', () => {
             const q = 'val0 is:from:trashed val1';
-            const r = parseQuery(q);
+            const r = parseSearchQuery(q);
             expect(r.hasKeywords).toBeTruthy();
             expect(r.values).toEqual(['val0', 'val1']);
             expect(r.properties).toEqual({
@@ -30,7 +30,7 @@ describe('search-bar-actions', () => {
 
         it('should correctly parse query #3 (many keywords)', () => {
             const q = 'val0 is:trashed val2 from:2017-04-01 val1';
-            const r = parseQuery(q);
+            const r = parseSearchQuery(q);
             expect(r.hasKeywords).toBeTruthy();
             expect(r.values).toEqual(['val0', 'val2', 'val1']);
             expect(r.properties).toEqual({
@@ -41,7 +41,7 @@ describe('search-bar-actions', () => {
 
         it('should correctly parse query #4 (no duplicated values)', () => {
             const q = 'val0 is:trashed val2 val2 val0';
-            const r = parseQuery(q);
+            const r = parseSearchQuery(q);
             expect(r.hasKeywords).toBeTruthy();
             expect(r.values).toEqual(['val0', 'val2']);
             expect(r.properties).toEqual({
@@ -51,7 +51,7 @@ describe('search-bar-actions', () => {
 
         it('should correctly parse query #5 (properties)', () => {
             const q = 'val0 has:filesize:100mb val2 val2 val0';
-            const r = parseQuery(q);
+            const r = parseSearchQuery(q);
             expect(r.hasKeywords).toBeTruthy();
             expect(r.values).toEqual(['val0', 'val2']);
             expect(r.properties).toEqual({
@@ -61,7 +61,7 @@ describe('search-bar-actions', () => {
 
         it('should correctly parse query #6 (multiple properties, multiple is)', () => {
             const q = 'val0 has:filesize:100mb val2 has:user:daniel is:starred val2 val0 is:trashed';
-            const r = parseQuery(q);
+            const r = parseSearchQuery(q);
             expect(r.hasKeywords).toBeTruthy();
             expect(r.values).toEqual(['val0', 'val2']);
             expect(r.properties).toEqual({
diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts
index 2bac245..a2eed93 100644
--- a/src/store/search-bar/search-bar-actions.ts
+++ b/src/store/search-bar/search-bar-actions.ts
@@ -285,7 +285,15 @@ export const getQueryFromAdvancedData = (data: SearchBarAdvanceFormData, prevDat
     return value;
 };
 
-export const parseQuery: (query: string) => { hasKeywords: boolean; values: string[]; properties: any } = (searchValue: string) => {
+export interface ParsedSearchQuery {
+    hasKeywords: boolean;
+    values: string[];
+    properties: {
+        [key: string]: string
+    };
+}
+
+export const parseSearchQuery: (query: string) => { hasKeywords: boolean; values: string[]; properties: any } = (searchValue: string): ParsedSearchQuery => {
     const keywords = [
         'type:',
         'cluster:',
@@ -341,7 +349,7 @@ export const parseQuery: (query: string) => { hasKeywords: boolean; values: stri
 };
 
 export const getAdvancedDataFromQuery = (query: string): SearchBarAdvanceFormData => {
-    const r = parseQuery(query);
+    const r = parseSearchQuery(query);
 
     const getFirstProp = (name: string) => r.properties[name] && r.properties[name][0];
     const getPropValue = (name: string, value: string) => r.properties[name] && r.properties[name].find((v: string) => v === value);
@@ -375,7 +383,7 @@ export const getAdvancedDataFromQuery = (query: string): SearchBarAdvanceFormDat
 export const getFilters = (filterName: string, searchValue: string): string => {
     const filter = new FilterBuilder();
 
-    const pq = parseQuery(searchValue);
+    const pq = parseSearchQuery(searchValue);
 
     if (!pq.hasKeywords) {
         filter
diff --git a/src/views-components/search-bar/search-bar-advanced-view.tsx b/src/views-components/search-bar/search-bar-advanced-view.tsx
index f620f45..f0dffa5 100644
--- a/src/views-components/search-bar/search-bar-advanced-view.tsx
+++ b/src/views-components/search-bar/search-bar-advanced-view.tsx
@@ -7,7 +7,7 @@ import { reduxForm, InjectedFormProps, reset } from 'redux-form';
 import { compose, Dispatch } from 'redux';
 import { Paper, StyleRulesCallback, withStyles, WithStyles, Button, Grid, IconButton, CircularProgress } from '@material-ui/core';
 import {
-    SEARCH_BAR_ADVANCE_FORM_NAME,
+    SEARCH_BAR_ADVANCE_FORM_NAME, SEARCH_BAR_ADVANCE_FORM_PICKER_ID,
     searchAdvanceData,
     setSearchValueFromAdvancedData
 } from '~/store/search-bar/search-bar-actions';
@@ -19,6 +19,7 @@ import {
     SearchBarDateFromField, SearchBarDateToField, SearchBarPropertiesField,
     SearchBarSaveSearchField, SearchBarQuerySearchField
 } from '~/views-components/form-fields/search-bar-form-fields';
+import { treePickerActions } from "~/store/tree-picker/tree-picker-actions";
 
 type CssRules = 'container' | 'closeIcon' | 'label' | 'buttonWrapper'
     | 'button' | 'circularProgress' | 'searchView' | 'selectGrid';
@@ -73,6 +74,7 @@ interface SearchBarAdvancedViewFormDataProps {
 // ToDo: maybe we should remove tags
 export interface SearchBarAdvancedViewDataProps {
     tags: any;
+    saveQuery: boolean;
 }
 
 export interface SearchBarAdvancedViewActionProps {
@@ -103,13 +105,14 @@ export const SearchBarAdvancedView = compose(
         onSubmit: (data: SearchBarAdvanceFormData, dispatch: Dispatch) => {
             dispatch<any>(searchAdvanceData(data));
             dispatch(reset(SEARCH_BAR_ADVANCE_FORM_NAME));
+            dispatch(treePickerActions.ACTIVATE_TREE_PICKER_NODE({ pickerId: SEARCH_BAR_ADVANCE_FORM_PICKER_ID, id: "" }));
         },
         onChange: (data: SearchBarAdvanceFormData, dispatch: Dispatch, props: any, prevData: SearchBarAdvanceFormData) => {
             dispatch<any>(setSearchValueFromAdvancedData(data, prevData));
         }
     }),
     withStyles(styles))(
-        ({ classes, closeAdvanceView, handleSubmit, submitting, invalid, pristine, tags }: SearchBarAdvancedViewFormProps) =>
+        ({ classes, closeAdvanceView, handleSubmit, submitting, invalid, pristine, tags, saveQuery }: SearchBarAdvancedViewFormProps) =>
             <Paper className={classes.searchView}>
                 <form onSubmit={handleSubmit}>
                     <Grid container direction="column" justify="flex-start" alignItems="flex-start">
@@ -159,7 +162,7 @@ export const SearchBarAdvancedView = compose(
                                     <SearchBarSaveSearchField />
                                 </Grid>
                                 <Grid item xs={4}>
-                                    <SearchBarQuerySearchField />
+                                    {saveQuery && <SearchBarQuerySearchField />}
                                 </Grid>
                             </Grid>
                             <Grid container item xs={12} justify='flex-end'>
diff --git a/src/views-components/search-bar/search-bar-view.tsx b/src/views-components/search-bar/search-bar-view.tsx
index beaad49..51ea3fa 100644
--- a/src/views-components/search-bar/search-bar-view.tsx
+++ b/src/views-components/search-bar/search-bar-view.tsx
@@ -198,7 +198,8 @@ const getView = (props: SearchBarViewProps) => {
         case SearchView.ADVANCED:
             return <SearchBarAdvancedView
                 closeAdvanceView={props.closeAdvanceView}
-                tags={props.tags} />;
+                tags={props.tags}
+                saveQuery={props.saveQuery} />;
         default:
             return <SearchBarBasicView
                 onSetView={props.onSetView}
diff --git a/src/views-components/search-bar/search-bar.tsx b/src/views-components/search-bar/search-bar.tsx
index 3107ad7..41cf291 100644
--- a/src/views-components/search-bar/search-bar.tsx
+++ b/src/views-components/search-bar/search-bar.tsx
@@ -29,7 +29,10 @@ const mapStateToProps = ({ searchBar, form }: RootState): SearchBarDataProps =>
         searchResults: searchBar.searchResults,
         selectedItem: searchBar.selectedItem,
         savedQueries: searchBar.savedQueries,
-        tags: form.searchBarAdvanceFormName
+        tags: form.searchBarAdvanceFormName,
+        saveQuery: form.searchBarAdvanceFormName &&
+            form.searchBarAdvanceFormName.values &&
+            form.searchBarAdvanceFormName.values.saveQuery
     };
 };
 

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list