[ARVADOS-WORKBENCH2] updated: 1.1.4-196-gc282281

Git user git at public.curoverse.com
Wed Jul 4 10:01:06 EDT 2018


Summary of changes:
 src/store/navigation/navigation-action.ts          |  2 -
 .../project-panel/project-panel-middleware.ts      | 60 +++++++++++++++-------
 src/views/project-panel/project-panel-selectors.ts | 49 ------------------
 src/views/project-panel/project-panel.tsx          | 31 +++++++----
 4 files changed, 64 insertions(+), 78 deletions(-)
 delete mode 100644 src/views/project-panel/project-panel-selectors.ts

       via  c282281e22bd7a52dae2c72282a956f7a4ecae04 (commit)
       via  4dc31d8b4c4e4947fea1f7a69eb8eb06a3324dd0 (commit)
       via  3db295e22bbe57635eac43b21530a61c29de293a (commit)
       via  508746f3c7c6d7077f4290228c393e0e29d58573 (commit)
      from  ceba702623665c3948fe5372ecf57ba61dae4892 (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 c282281e22bd7a52dae2c72282a956f7a4ecae04
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Wed Jul 4 16:00:50 2018 +0200

    Remove unused project-panel-selectors module
    
    Feature #13703
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts
index ec6e9bb..5fb6b72 100644
--- a/src/store/navigation/navigation-action.ts
+++ b/src/store/navigation/navigation-action.ts
@@ -6,13 +6,11 @@ import { Dispatch } from "redux";
 import projectActions, { getProjectList } from "../project/project-action";
 import { push } from "react-router-redux";
 import { TreeItemStatus } from "../../components/tree/tree";
-import { getCollectionList } from "../collection/collection-action";
 import { findTreeItem } from "../project/project-reducer";
 import { Resource, ResourceKind } from "../../models/resource";
 import sidePanelActions from "../side-panel/side-panel-action";
 import dataExplorerActions from "../data-explorer/data-explorer-action";
 import { PROJECT_PANEL_ID } from "../../views/project-panel/project-panel";
-import { projectPanelItems } from "../../views/project-panel/project-panel-selectors";
 import { RootState } from "../store";
 import { sidePanelData } from "../side-panel/side-panel-reducer";
 
diff --git a/src/views/project-panel/project-panel-selectors.ts b/src/views/project-panel/project-panel-selectors.ts
deleted file mode 100644
index ee039a8..0000000
--- a/src/views/project-panel/project-panel-selectors.ts
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) The Arvados Authors. All rights reserved.
-//
-// SPDX-License-Identifier: AGPL-3.0
-
-import { TreeItem } from "../../components/tree/tree";
-import { Project } from "../../models/project";
-import { findTreeItem } from "../../store/project/project-reducer";
-import { ResourceKind } from "../../models/resource";
-import { Collection } from "../../models/collection";
-import { getResourceUrl } from "../../store/navigation/navigation-action";
-import { ProjectPanelItem } from "./project-panel-item";
-
-export const projectPanelItems = (projects: Array<TreeItem<Project>>, treeItemId: string, collections: Array<Collection>): ProjectPanelItem[] => {
-    const dataItems: ProjectPanelItem[] = [];
-
-    const treeItem = findTreeItem(projects, treeItemId);
-    if (treeItem) {
-        if (treeItem.items) {
-            treeItem.items.forEach(p => {
-                const item = {
-                    name: p.data.name,
-                    kind: ResourceKind.PROJECT,
-                    url: getResourceUrl(treeItem.data),
-                    owner: p.data.ownerUuid,
-                    uuid: p.data.uuid,
-                    lastModified: p.data.modifiedAt
-                } as ProjectPanelItem;
-
-                dataItems.push(item);
-            });
-        }
-    }
-
-    collections.forEach(c => {
-        const item = {
-            name: c.name,
-            kind: ResourceKind.COLLECTION,
-            url: getResourceUrl(c),
-            owner: c.ownerUuid,
-            uuid: c.uuid,
-            lastModified: c.modifiedAt
-        } as ProjectPanelItem;
-
-        dataItems.push(item);
-    });
-
-    return dataItems;
-};
-

