From d83425ab9cd0eaa6322ca52dbc9bc7dff7195494 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sat, 5 Nov 2022 16:46:23 +0100 Subject: [PATCH] feat(frontend): show runs using a time chart --- frontend/src/lib/components/RunChart.svelte | 13 ++++- .../src/lib/components/jobs/JobDetail.svelte | 11 +++- frontend/src/routes/runs/[...path].svelte | 58 +++++++++++++++++-- 3 files changed, 75 insertions(+), 7 deletions(-) diff --git a/frontend/src/lib/components/RunChart.svelte b/frontend/src/lib/components/RunChart.svelte index 5142844585..2efc3a06a5 100644 --- a/frontend/src/lib/components/RunChart.svelte +++ b/frontend/src/lib/components/RunChart.svelte @@ -15,9 +15,12 @@ LogarithmicScale } from 'chart.js' import type { CompletedJob } from '$lib/gen' + import { createEventDispatcher } from 'svelte' export let jobs: CompletedJob[] | undefined = [] + const dispatch = createEventDispatcher() + $: success = jobs?.filter((x) => x.success) $: failed = jobs?.filter((x) => !x.success) ChartJS.register( @@ -54,13 +57,19 @@ const zoomOptions = { pan: { enabled: true, - modifierKey: 'ctrl' as 'ctrl' + modifierKey: 'ctrl' as 'ctrl', + onPan: ({ chart }) => { + console.log('XXX') + } }, zoom: { drag: { enabled: true }, - mode: 'x' as 'x' + mode: 'x' as 'x', + onZoom: ({ chart }) => { + dispatch('zoom', { min: new Date(chart.scales.x.min), max: new Date(chart.scales.x.max) }) + } } } diff --git a/frontend/src/lib/components/jobs/JobDetail.svelte b/frontend/src/lib/components/jobs/JobDetail.svelte index 759f862dc1..f2168639a2 100644 --- a/frontend/src/lib/components/jobs/JobDetail.svelte +++ b/frontend/src/lib/components/jobs/JobDetail.svelte @@ -1,4 +1,6 @@ @@ -162,8 +169,25 @@ tooltip="All past and schedule executions of scripts and flows, including previews. You only see your own runs or runs of groups you belong to unless you are an admin." /> +
+ + + +
-
+
+
+
max datetime + +
+
{#if jobs}