summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-server/src/main/webui/data
diff options
context:
space:
mode:
authorvincent van beek <vincent@vlogic.nl>2026-04-15 16:19:02 +0200
committerGitHub <noreply@github.com>2026-04-15 16:19:02 +0200
commit11e355321db20b70c76c35b6e8fc36dbb9d97fc6 (patch)
treef12b8c8c2b6a642b315f2e4a7e54274bbcdb60be /opendc-web/opendc-web-server/src/main/webui/data
parent3e52cd36bed9455105f4a8c3d83ec805c1fb7b70 (diff)
add a job report to the scenario overview with details and time data (#406)
* add a job report to the scenario overview with details and time data * create Report data class
Diffstat (limited to 'opendc-web/opendc-web-server/src/main/webui/data')
-rw-r--r--opendc-web/opendc-web-server/src/main/webui/data/project.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/opendc-web/opendc-web-server/src/main/webui/data/project.js b/opendc-web/opendc-web-server/src/main/webui/data/project.js
index 60a8fab6..abef6189 100644
--- a/opendc-web/opendc-web-server/src/main/webui/data/project.js
+++ b/opendc-web/opendc-web-server/src/main/webui/data/project.js
@@ -164,3 +164,20 @@ export function useNewScenario() {
export function useDeleteScenario() {
return useMutation('deleteScenario')
}
+
+/**
+ * Return the job report for the specified job.
+ */
+export function useJobReport(jobId, options = {}) {
+ return useQuery(
+ ['job-report', jobId],
+ async () => {
+ const response = await fetch(`/api/jobs/${jobId}/report`)
+ if (!response.ok) {
+ throw new Error('Failed to fetch job report')
+ }
+ return response.json()
+ },
+ { enabled: !!jobId, ...options }
+ )
+}