const nodes = getSidePanelTreeBranch(uuid)(treePicker);
return nodes.map(node =>
typeof node.value === 'string'
- ? { label: node.value, uuid: node.nodeId }
+ ? { label: node.value, uuid: node.id }
: { label: node.value.name, uuid: node.value.uuid });
};
};
export const setSharedWithMeBreadcrumbs = (uuid: string) =>
+ setCategoryBreadcrumbs(uuid, SidePanelTreeCategory.SHARED_WITH_ME);
+
+export const setTrashBreadcrumbs = (uuid: string) =>
+ setCategoryBreadcrumbs(uuid, SidePanelTreeCategory.TRASH);
+
+export const setCategoryBreadcrumbs = (uuid: string, category: SidePanelTreeCategory) =>
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 }
+ { label: category, uuid: category }
];
const breadrumbs = ancestors.reduce((breadcrumbs, ancestor) =>
ancestor.kind === ResourceKind.GROUP
(dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
const ancestors = getSidePanelTreeNodeAncestorsIds(uuid)(getState().treePicker);
const rootUuid = services.authService.getUuid();
- if (uuid === rootUuid ||ancestors.find(uuid => uuid === rootUuid)) {
+ if (uuid === rootUuid || ancestors.find(uuid => uuid === rootUuid)) {
dispatch(setSidePanelBreadcrumbs(uuid));
} else {
dispatch(setSharedWithMeBreadcrumbs(uuid));