@galaxy-tool-util/gxwf-report-shell 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,103 @@
1
+ <template>
2
+ <div class="operation-report">
3
+ <Message v-if="report.skipped_reason" severity="warn" :closable="false">
4
+ Skipped: {{ report.skipped_reason }}
5
+ </Message>
6
+
7
+ <template v-if="structureErrors.length || encodingErrors.length">
8
+ <Message severity="error" :closable="false">
9
+ <ul class="error-list">
10
+ <li v-for="(e, i) in structureErrors" :key="'s' + i">{{ e }}</li>
11
+ <li v-for="(e, i) in encodingErrors" :key="'e' + i">{{ e }}</li>
12
+ </ul>
13
+ </Message>
14
+ </template>
15
+
16
+ <Panel
17
+ v-if="report.clean_report != null"
18
+ header="Pre-validation clean"
19
+ :toggleable="true"
20
+ :collapsed="true"
21
+ >
22
+ <CleanReport :report="report.clean_report" />
23
+ </Panel>
24
+
25
+ <div class="summary-row">
26
+ <Tag
27
+ v-for="(count, key) in report.summary"
28
+ :key="key"
29
+ :value="`${key}: ${count}`"
30
+ :severity="key === 'ok' ? 'success' : key === 'fail' ? 'danger' : 'secondary'"
31
+ />
32
+ </div>
33
+
34
+ <DataTable :value="report.results" size="small" class="results-table">
35
+ <Column field="step" header="Step" />
36
+ <Column header="Tool">
37
+ <template #body="{ data }: { data: ValidationStepResult }">
38
+ <ToolId :tool-id="data.tool_id" />
39
+ </template>
40
+ </Column>
41
+ <Column header="Status">
42
+ <template #body="{ data }: { data: ValidationStepResult }">
43
+ <Tag :value="data.status" :severity="statusSeverity(data.status)" />
44
+ </template>
45
+ </Column>
46
+ <Column header="Errors">
47
+ <template #body="{ data }: { data: ValidationStepResult }">
48
+ <ul v-if="data.errors.length" class="error-list">
49
+ <li v-for="(e, i) in data.errors" :key="i">{{ e }}</li>
50
+ </ul>
51
+ </template>
52
+ </Column>
53
+ </DataTable>
54
+ </div>
55
+ </template>
56
+
57
+ <script setup lang="ts">
58
+ import { computed } from "vue";
59
+ import type { SingleValidationReport, ValidationStepResult } from "@galaxy-tool-util/schema";
60
+ import DataTable from "primevue/datatable";
61
+ import Column from "primevue/column";
62
+ import Panel from "primevue/panel";
63
+ import Tag from "primevue/tag";
64
+ import Message from "primevue/message";
65
+ import CleanReport from "./CleanReport.vue";
66
+ import ToolId from "./ToolId.vue";
67
+
68
+ const props = defineProps<{
69
+ report: SingleValidationReport;
70
+ }>();
71
+
72
+ const structureErrors = computed(() => props.report.structure_errors ?? []);
73
+ const encodingErrors = computed(() => props.report.encoding_errors ?? []);
74
+
75
+ function statusSeverity(status: ValidationStepResult["status"]) {
76
+ if (status === "ok") return "success";
77
+ if (status === "fail") return "danger";
78
+ return "secondary";
79
+ }
80
+ </script>
81
+
82
+ <style scoped>
83
+ .operation-report {
84
+ display: flex;
85
+ flex-direction: column;
86
+ gap: 0.75rem;
87
+ }
88
+
89
+ .summary-row {
90
+ display: flex;
91
+ gap: 0.5rem;
92
+ flex-wrap: wrap;
93
+ }
94
+
95
+ .results-table {
96
+ margin-top: 0.5rem;
97
+ }
98
+
99
+ .error-list {
100
+ margin: 0;
101
+ padding-left: 1.25rem;
102
+ }
103
+ </style>
package/src/index.ts ADDED
@@ -0,0 +1,14 @@
1
+ export { default as ValidationReport } from "./ValidationReport.vue";
2
+ export { default as LintReport } from "./LintReport.vue";
3
+ export { default as CleanReport } from "./CleanReport.vue";
4
+ export { default as RoundtripReport } from "./RoundtripReport.vue";
5
+ export { default as ExportReport } from "./ExportReport.vue";
6
+ export { default as TreeValidationReport } from "./TreeValidationReport.vue";
7
+ export { default as TreeLintReport } from "./TreeLintReport.vue";
8
+ export { default as TreeCleanReport } from "./TreeCleanReport.vue";
9
+ export { default as TreeRoundtripReport } from "./TreeRoundtripReport.vue";
10
+ export { default as ReportShell } from "./ReportShell.vue";
11
+ export { default as RawJsonView } from "./RawJsonView.vue";
12
+ export { default as ToolId } from "./ToolId.vue";
13
+ export { parseToolId, formatToolId } from "./toolId.js";
14
+ export type { ParsedToolId } from "./toolId.js";
package/src/shell.ts ADDED
@@ -0,0 +1,42 @@
1
+ import { createApp } from "vue";
2
+ import PrimeVue from "primevue/config";
3
+ import Aura from "@primevue/themes/aura";
4
+ import ReportShell from "./ReportShell.vue";
5
+
6
+ interface ReportPayload {
7
+ type:
8
+ | "validate"
9
+ | "lint"
10
+ | "clean"
11
+ | "roundtrip"
12
+ | "validate-tree"
13
+ | "lint-tree"
14
+ | "clean-tree"
15
+ | "roundtrip-tree";
16
+ data: unknown;
17
+ }
18
+
19
+ function mount(payload: ReportPayload) {
20
+ const app = createApp(ReportShell, { report: payload });
21
+ app.use(PrimeVue, { theme: { preset: Aura } });
22
+ app.mount("#gxwf-report");
23
+ }
24
+
25
+ // Support two data injection patterns:
26
+ // 1. Static HTML: window.__GXWF_REPORT__ set before this script tag
27
+ // 2. VSCode webview / dynamic: postMessage after load
28
+ const initial = (window as unknown as Record<string, unknown>).__GXWF_REPORT__ as
29
+ | ReportPayload
30
+ | undefined;
31
+ if (initial) {
32
+ mount(initial);
33
+ } else {
34
+ // postMessage-based injection for VSCode webview or other dynamic hosts.
35
+ // Host sends: { command: "render", type: "validate", data: {...} }
36
+ window.addEventListener("message", (event: MessageEvent) => {
37
+ const msg = event.data as { command?: string; type?: string; data?: unknown };
38
+ if (msg.command === "render" && msg.type && msg.data) {
39
+ mount({ type: msg.type as ReportPayload["type"], data: msg.data });
40
+ }
41
+ });
42
+ }
package/src/toolId.ts ADDED
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Parse a Galaxy ToolShed tool ID into display parts.
3
+ *
4
+ * ToolShed format: {host}/repos/{owner}/{repo}/{tool_name}/{version}
5
+ * Example: toolshed.g2.bx.psu.edu/repos/iuc/query_tabular/query_tabular/3.3.2
6
+ * → { toolName: "query_tabular", version: "3.3.2", owner: "iuc", repo: "query_tabular" }
7
+ *
8
+ * Non-toolshed IDs (built-ins like "__DATA_FETCH__") are returned as-is via `formatToolId`.
9
+ */
10
+ export interface ParsedToolId {
11
+ toolName: string;
12
+ version: string;
13
+ owner: string;
14
+ repo: string;
15
+ }
16
+
17
+ export function parseToolId(id: string): ParsedToolId | null {
18
+ const match = id.match(/\/repos\/([^/]+)\/([^/]+)\/([^/]+)\/([^/]+)$/);
19
+ if (!match) return null;
20
+ const [, owner, repo, toolName, version] = match;
21
+ return { owner, repo, toolName, version };
22
+ }
23
+
24
+ /** Format a raw tool_id (possibly null) as a short human-readable string. */
25
+ export function formatToolId(id: string | null): string {
26
+ if (!id) return "—";
27
+ const parsed = parseToolId(id);
28
+ if (!parsed) return id;
29
+ return `${parsed.toolName}@${parsed.version} (${parsed.owner}/${parsed.repo})`;
30
+ }