[ARVADOS-WORKBENCH2] updated: 1.2.0-379-g5fdf4ad
Git user
git at public.curoverse.com
Mon Sep 17 04:50:21 EDT 2018
Summary of changes:
.../ancestors-service/ancestors-service.ts | 22 +++++++++++++---------
src/services/groups-service/groups-service.ts | 3 ++-
src/store/breadcrumbs/breadcrumbs-actions.ts | 20 ++++++++++++++++++++
src/store/navigation/navigation-action.ts | 2 ++
.../side-panel-tree/side-panel-tree-actions.ts | 4 ++--
src/store/workbench/workbench-actions.ts | 18 ++++++++++++------
6 files changed, 51 insertions(+), 18 deletions(-)
via 5fdf4adc6981e60169966e549e37c5611d7d420b (commit)
from 0a97d1cc5eedb11445af4b675c57b8cbdb4f1af3 (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 5fdf4adc6981e60169966e549e37c5611d7d420b
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Mon Sep 17 10:32:52 2018 +0200
Implement breadcrumbs for 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/services/ancestors-service/ancestors-service.ts b/src/services/ancestors-service/ancestors-service.ts
index f90b4a3..44e4eef 100644
--- a/src/services/ancestors-service/ancestors-service.ts
+++ b/src/services/ancestors-service/ancestors-service.ts
@@ -14,17 +14,21 @@ export class AncestorService {
private userService: UserService
) { }
- async ancestors(uuid: string, rootUuid: string): Promise<Array<UserResource | GroupResource | TrashableResource>> {
+ async ancestors(uuid: string, rootUuid: string): Promise<Array<UserResource | GroupResource>> {
const service = this.getService(extractUuidObjectType(uuid));
if (service) {
- const resource = await service.get(uuid);
- if (uuid === rootUuid) {
- return [resource];
- } else {
- return [
- ...await this.ancestors(resource.ownerUuid, rootUuid),
- resource
- ];
+ try {
+ const resource = await service.get(uuid);
+ if (uuid === rootUuid) {
+ return [resource];
+ } else {
+ return [
+ ...await this.ancestors(resource.ownerUuid, rootUuid),
+ resource
+ ];
+ }
+ } catch (e) {
+ return [];
}
} else {
return [];
diff --git a/src/services/groups-service/groups-service.ts b/src/services/groups-service/groups-service.ts
index 65ae705..299e680 100644
--- a/src/services/groups-service/groups-service.ts
+++ b/src/services/groups-service/groups-service.ts
@@ -10,6 +10,7 @@ import { ProjectResource } from "~/models/project";
import { ProcessResource } from "~/models/process";
import { TrashableResource } from "~/models/resource";
import { TrashableResourceService } from "~/services/common-service/trashable-resource-service";
+import { GroupResource } from '~/models/group';
export interface ContentsArguments {
limit?: number;
@@ -29,7 +30,7 @@ export type GroupContentsResource =
ProjectResource |
ProcessResource;
-export class GroupsService<T extends TrashableResource = TrashableResource> extends TrashableResourceService<T> {
+export class GroupsService<T extends GroupResource = GroupResource> extends TrashableResourceService<T> {
constructor(serverApi: AxiosInstance) {
super(serverApi, "groups");
diff --git a/src/store/breadcrumbs/breadcrumbs-actions.ts b/src/store/breadcrumbs/breadcrumbs-actions.ts
index cc7bb1d..dd35da3 100644
--- a/src/store/breadcrumbs/breadcrumbs-actions.ts
+++ b/src/store/breadcrumbs/breadcrumbs-actions.ts
@@ -10,6 +10,10 @@ import { TreePicker } from '../tree-picker/tree-picker';
import { getSidePanelTreeBranch } from '../side-panel-tree/side-panel-tree-actions';
import { propertiesActions } from '../properties/properties-actions';
import { getProcess } from '~/store/processes/process';
+import { ServiceRepository } from '~/services/services';
+import { SidePanelTreeCategory } from '~/store/side-panel-tree/side-panel-tree-actions';
+import { updateResources } from '../resources/resources-actions';
+import { ResourceKind } from '~/models/resource';
export const BREADCRUMBS = 'breadcrumbs';
@@ -35,6 +39,22 @@ export const setSidePanelBreadcrumbs = (uuid: string) =>
dispatch(setBreadcrumbs(breadcrumbs));
};
+export const setSharedWithMeBreadcrumbs = (uuid: string) =>
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ const ancestors = await services.ancestorsService.ancestors(uuid, '');
+ dispatch(updateResources(ancestors));
+ const initialBreadcrumbs: ResourceBreadcrumb[] = [
+ { label: SidePanelTreeCategory.SHARED_WITH_ME, uuid: SidePanelTreeCategory.SHARED_WITH_ME }
+ ];
+ const breadrumbs = ancestors.reduce((breadcrumbs, ancestor) =>
+ ancestor.kind === ResourceKind.GROUP
+ ? [...breadcrumbs, { label: ancestor.name, uuid: ancestor.uuid }]
+ : breadcrumbs,
+ initialBreadcrumbs);
+
+ dispatch(setBreadcrumbs(breadrumbs));
+ };
+
export const setProjectBreadcrumbs = setSidePanelBreadcrumbs;
export const setCollectionBreadcrumbs = (collectionUuid: string) =>
diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts
index b65f687..c68c539 100644
--- a/src/store/navigation/navigation-action.ts
+++ b/src/store/navigation/navigation-action.ts
@@ -24,6 +24,8 @@ export const navigateTo = (uuid: string) =>
}
if (uuid === SidePanelTreeCategory.FAVORITES) {
dispatch<any>(navigateToFavorites);
+ } else if(uuid === SidePanelTreeCategory.SHARED_WITH_ME){
+ dispatch(navigateToSharedWithMe);
}
};
diff --git a/src/store/side-panel-tree/side-panel-tree-actions.ts b/src/store/side-panel-tree/side-panel-tree-actions.ts
index 95e409f..073de22 100644
--- a/src/store/side-panel-tree/side-panel-tree-actions.ts
+++ b/src/store/side-panel-tree/side-panel-tree-actions.ts
@@ -147,14 +147,14 @@ export const expandSidePanelTreeItem = (nodeId: string) =>
}
};
-const getSidePanelTreeNode = (nodeId: string) => (treePicker: TreePicker) => {
+export const getSidePanelTreeNode = (nodeId: string) => (treePicker: TreePicker) => {
const sidePanelTree = getTreePicker(SIDE_PANEL_TREE)(treePicker);
return sidePanelTree
? getNodeValue(nodeId)(sidePanelTree)
: undefined;
};
-const getSidePanelTreeNodeAncestorsIds = (nodeId: string) => (treePicker: TreePicker) => {
+export const getSidePanelTreeNodeAncestorsIds = (nodeId: string) => (treePicker: TreePicker) => {
const sidePanelTree = getTreePicker(SIDE_PANEL_TREE)(treePicker);
return sidePanelTree
? getNodeAncestorsIds(nodeId)(sidePanelTree)
diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts
index bb41fa2..22b7b48 100644
--- a/src/store/workbench/workbench-actions.ts
+++ b/src/store/workbench/workbench-actions.ts
@@ -9,13 +9,13 @@ import { loadCollectionPanel } from '~/store/collection-panel/collection-panel-a
import { snackbarActions } from '../snackbar/snackbar-actions';
import { loadFavoritePanel } from '../favorite-panel/favorite-panel-action';
import { openProjectPanel, projectPanelActions } from '~/store/project-panel/project-panel-action';
-import { activateSidePanelTreeItem, initSidePanelTree, SidePanelTreeCategory, loadSidePanelTreeProjects } from '../side-panel-tree/side-panel-tree-actions';
+import { activateSidePanelTreeItem, initSidePanelTree, SidePanelTreeCategory, loadSidePanelTreeProjects, getSidePanelTreeNodeAncestorsIds } from '../side-panel-tree/side-panel-tree-actions';
import { loadResource, updateResources } from '../resources/resources-actions';
import { favoritePanelActions } from '~/store/favorite-panel/favorite-panel-action';
import { projectPanelColumns } from '~/views/project-panel/project-panel';
import { favoritePanelColumns } from '~/views/favorite-panel/favorite-panel';
import { matchRootRoute } from '~/routes/routes';
-import { setCollectionBreadcrumbs, setProjectBreadcrumbs, setSidePanelBreadcrumbs, setProcessBreadcrumbs } from '../breadcrumbs/breadcrumbs-actions';
+import { setCollectionBreadcrumbs, setProjectBreadcrumbs, setSidePanelBreadcrumbs, setProcessBreadcrumbs, setSharedWithMeBreadcrumbs } from '../breadcrumbs/breadcrumbs-actions';
import { navigateToProject } from '../navigation/navigation-action';
import { MoveToFormDialogData } from '~/store/move-to-dialog/move-to-dialog';
import { ServiceRepository } from '~/services/services';
@@ -82,10 +82,16 @@ export const loadTrash = () =>
};
export const loadProject = (uuid: string) =>
- async (dispatch: Dispatch) => {
- dispatch<any>(openProjectPanel(uuid));
- await dispatch<any>(activateSidePanelTreeItem(uuid));
- dispatch<any>(setProjectBreadcrumbs(uuid));
+ async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+ dispatch(openProjectPanel(uuid));
+ await dispatch(activateSidePanelTreeItem(uuid));
+ const ancestors = getSidePanelTreeNodeAncestorsIds(uuid)(getState().treePicker);
+ if (ancestors.find(uuid => uuid === services.authService.getUuid())) {
+ dispatch(setProjectBreadcrumbs(uuid));
+ } else {
+ dispatch(setSharedWithMeBreadcrumbs(uuid));
+ dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.SHARED_WITH_ME));
+ }
dispatch(loadDetailsPanel(uuid));
};
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list