[ARVADOS-WORKBENCH2] updated: 1.2.0-334-gca1736b

Git user git at public.curoverse.com
Fri Sep 7 10:03:11 EDT 2018


Summary of changes:
 src/services/groups-service/groups-service.ts      | 12 +++-
 .../project-panel-middleware-service.ts            |  8 +--
 .../shared-with-me-middleware-service.ts           | 73 ++++++++++++++++++++--
 src/store/workbench/workbench-actions.ts           |  2 +-
 .../shared-with-me-panel/shared-with-me-panel.tsx  |  2 +-
 5 files changed, 85 insertions(+), 12 deletions(-)

       via  ca1736b82188c7c341f61a779552708263ca5def (commit)
       via  fbe71606b4a8bcdb9561c64ee71e0cbd0a38dc08 (commit)
      from  5f27c58e1c34d147786de6104ead8a57c48f7d2e (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 ca1736b82188c7c341f61a779552708263ca5def
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Sep 7 15:48:38 2018 +0200

    Add filtering to shared with me panel
    
    Feature #13751
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts b/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts
index da66fde..0989c54 100644
--- a/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts
+++ b/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts
@@ -9,7 +9,7 @@ import { RootState } from '~/store/store';
 import { getDataExplorer, DataExplorer } from '~/store/data-explorer/data-explorer-reducer';
 import { updateFavorites } from '~/store/favorites/favorites-actions';
 import { updateResources } from '~/store/resources/resources-actions';
-import { loadMissingProcessesInformation, getFilters } from '~/store/project-panel/project-panel-middleware-service';
+import { loadMissingProcessesInformation } from '~/store/project-panel/project-panel-middleware-service';
 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 import { sharedWithMePanelActions } from './shared-with-me-panel-actions';
 import { ListResults } from '~/services/common-service/common-resource-service';
@@ -18,6 +18,7 @@ import { SortDirection } from '~/components/data-table/data-column';
 import { OrderBuilder, OrderDirection } from '~/services/api/order-builder';
 import { ProjectResource } from '~/models/project';
 import { ProjectPanelColumnNames } from '~/views/project-panel/project-panel';
+import { FilterBuilder } from '~/services/api/filter-builder';
 
 export class SharedWithMeMiddlewareService extends DataExplorerMiddlewareService {
     constructor(private services: ServiceRepository, id: string) {
@@ -43,8 +44,15 @@ export class SharedWithMeMiddlewareService extends DataExplorerMiddlewareService
 export const getParams = (dataExplorer: DataExplorer) => ({
     ...dataExplorerToListParams(dataExplorer),
     order: getOrder(dataExplorer),
+    filters: getFilters(dataExplorer),
 });
 
+export const getFilters = (dataExplorer: DataExplorer) => {
+    return new FilterBuilder()
+        .addILike("name", dataExplorer.searchValue)
+        .getFilters();
+};
+
 export const getOrder = (dataExplorer: DataExplorer) => {
     const sortColumn = dataExplorer.columns.find(c => c.sortDirection !== SortDirection.NONE);
     const order = new OrderBuilder<ProjectResource>();

commit fbe71606b4a8bcdb9561c64ee71e0cbd0a38dc08
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Fri Sep 7 15:17:44 2018 +0200

    Connect shared with me to the service
    
    Feature #13751
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

diff --git a/src/services/groups-service/groups-service.ts b/src/services/groups-service/groups-service.ts
index b285e92..65ae705 100644
--- a/src/services/groups-service/groups-service.ts
+++ b/src/services/groups-service/groups-service.ts
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as _ from "lodash";
-import { CommonResourceService, ListResults } from "~/services/common-service/common-resource-service";
+import { CommonResourceService, ListResults, ListArguments } from '~/services/common-service/common-resource-service';
 import { AxiosInstance } from "axios";
 import { CollectionResource } from "~/models/collection";
 import { ProjectResource } from "~/models/project";
@@ -20,6 +20,10 @@ export interface ContentsArguments {
     includeTrash?: boolean;
 }
 
+export interface SharedArguments extends ListArguments {
+    include?: string;
+}
+
 export type GroupContentsResource =
     CollectionResource |
     ProjectResource |
@@ -44,6 +48,12 @@ export class GroupsService<T extends TrashableResource = TrashableResource> exte
             })
             .then(CommonResourceService.mapResponseKeys);
     }
+
+    shared(params: SharedArguments = {}): Promise<ListResults<GroupContentsResource>> {
+        return this.serverApi
+            .get(this.resourceType + 'shared', { params })
+            .then(CommonResourceService.mapResponseKeys);
+    }
 }
 
 export enum GroupContentsResourcePrefix {
diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts
index 4b4ec26..519943c 100644
--- a/src/store/project-panel/project-panel-middleware-service.ts
+++ b/src/store/project-panel/project-panel-middleware-service.ts
@@ -66,19 +66,19 @@ export const loadMissingProcessesInformation = (resources: GroupContentsResource
         }
     };
 
-const setItems = (listResults: ListResults<GroupContentsResource>) =>
+export const setItems = (listResults: ListResults<GroupContentsResource>) =>
     projectPanelActions.SET_ITEMS({
         ...listResultsToDataExplorerItemsMeta(listResults),
         items: listResults.items.map(resource => resource.uuid),
     });
 
