diff --git a/client/src/components/ToolRecommendation.vue b/client/src/components/ToolRecommendation.vue index bf3e4f891bb..7df9be1a266 100644 --- a/client/src/components/ToolRecommendation.vue +++ b/client/src/components/ToolRecommendation.vue @@ -22,6 +22,8 @@ import { getCompatibleRecommendations } from "components/Workflow/Editor/modules import * as d3 from "d3"; import { getAppRoot } from "onload/loadConfig"; +import { getShortToolId } from "@/utils/tool"; + export default { props: { toolId: { @@ -38,12 +40,7 @@ export default { }, computed: { getToolId() { - let toolId = this.toolId || ""; - if (toolId.indexOf("/") > 0) { - const toolIdSlash = toolId.split("/"); - toolId = toolIdSlash[toolIdSlash.length - 2]; - } - return toolId; + return getShortToolId(this.toolId ?? ""); }, }, created() { diff --git a/client/src/components/Workflow/Editor/Recommendations.vue b/client/src/components/Workflow/Editor/Recommendations.vue index 5d1153cb574..81b741c1190 100644 --- a/client/src/components/Workflow/Editor/Recommendations.vue +++ b/client/src/components/Workflow/Editor/Recommendations.vue @@ -22,6 +22,7 @@ import LoadingSpan from "components/LoadingSpan"; import _l from "utils/localization"; import { useWorkflowStores } from "@/composables/workflowStores"; +import { getShortToolId } from "@/utils/tool"; import { getToolPredictions } from "./modules/services"; import { getCompatibleRecommendations } from "./modules/utilities"; @@ -59,11 +60,7 @@ export default { }, methods: { getToolId(toolId) { - if (toolId !== undefined && toolId !== null && toolId.indexOf("/") > -1) { - const toolIdSlash = toolId.split("/"); - toolId = toolIdSlash[toolIdSlash.length - 2]; - } - return toolId; + return getShortToolId(toolId ?? ""); }, getWorkflowPath(currentNodeId) { const steps = {};