From 2bcb7381a57ade294eab9f4ec504dcf9c043ebcf Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Tue, 10 Feb 2026 15:17:45 -0600 Subject: [PATCH] improve typing and modernize tool panel components to TS/composition API --- client/src/api/tools.ts | 15 ++ client/src/components/Panels/Common/Tool.vue | 203 +++++++----------- .../Panels/Common/ToolPanelLabel.vue | 2 +- .../Panels/Common/ToolPanelLinks.vue | 41 ++-- .../components/Panels/Common/ToolSection.vue | 123 +++++------ client/src/components/Panels/ToolBox.vue | 16 +- .../src/components/Panels/utilities.test.ts | 2 +- client/src/components/Panels/utilities.ts | 72 +++---- client/src/stores/toolStore.ts | 10 +- client/src/utils/navigation/navigation.yml | 2 - client/src/utils/navigation/schema.ts | 2 - 11 files changed, 215 insertions(+), 273 deletions(-) diff --git a/client/src/api/tools.ts b/client/src/api/tools.ts index 7ef06925577..16cd60c4591 100644 --- a/client/src/api/tools.ts +++ b/client/src/api/tools.ts @@ -1,5 +1,6 @@ import { type components, GalaxyApi } from "@/api"; import { ERROR_STATES, type ShowFullJobResponse } from "@/api/jobs"; +import type { Tool, ToolPanelItem, ToolSection, ToolSectionLabel } from "@/stores/toolStore"; import { errorMessageAsString } from "@/utils/simple-error"; export type HdcaUploadTarget = components["schemas"]["HdcaDataItemsTarget"]; @@ -130,3 +131,17 @@ export function fetchJobErrorMessage(jobDetails: ShowFullJobResponse): string | } return errorMessage; } + +// TODO: Once the backend models are typed, make sure these type guards are correct. +export function isTool(section: ToolPanelItem): section is Tool { + return !isToolSection(section) && !isToolSectionLabel(section); +} +export function isToolSection(section: ToolPanelItem): section is ToolSection { + return (section as ToolSection).tools !== undefined || (section as ToolSection).elems !== undefined; +} +export function isToolSectionLabel(section: ToolPanelItem): section is ToolSectionLabel { + return ( + (section as ToolSectionLabel).text !== undefined && + (section as ToolSectionLabel).model_class === "ToolSectionLabel" + ); +} diff --git a/client/src/components/Panels/Common/Tool.vue b/client/src/components/Panels/Common/Tool.vue index 3e3a1b5553a..f47c2011af3 100644 --- a/client/src/components/Panels/Common/Tool.vue +++ b/client/src/components/Panels/Common/Tool.vue @@ -1,135 +1,96 @@ - - - + +