[ARVADOS-WORKBENCH2] created: 1.4.1-224-gba4eb6e9

Git user git at public.arvados.org
Tue Jan 21 15:36:14 UTC 2020


        at  ba4eb6e921464fabcb9cdf47f23745f3001c25f3 (commit)


commit ba4eb6e921464fabcb9cdf47f23745f3001c25f3
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Sat Dec 21 17:15:49 2019 -0300

    15019: Adds Status filtering to project panel.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts
index d4b2416e..b889f7cb 100644
--- a/src/store/project-panel/project-panel-middleware-service.ts
+++ b/src/store/project-panel/project-panel-middleware-service.ts
@@ -29,7 +29,7 @@ import { ListResults } from '~/services/common-service/common-service';
 import { loadContainers } from '~/store/processes/processes-actions';
 import { ResourceKind } from '~/models/resource';
 import { getSortColumn } from "~/store/data-explorer/data-explorer-reducer";
-import { serializeResourceTypeFilters } from '~/store/resource-type-filters/resource-type-filters';
+import { serializeResourceTypeFilters, ProcessStatusFilter } from '~/store/resource-type-filters/resource-type-filters';
 import { updatePublicFavorites } from '~/store/public-favorites/public-favorites-actions';
 
 export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService {
@@ -103,6 +103,10 @@ export const getParams = (dataExplorer: DataExplorer, isProjectTrashed: boolean)
 export const getFilters = (dataExplorer: DataExplorer) => {
     const columns = dataExplorer.columns as DataColumns<string>;
     const typeFilters = serializeResourceTypeFilters(getDataExplorerColumnFilters(columns, ProjectPanelColumnNames.TYPE));
+    const statusColumnFilters = getDataExplorerColumnFilters(columns, 'Status');
+    const activeStatusFilter = Object.keys(statusColumnFilters).find(
+        filterName => statusColumnFilters[filterName].selected
+    );
 
     // TODO: Extract group contents name filter
     const nameFilters = new FilterBuilder()
@@ -111,12 +115,35 @@ export const getFilters = (dataExplorer: DataExplorer) => {
         .addILike("name", dataExplorer.searchValue, GroupContentsResourcePrefix.PROJECT)
         .getFilters();
 
+    // Filter by container status
+    const fb = new FilterBuilder();
+    switch (activeStatusFilter) {
+        case ProcessStatusFilter.COMPLETED: {
+            fb.addEqual('container.state', 'Complete', GroupContentsResourcePrefix.PROCESS);
+            fb.addEqual('container.exit_code', '0', GroupContentsResourcePrefix.PROCESS);
+            break;
+        }
+        case ProcessStatusFilter.FAILED: {
+            fb.addEqual('container.state', 'Complete', GroupContentsResourcePrefix.PROCESS);
+            fb.addDistinct('container.exit_code', '0', GroupContentsResourcePrefix.PROCESS);
+            break;
+        }
+        case ProcessStatusFilter.CANCELLED:
+        case ProcessStatusFilter.FAILED:
+        case ProcessStatusFilter.LOCKED:
+        case ProcessStatusFilter.QUEUED:
+        case ProcessStatusFilter.RUNNING: {
+            fb.addEqual('container.state', activeStatusFilter, GroupContentsResourcePrefix.PROCESS);
+            break;
+        }
+    }
+    const statusFilters = fb.getFilters();
+
     return joinFilters(
+        statusFilters,
         typeFilters,
         nameFilters,
     );
-    // TODO: Restore process status filters
-    // const statusFilters = getDataExplorerColumnFilters(columns, ProjectPanelColumnNames.STATUS);
 };
 
 export const getOrder = (dataExplorer: DataExplorer) => {
diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index df8f22e7..1e26bc0d 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -28,7 +28,7 @@ import { PROJECT_PANEL_CURRENT_UUID } from '~/store/project-panel/project-panel-
 import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
 import { ArvadosTheme } from "~/common/custom-theme";
 import { createTree } from '~/models/tree';
-import { getInitialResourceTypeFilters } from '~/store/resource-type-filters/resource-type-filters';
+import { getInitialResourceTypeFilters, getInitialProcessStatusFilters } from '~/store/resource-type-filters/resource-type-filters';
 
 type CssRules = 'root' | "button";
 
@@ -69,7 +69,8 @@ export const projectPanelColumns: DataColumns<string> = [
         name: "Status",
         selected: true,
         configurable: true,
-        filters: createTree(),
+        mutuallyExclusiveFilters: true,
+        filters: getInitialProcessStatusFilters(),
         render: uuid => <ProcessStatus uuid={uuid} />,
     },
     {

commit 73e01d6f406e80786ce0f1ddb2e06a02969ff3c0
Author: Lucas Di Pentima <lucas at di-pentima.com.ar>
Date:   Sat Dec 21 17:13:07 2019 -0300

    15019: Changes joinFilters() to accept variable number of args.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at di-pentima.com.ar>

diff --git a/src/services/api/filter-builder.ts b/src/services/api/filter-builder.ts
index aa0f011b..102ff62c 100644
--- a/src/services/api/filter-builder.ts
+++ b/src/services/api/filter-builder.ts
@@ -2,8 +2,8 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-export function joinFilters(filters0?: string, filters1?: string) {
-    return [filters0, filters1].filter(s => s).join(",");
+export function joinFilters(...filters: string[]) {
+    return filters.filter(s => s).join(",");
 }
 
 export class FilterBuilder {
diff --git a/src/services/favorite-service/favorite-service.ts b/src/services/favorite-service/favorite-service.ts
index 8b504c86..90849c8b 100644
--- a/src/services/favorite-service/favorite-service.ts
+++ b/src/services/favorite-service/favorite-service.ts
@@ -53,7 +53,7 @@ export class FavoriteService {
 
         return this.linkService
             .list({
-                filters: joinFilters(filters, listFilters),
+                filters: joinFilters(filters || '', listFilters),
                 limit,
                 offset,
                 order: linkOrder
diff --git a/src/services/project-service/project-service.ts b/src/services/project-service/project-service.ts
index eec5a940..4ae91d4d 100644
--- a/src/services/project-service/project-service.ts
+++ b/src/services/project-service/project-service.ts
@@ -18,7 +18,7 @@ export class ProjectService extends GroupsService<ProjectResource> {
         return super.list({
             ...args,
             filters: joinFilters(
-                args.filters,
+                args.filters || '',
                 new FilterBuilder()
                     .addEqual("group_class", GroupClass.PROJECT)
                     .getFilters()

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list