commit 4dc31d8b4c4e4947fea1f7a69eb8eb06a3324dd0
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Wed Jul 4 15:57:33 2018 +0200

    Add pagination reseting to set filters action handler
    
    Feature #13703
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views/project-panel/project-panel-middleware.ts b/src/views/project-panel/project-panel-middleware.ts
index 8c1e8cc..2afc530 100644
--- a/src/views/project-panel/project-panel-middleware.ts
+++ b/src/views/project-panel/project-panel-middleware.ts
@@ -33,6 +33,7 @@ export const projectPanelMiddleware: Middleware = store => next => {
                 store.dispatch(actions.REQUEST_ITEMS({ id: PROJECT_PANEL_ID }));
             }),
             SET_FILTERS: handleProjectPanelAction(() => {
+                store.dispatch(actions.RESET_PAGINATION({ id: PROJECT_PANEL_ID }));
                 store.dispatch(actions.REQUEST_ITEMS({ id: PROJECT_PANEL_ID }));
             }),
             REQUEST_ITEMS: handleProjectPanelAction(() => {

commit 3db295e22bbe57635eac43b21530a61c29de293a
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Wed Jul 4 15:55:02 2018 +0200

    Handle filtering in projectPanelMiddleware
    
    Feature #13703
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views/project-panel/project-panel-middleware.ts b/src/views/project-panel/project-panel-middleware.ts
index 9be5981..8c1e8cc 100644
--- a/src/views/project-panel/project-panel-middleware.ts
+++ b/src/views/project-panel/project-panel-middleware.ts
@@ -4,11 +4,13 @@
 
 import { Middleware } from "redux";
 import actions from "../../store/data-explorer/data-explorer-action";
-import { PROJECT_PANEL_ID, columns } from "./project-panel";
+import { PROJECT_PANEL_ID, columns, ProjectPanelFilter } from "./project-panel";
 import { groupsService } from "../../services/services";
 import { RootState } from "../../store/store";
-import { getDataExplorer } from "../../store/data-explorer/data-explorer-reducer";
-import { resourceToDataItem } from "./project-panel-item";
+import { getDataExplorer, DataExplorerState } from "../../store/data-explorer/data-explorer-reducer";
+import { resourceToDataItem, ProjectPanelItem } from "./project-panel-item";
+import FilterBuilder from "../../common/api/filter-builder";
+import { DataColumns } from "../../components/data-table/data-table";
 
 export const projectPanelMiddleware: Middleware = store => next => {
     next(actions.SET_COLUMNS({ id: PROJECT_PANEL_ID, columns }));
@@ -30,26 +32,47 @@ export const projectPanelMiddleware: Middleware = store => next => {
             SET_ROWS_PER_PAGE: handleProjectPanelAction(() => {
                 store.dispatch(actions.REQUEST_ITEMS({ id: PROJECT_PANEL_ID }));
             }),
+            SET_FILTERS: handleProjectPanelAction(() => {
+                store.dispatch(actions.REQUEST_ITEMS({ id: PROJECT_PANEL_ID }));
+            }),
             REQUEST_ITEMS: handleProjectPanelAction(() => {
                 const state = store.getState() as RootState;
                 const dataExplorer = getDataExplorer(state.dataExplorer, PROJECT_PANEL_ID);
-                groupsService
-                    .contents(state.projects.currentItemId, {
-                        limit: dataExplorer.rowsPerPage,
-                        offset: dataExplorer.page * dataExplorer.rowsPerPage,
-                    })
-                    .then(response => {
-                        store.dispatch(actions.SET_ITEMS({
-                            id: PROJECT_PANEL_ID,
-                            items: response.items.map(resourceToDataItem),
-                            itemsAvailable: response.itemsAvailable,
-                            page: Math.floor(response.offset / response.limit),
-                            rowsPerPage: response.limit
-                        }));
-                    });
-
+                const typeColumn = columns.find(c => c.name === "Type");
+                const typeFilters = getSelectedTypeFilters(dataExplorer.columns as DataColumns<ProjectPanelItem, ProjectPanelFilter>);
+                if (typeFilters.length > 0) {
+                    groupsService
+                        .contents(state.projects.currentItemId, {
+                            limit: dataExplorer.rowsPerPage,
+                            offset: dataExplorer.page * dataExplorer.rowsPerPage,
+                            filters: FilterBuilder.create().addIsA("uuid", typeFilters.map(f => f.type))
+                        })
+                        .then(response => {
+                            store.dispatch(actions.SET_ITEMS({
+                                id: PROJECT_PANEL_ID,
+                                items: response.items.map(resourceToDataItem),
+                                itemsAvailable: response.itemsAvailable,
+                                page: Math.floor(response.offset / response.limit),
+                                rowsPerPage: response.limit
+                            }));
+                        });
+                } else {
+                    store.dispatch(actions.SET_ITEMS({
+                        id: PROJECT_PANEL_ID,
+                        items: [],
+                        itemsAvailable: 0,
+                        page: 0,
+                        rowsPerPage: dataExplorer.rowsPerPage
+                    }));
+                }
             }),
             default: () => next(action)
         });
     };
 };
