From f8f5995fb9e1d036ff1b5d5d479bfae6698e9935 Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Fri, 8 Mar 2024 13:59:37 -0500 Subject: [PATCH] 21357: applied correct filtering to public favorites tree Arvados-DCO-1.1-Signed-off-by: Lisa Knox --- .../workbench2/src/common/link-update-name.ts | 2 +- .../side-panel-tree-actions.ts | 31 ++++++++++++++++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/services/workbench2/src/common/link-update-name.ts b/services/workbench2/src/common/link-update-name.ts index d8a0b7ad55..8530f5cd38 100644 --- a/services/workbench2/src/common/link-update-name.ts +++ b/services/workbench2/src/common/link-update-name.ts @@ -39,7 +39,7 @@ const fetchResource = (uuid: string, showErrors?: boolean) => async (dispatch: D return resource; } } catch(e) { - console.error(e); + console.error(`Could not fetch resource ${uuid}`, e); } return undefined; }; diff --git a/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts b/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts index 5b85d8c6dc..8b8b7cc7d1 100644 --- a/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts +++ b/services/workbench2/src/store/side-panel-tree/side-panel-tree-actions.ts @@ -179,8 +179,31 @@ export const loadPublicFavoritesTree = () => async (dispatch: Dispatch, getState limit: SIDEPANEL_TREE_NODE_LIMIT, }; - let items = (await services.linkService.list(params)).items; - for(let item of items) { + const items = (await services.linkService.list(params)).items; + + const uuids = items.map(it => it.headUuid); + const groupItems: any = await services.groupsService.list({ + filters: new FilterBuilder() + .addIn("uuid", uuids) + .addIsA("uuid", typeFilters) + .getFilters() + }); + const collectionItems: any = await services.collectionService.list({ + filters: new FilterBuilder() + .addIn("uuid", uuids) + .addIsA("uuid", typeFilters) + .getFilters() + }); + const processItems: any = await services.containerRequestService.list({ + filters: new FilterBuilder() + .addIn("uuid", uuids) + .addIsA("uuid", typeFilters) + .getFilters() + }); + + const filtereditems = groupItems.items.concat(collectionItems.items).concat(processItems.items); + + for(const item of filtereditems) { const verifiedName = await verifyAndUpdateLinkName(item, dispatch, getState, services); item.name = verifiedName; } @@ -189,11 +212,11 @@ export const loadPublicFavoritesTree = () => async (dispatch: Dispatch, getState treePickerActions.LOAD_TREE_PICKER_NODE_SUCCESS({ id: SidePanelTreeCategory.PUBLIC_FAVORITES, pickerId: SIDE_PANEL_TREE, - nodes: items.map(item => initTreeNode({ id: item.headUuid, value: item })), + nodes: filtereditems.map(item => initTreeNode({ id: item.headUuid, value: item })), }) ); - dispatch(resourcesActions.SET_RESOURCES(items)); + dispatch(resourcesActions.SET_RESOURCES(filtereditems)); }; export const activateSidePanelTreeItem = (id: string) => -- 2.30.2