[ARVADOS-WORKBENCH2] created: 1.3.0-343-g9f537cd4

Git user git at public.curoverse.com
Sat Jan 19 05:25:41 EST 2019


        at  9f537cd4ad19c5ae5cd8d1ab1f76581fed7a68c3 (commit)


commit 9f537cd4ad19c5ae5cd8d1ab1f76581fed7a68c3
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Sat Jan 19 11:25:15 2019 +0100

    fixed-search-in-trash-in-global-search
    
    Feature #14744
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts
index 54651247..741fac95 100644
--- a/src/store/search-bar/search-bar-actions.ts
+++ b/src/store/search-bar/search-bar-actions.ts
@@ -326,36 +326,38 @@ export const parseSearchQuery: (query: string) => ParseSearchQuery = (searchValu
     const properties = {};
 
     keywords.forEach(k => {
-        let p = searchValue.indexOf(k);
-        const key = k.substr(0, k.length - 1);
-
-        while (p >= 0) {
-            const l = searchValue.length;
-            keywordsCnt += 1;
-
-            let v = '';
-            let i = p + k.length;
-            while (i < l && searchValue[i] === ' ') {
-                ++i;
-            }
-            const vp = i;
-            while (i < l && searchValue[i] !== ' ') {
-                v += searchValue[i];
-                ++i;
-            }
+        if (k) {
+            let p = searchValue.indexOf(k);
+            const key = k.substr(0, k.length - 1);
+
+            while (p >= 0) {
+                const l = searchValue.length;
+                keywordsCnt += 1;
+
+                let v = '';
+                let i = p + k.length;
+                while (i < l && searchValue[i] === ' ') {
+                    ++i;
+                }
+                const vp = i;
+                while (i < l && searchValue[i] !== ' ') {
+                    v += searchValue[i];
+                    ++i;
+                }
 
-            if (hasKeywords(v)) {
-                searchValue = searchValue.substr(0, p) + searchValue.substr(vp);
-            } else {
-                if (v !== '') {
-                    if (!properties[key]) {
-                        properties[key] = [];
+                if (hasKeywords(v)) {
+                    searchValue = searchValue.substr(0, p) + searchValue.substr(vp);
+                } else {
+                    if (v !== '') {
+                        if (!properties[key]) {
+                            properties[key] = [];
+                        }
+                        properties[key].push(v);
                     }
-                    properties[key].push(v);
+                    searchValue = searchValue.substr(0, p) + searchValue.substr(i);
                 }
-                searchValue = searchValue.substr(0, p) + searchValue.substr(i);
+                p = searchValue.indexOf(k);
             }
-            p = searchValue.indexOf(k);
         }
     });
 
@@ -424,7 +426,9 @@ export const getFilters = (filterName: string, searchValue: string, sq: ParseSea
         filter
             .addILike(filterName, searchValue, GroupContentsResourcePrefix.COLLECTION)
             .addILike(filterName, searchValue, GroupContentsResourcePrefix.PROJECT)
-            .addILike(filterName, searchValue, GroupContentsResourcePrefix.PROCESS);
+            .addILike(filterName, searchValue, GroupContentsResourcePrefix.PROCESS)
+            .addEqual('is_trashed', false, GroupContentsResourcePrefix.COLLECTION)
+            .addEqual('is_trashed', false, GroupContentsResourcePrefix.PROJECT);
 
         if (isTrashed) {
             filter.addILike(filterName, searchValue, GroupContentsResourcePrefix.PROCESS);
@@ -438,7 +442,10 @@ export const getFilters = (filterName: string, searchValue: string, sq: ParseSea
             sq.values.forEach(v => {
                 filter
                     .addILike(filterName, v, GroupContentsResourcePrefix.COLLECTION)
-                    .addILike(filterName, v, GroupContentsResourcePrefix.PROJECT);
+                    .addILike(filterName, v, GroupContentsResourcePrefix.PROJECT)
+                    .addILike(filterName, v, GroupContentsResourcePrefix.PROCESS)
+                    .addEqual('is_trashed', false, GroupContentsResourcePrefix.COLLECTION)
+                    .addEqual('is_trashed', false, GroupContentsResourcePrefix.PROJECT);
 
                 if (isTrashed) {
                     filter.addILike(filterName, v, GroupContentsResourcePrefix.PROCESS);
@@ -447,8 +454,12 @@ export const getFilters = (filterName: string, searchValue: string, sq: ParseSea
         }
 
         if (isTrashed) {
-            filter.addEqual("is_trashed", true);
-            console.log(filter);
+            sq.values.forEach(v => {
+                filter.addEqual('is_trashed', true, GroupContentsResourcePrefix.COLLECTION)
+                    .addEqual('is_trashed', true, GroupContentsResourcePrefix.PROJECT)
+                    .addILike(filterName, v, GroupContentsResourcePrefix.COLLECTION)
+                    .addILike(filterName, searchValue, GroupContentsResourcePrefix.PROCESS);
+            });
         }
 
         const projectUuid = getSearchQueryFirstProp(sq, 'project');
@@ -475,9 +486,8 @@ export const getFilters = (filterName: string, searchValue: string, sq: ParseSea
         });
     }
 
-    return filter
-        .addEqual('groupClass', GroupClass.PROJECT, GroupContentsResourcePrefix.PROJECT)
-        .addIsA("uuid", buildUuidFilter(resourceKind))
+    return filter        
+    .addIsA("uuid", buildUuidFilter(resourceKind))
         .getFilters();
 };
 
diff --git a/src/store/search-results-panel/search-results-middleware-service.ts b/src/store/search-results-panel/search-results-middleware-service.ts
index 12efbb61..12578a2d 100644
--- a/src/store/search-results-panel/search-results-middleware-service.ts
+++ b/src/store/search-results-panel/search-results-middleware-service.ts
@@ -83,7 +83,8 @@ export const getParams = (dataExplorer: DataExplorer, searchValue: string, sq: P
     filters: joinFilters(
         getFilters('name', searchValue, sq),
         typeFilters(dataExplorer.columns)),
-    order: getOrder(dataExplorer)
+    order: getOrder(dataExplorer),
+    includeTrash: true
 });
 
 const getOrder = (dataExplorer: DataExplorer) => {

commit 7b572180303cb477013dc34053748cac8c828724
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Thu Jan 17 16:01:51 2019 +0100

    fixed-type-filter-in-search-results
    
    Feature #14744
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/store/search-bar/search-bar-actions.ts b/src/store/search-bar/search-bar-actions.ts
index 7d32e609..54651247 100644
--- a/src/store/search-bar/search-bar-actions.ts
+++ b/src/store/search-bar/search-bar-actions.ts
@@ -448,6 +448,7 @@ export const getFilters = (filterName: string, searchValue: string, sq: ParseSea
 
         if (isTrashed) {
             filter.addEqual("is_trashed", true);
+            console.log(filter);
         }
 
         const projectUuid = getSearchQueryFirstProp(sq, 'project');
diff --git a/src/store/search-results-panel/search-results-middleware-service.ts b/src/store/search-results-panel/search-results-middleware-service.ts
index de325222..12efbb61 100644
--- a/src/store/search-results-panel/search-results-middleware-service.ts
+++ b/src/store/search-results-panel/search-results-middleware-service.ts
@@ -4,7 +4,7 @@
 
 import { ServiceRepository } from '~/services/services';
 import { MiddlewareAPI, Dispatch } from 'redux';
-import { DataExplorerMiddlewareService, dataExplorerToListParams, listResultsToDataExplorerItemsMeta } from '~/store/data-explorer/data-explorer-middleware-service';
+import { DataExplorerMiddlewareService, dataExplorerToListParams, listResultsToDataExplorerItemsMeta, getDataExplorerColumnFilters } from '~/store/data-explorer/data-explorer-middleware-service';
 import { RootState } from '~/store/store';
 import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions';
 import { DataExplorer, getDataExplorer } from '~/store/data-explorer/data-explorer-reducer';
@@ -22,6 +22,10 @@ import {
     parseSearchQuery
 } from '~/store/search-bar/search-bar-actions';
 import { getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
+import { joinFilters } from '~/services/api/filter-builder';
+import { DataColumns } from '~/components/data-table/data-table';
+import { serializeResourceTypeFilters } from '~/store//resource-type-filters/resource-type-filters';
+import { ProjectPanelColumnNames } from '~/views/project-panel/project-panel';
 
 export class SearchResultsMiddlewareService extends DataExplorerMiddlewareService {
     constructor(private services: ServiceRepository, id: string) {
@@ -72,9 +76,13 @@ export class SearchResultsMiddlewareService extends DataExplorerMiddlewareServic
     }
 }
 
+const typeFilters = (columns: DataColumns<string>) => serializeResourceTypeFilters(getDataExplorerColumnFilters(columns, ProjectPanelColumnNames.TYPE));
+
 export const getParams = (dataExplorer: DataExplorer, searchValue: string, sq: ParseSearchQuery) => ({
     ...dataExplorerToListParams(dataExplorer),
-    filters: getFilters('name', searchValue, sq),
+    filters: joinFilters(
+        getFilters('name', searchValue, sq),
+        typeFilters(dataExplorer.columns)),
     order: getOrder(dataExplorer)
 });
 
diff --git a/src/store/trash-panel/trash-panel-middleware-service.ts b/src/store/trash-panel/trash-panel-middleware-service.ts
index 3708f073..b3f0805f 100644
--- a/src/store/trash-panel/trash-panel-middleware-service.ts
+++ b/src/store/trash-panel/trash-panel-middleware-service.ts
@@ -15,7 +15,6 @@ import { trashPanelActions } from "./trash-panel-action";
 import { Dispatch, MiddlewareAPI } from "redux";
 import { OrderBuilder, OrderDirection } from "~/services/api/order-builder";
 import { GroupContentsResourcePrefix } from "~/services/groups-service/groups-service";
-import { TrashPanelColumnNames, TrashPanelFilter } from "~/views/trash-panel/trash-panel";
 import { ProjectResource } from "~/models/project";
 import { ProjectPanelColumnNames } from "~/views/project-panel/project-panel";
 import { updateFavorites } from "~/store/favorites/favorites-actions";
@@ -25,7 +24,7 @@ import { progressIndicatorActions } from "~/store/progress-indicator/progress-in
 import { getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
 import { serializeResourceTypeFilters } from '~/store//resource-type-filters/resource-type-filters';
 import { getDataExplorerColumnFilters } from '~/store/data-explorer/data-explorer-middleware-service';
-import { joinFilters } from '../../services/api/filter-builder';
+import { joinFilters } from '~/services/api/filter-builder';
 
 export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
     constructor(private services: ServiceRepository, id: string) {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list