diff --git a/client/src/components/Panels/utilities.js b/client/src/components/Panels/utilities.js index fe1913b3d33..3d5090edd9c 100644 --- a/client/src/components/Panels/utilities.js +++ b/client/src/components/Panels/utilities.js @@ -1,10 +1,14 @@ export function filterToolSections(layout, results) { if (results) { + results = normalize_results(results); const filteredLayout = layout.map((section) => { var toolRes = []; if (section.elems) { section.elems.forEach((el) => { - if (!el.text && results.includes(el.id)) { + if ( + (!el.text && results.includes(el.id)) || + (el.tool_shed_repository && results.includes(el.tool_shed_repository.name)) + ) { toolRes.push(el); } }); @@ -41,6 +45,7 @@ export function filterTools(layout, results) { // do not consider expression tools, unless requested by the workflow editor layout = layout.filter((section) => section.name !== "Expression Tools"); if (results) { + results = normalize_results(results); var toolsResults = []; if (results.length < 1) { return toolsResults; @@ -50,7 +55,10 @@ export function filterTools(layout, results) { layout.map((section) => { if (section.elems) { section.elems.forEach((el) => { - if (!el.text && results.includes(el.id)) { + if ( + (!el.text && results.includes(el.id)) || + (el.tool_shed_repository && results.includes(el.tool_shed_repository.name)) + ) { toolsResults.push(el); } }); @@ -65,3 +73,15 @@ export function filterTools(layout, results) { return layout; } } + +function normalize_results(results) { + var norm_results = []; + results.forEach((result) => { + if (result.includes("/repos/")) { + norm_results.push(result.split("/")[3]); + } else { + norm_results.push(result); + } + }); + return norm_results; +}