-const getParams = (dataExplorer: DataExplorer) => ({
+export const getParams = (dataExplorer: DataExplorer) => ({
     ...dataExplorerToListParams(dataExplorer),
     order: getOrder(dataExplorer),
     filters: getFilters(dataExplorer),
 });
 
-const getFilters = (dataExplorer: DataExplorer) => {
+export const getFilters = (dataExplorer: DataExplorer) => {
     const columns = dataExplorer.columns as DataColumns<string, ProjectPanelFilter>;
     const typeFilters = getDataExplorerColumnFilters(columns, ProjectPanelColumnNames.TYPE);
     const statusFilters = getDataExplorerColumnFilters(columns, ProjectPanelColumnNames.STATUS);
@@ -90,7 +90,7 @@ const getFilters = (dataExplorer: DataExplorer) => {
         .getFilters();
 };
 
-const getOrder = (dataExplorer: DataExplorer) => {
+export const getOrder = (dataExplorer: DataExplorer) => {
     const sortColumn = dataExplorer.columns.find(c => c.sortDirection !== SortDirection.NONE);
     const order = new OrderBuilder<ProjectResource>();
     if (sortColumn) {
diff --git a/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts b/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts
index 12c6850..da66fde 100644
--- a/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts
+++ b/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts
@@ -2,10 +2,22 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { DataExplorerMiddlewareService } from '../data-explorer/data-explorer-middleware-service';
-import { RootState } from "../store";
-import { ServiceRepository } from "~/services/services";
-import { Dispatch, MiddlewareAPI } from "redux";
+import { DataExplorerMiddlewareService, listResultsToDataExplorerItemsMeta, dataExplorerToListParams } from '../data-explorer/data-explorer-middleware-service';
+import { ServiceRepository } from '~/services/services';
+import { MiddlewareAPI, Dispatch } from 'redux';
+import { RootState } from '~/store/store';
+import { getDataExplorer, DataExplorer } from '~/store/data-explorer/data-explorer-reducer';
+import { updateFavorites } from '~/store/favorites/favorites-actions';
+import { updateResources } from '~/store/resources/resources-actions';
+import { loadMissingProcessesInformation, getFilters } from '~/store/project-panel/project-panel-middleware-service';
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
+import { sharedWithMePanelActions } from './shared-with-me-panel-actions';
+import { ListResults } from '~/services/common-service/common-resource-service';
+import { GroupContentsResource } from '~/services/groups-service/groups-service';
+import { SortDirection } from '~/components/data-table/data-column';
+import { OrderBuilder, OrderDirection } from '~/services/api/order-builder';
+import { ProjectResource } from '~/models/project';
+import { ProjectPanelColumnNames } from '~/views/project-panel/project-panel';
 
 export class SharedWithMeMiddlewareService extends DataExplorerMiddlewareService {
     constructor(private services: ServiceRepository, id: string) {
@@ -13,6 +25,49 @@ export class SharedWithMeMiddlewareService extends DataExplorerMiddlewareService
     }
 
     async requestItems(api: MiddlewareAPI<Dispatch, RootState>) {
-        return;
+        const state = api.getState();
+        const dataExplorer = getDataExplorer(state.dataExplorer, this.getId());
+        try {
+            const response = await this.services.groupsService.shared(getParams(dataExplorer));
+            api.dispatch<any>(updateFavorites(response.items.map(item => item.uuid)));
+            api.dispatch(updateResources(response.items));
+            await api.dispatch<any>(loadMissingProcessesInformation(response.items));
+            api.dispatch(setItems(response));
+        } catch (e) {
+            api.dispatch(couldNotFetchSharedItems());
+        }
+
     }
 }
+
+export const getParams = (dataExplorer: DataExplorer) => ({
+    ...dataExplorerToListParams(dataExplorer),
+    order: getOrder(dataExplorer),
+});
+
+export const getOrder = (dataExplorer: DataExplorer) => {
+    const sortColumn = dataExplorer.columns.find(c => c.sortDirection !== SortDirection.NONE);
+    const order = new OrderBuilder<ProjectResource>();
+    if (sortColumn) {
+        const sortDirection = sortColumn && sortColumn.sortDirection === SortDirection.ASC
+            ? OrderDirection.ASC
+            : OrderDirection.DESC;
+        const columnName = sortColumn && sortColumn.name === ProjectPanelColumnNames.NAME ? "name" : "createdAt";
+        return order
+            .addOrder(sortDirection, columnName)
+            .getOrder();
+    } else {
+        return order.getOrder();
+    }
+};
+
+export const setItems = (listResults: ListResults<GroupContentsResource>) =>
+    sharedWithMePanelActions.SET_ITEMS({
+        ...listResultsToDataExplorerItemsMeta(listResults),
+        items: listResults.items.map(resource => resource.uuid),
+    });
+
+const couldNotFetchSharedItems = () =>
+    snackbarActions.OPEN_SNACKBAR({
+        message: 'Could not fetch shared items.'
+    });
diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts
index c6798ea..7b8fdb2 100644
--- a/src/store/workbench/workbench-actions.ts
+++ b/src/store/workbench/workbench-actions.ts
@@ -79,9 +79,9 @@ export const loadTrash = () =>
 
 export const loadProject = (uuid: string) =>
     async (dispatch: Dispatch) => {
+        dispatch<any>(openProjectPanel(uuid));
         await dispatch<any>(activateSidePanelTreeItem(uuid));
         dispatch<any>(setProjectBreadcrumbs(uuid));
-        dispatch<any>(openProjectPanel(uuid));
         dispatch(loadDetailsPanel(uuid));
     };
 
diff --git a/src/views/shared-with-me-panel/shared-with-me-panel.tsx b/src/views/shared-with-me-panel/shared-with-me-panel.tsx
index df66803..5d782f5 100644
--- a/src/views/shared-with-me-panel/shared-with-me-panel.tsx
+++ b/src/views/shared-with-me-panel/shared-with-me-panel.tsx
@@ -56,7 +56,7 @@ export const SharedWithMePanel = withStyles(styles)(
             hasAnyTrashedResources = () => {
                 // TODO: implement check if there is anything in the trash,
                 //       without taking pagination into the account
-                return false;
+                return true;
             }
 
             handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list