Skip to content

Commit

Permalink
Merge pull request #17844 from ElectronicBlueberry/help-forum-short-id
Browse files Browse the repository at this point in the history
[24.0] Fix Help Forum Integration uses Long ID
  • Loading branch information
dannon authored Mar 26, 2024
2 parents 1fa50dc + 2b321ef commit f5e07b1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
6 changes: 4 additions & 2 deletions client/src/components/Tool/ToolHelpForum.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { computed, onMounted, ref } from "vue";
import { fetcher } from "@/api/schema";
import { useConfigStore } from "@/stores/configurationStore";
import { getShortToolId } from "@/utils/tool";
import { createTopicUrl, type HelpForumPost, type HelpForumTopic, useHelpURLs } from "./helpForumUrls";
Expand All @@ -26,7 +27,8 @@ const helpAvailable = computed(() => topics.value.length > 0);
const root = ref(null);
const query = computed(() => `tags:${props.toolId}+${toolHelpTag} status:solved`);
const shortToolId = computed(() => getShortToolId(props.toolId));
const query = computed(() => `tags:${shortToolId.value}+${toolHelpTag} status:solved`);
onMounted(async () => {
const response = await helpFetcher({ query: query.value });
Expand All @@ -49,7 +51,7 @@ function blurbForTopic(topicId: number): string {
const { createNewTopicUrl, searchTopicUrl } = useHelpURLs({
title: computed(() => props.toolName),
tags: computed(() => [props.toolId, toolHelpTag]),
tags: computed(() => [shortToolId.value, toolHelpTag]),
query,
});
Expand Down
9 changes: 3 additions & 6 deletions client/src/components/ToolRecommendation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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() {
Expand Down
7 changes: 2 additions & 5 deletions client/src/components/Workflow/Editor/Recommendations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 = {};
Expand Down
12 changes: 12 additions & 0 deletions client/src/utils/tool.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Converts a long tool ID to a short tool id.
* If the passed in ID is short already, returns it.
* @param longId long tool-id
* @returns short tool-id
*/
export function getShortToolId(longId: string): string {
const toolIdSlash = longId.split("/");
const shortId = toolIdSlash[toolIdSlash.length - 2];

return shortId ?? longId;
}

0 comments on commit f5e07b1

Please sign in to comment.