+
+const getSelectedTypeFilters = (columns: DataColumns<ProjectPanelItem, ProjectPanelFilter>) => {
+    const typeColumn = columns.find(c => c.name === "Type");
+    return typeColumn && typeColumn.filters ? typeColumn.filters.filter(f => f.selected) : [];
+};
+

commit 508746f3c7c6d7077f4290228c393e0e29d58573
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Wed Jul 4 15:54:33 2018 +0200

    Handle resource type in type filters
    
    Feature #13703
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index 8d779d4..7323ce2 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -13,9 +13,14 @@ import { DataColumns } from '../../components/data-table/data-table';
 import { RouteComponentProps } from 'react-router';
 import { RootState } from '../../store/store';
 import { ResourceKind } from '../../models/kinds';
+import { DataTableFilterItem } from '../../components/data-table-filters/data-table-filters';
 
 export const PROJECT_PANEL_ID = "projectPanel";
 
+export interface ProjectPanelFilter extends DataTableFilterItem {
+    type: ResourceKind;
+}
+
 type ProjectPanelProps = {
     currentItemId: string,
     onItemClick: (item: ProjectPanelItem) => void,
@@ -116,7 +121,9 @@ const renderOwner = (owner: string) =>
         {owner}
     </Typography>;
 
-const getItemTypeLabel = (type: string) => {
+
+
+const typeToLabel = (type: string) => {
     switch(type){
         case ResourceKind.Collection:
             return "Data collection";
@@ -124,8 +131,6 @@ const getItemTypeLabel = (type: string) => {
             return "Project";
         case ResourceKind.Process: 
             return "Process";
-        case ResourceKind.Workflow:
-            return "Workflow";
         default:
             return "Unknown";
     }
@@ -133,7 +138,7 @@ const getItemTypeLabel = (type: string) => {
 
 const renderType = (type: string) => {
     return <Typography noWrap>
-        {getItemTypeLabel(type)}
+        {typeToLabel(type)}
     </Typography>;
 };
 
@@ -142,7 +147,9 @@ const renderStatus = (item: ProjectPanelItem) =>
         {item.status || "-"}
     </Typography>;
 
-export const columns: DataColumns<ProjectPanelItem> = [{
+
+
+export const columns: DataColumns<ProjectPanelItem, ProjectPanelFilter> = [{
     name: "Name",
     selected: true,
     sortDirection: "desc",
@@ -157,11 +164,17 @@ export const columns: DataColumns<ProjectPanelItem> = [{
     name: "Type",
     selected: true,
     filters: [{
-        name: "Collection",
-        selected: true
+        name: typeToLabel(ResourceKind.Collection),
+        selected: true,
+        type: ResourceKind.Collection
+    }, {
+        name: typeToLabel(ResourceKind.Process),
+        selected: true,
+        type: ResourceKind.Process
     }, {
-        name: "Project",
-        selected: true
+        name: typeToLabel(ResourceKind.Project),
+        selected: true,
+        type: ResourceKind.Project
     }],
     render: item => renderType(item.kind),
     width: "125px"

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list