From 3fc465cff625e3d897c3721995332a737dfeba9c Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Sun, 20 Aug 2023 11:51:07 +0200 Subject: [PATCH] reduce default nb of jobs on runs page --- .../lib/components/FlowStatusViewer.svelte | 6 ++--- .../src/lib/components/ModuleStatus.svelte | 10 ++++---- frontend/src/lib/components/graph/model.ts | 24 ++++++++++++------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/frontend/src/lib/components/FlowStatusViewer.svelte b/frontend/src/lib/components/FlowStatusViewer.svelte index 26240bf464..e03dd47267 100644 --- a/frontend/src/lib/components/FlowStatusViewer.svelte +++ b/frontend/src/lib/components/FlowStatusViewer.svelte @@ -13,7 +13,7 @@ import Tabs from './common/tabs/Tabs.svelte' import { FlowGraph, type GraphModuleState } from './graph' import ModuleStatus from './ModuleStatus.svelte' - import { displayDate, emptyString, isOwner, pluralize, truncateRev } from '$lib/utils' + import { emptyString, isOwner, pluralize, truncateRev } from '$lib/utils' import JobArgs from './JobArgs.svelte' import { Loader2 } from 'lucide-svelte' import FlowStatusWaitingForEvents from './FlowStatusWaitingForEvents.svelte' @@ -107,7 +107,7 @@ }).then((job) => { localFlowModuleStates[mod.id ?? ''] = { type: mod.type, - scheduled_for: 'scheduled for ' + displayDate(job?.['scheduled_for'], true), + scheduled_for: job?.['scheduled_for'], job_id: job?.id, parent_module: mod['parent_module'], args: job?.args @@ -481,7 +481,7 @@ {/if} {:else if node}
- + {#if node.job_id}
diff --git a/frontend/src/lib/components/ModuleStatus.svelte b/frontend/src/lib/components/ModuleStatus.svelte index 40a030aa39..56458be24a 100644 --- a/frontend/src/lib/components/ModuleStatus.svelte +++ b/frontend/src/lib/components/ModuleStatus.svelte @@ -3,9 +3,11 @@ import { faHourglassHalf } from '@fortawesome/free-solid-svg-icons' import { Icon } from 'svelte-awesome' import { Badge } from './common' + import { forLater } from '$lib/forLater' + import { displayDate } from '$lib/utils' export let type: FlowStatusModule.type - export let scheduled_for: string | undefined + export let scheduled_for: Date | undefined {#if type == FlowStatusModule.type.WAITING_FOR_EVENTS} @@ -21,10 +23,10 @@ {:else if type == FlowStatusModule.type.WAITING_FOR_EXECUTOR} - {#if scheduled_for} - Job has been {scheduled_for} and will be executed after that time + {#if scheduled_for && forLater(scheduled_for.toString())} + Job is scheduled to be executed at {displayDate(scheduled_for, true)} {:else} - Job is waiting to be executed + Job is waiting for an executor {/if} {:else if type == FlowStatusModule.type.SUCCESS} diff --git a/frontend/src/lib/components/graph/model.ts b/frontend/src/lib/components/graph/model.ts index a77f58fd9e..76d3b2674a 100644 --- a/frontend/src/lib/components/graph/model.ts +++ b/frontend/src/lib/components/graph/model.ts @@ -1,19 +1,25 @@ -import type { FlowStatusModule } from "$lib/gen" -import type { UserNodeType } from "./svelvet/types"; +import type { FlowStatusModule } from '$lib/gen' +import type { UserNodeType } from './svelvet/types' export type ModuleHost = 'workspace' | 'inline' | 'hub' -export type Node = UserNodeType & { parentIds: string[], edgeLabel?: string, host?: ModuleHost, type: 'node', loopDepth: number } +export type Node = UserNodeType & { + parentIds: string[] + edgeLabel?: string + host?: ModuleHost + type: 'node' + loopDepth: number +} export type Loop = { - type: 'loop', + type: 'loop' items: NestedNodes } export type Branch = { - node: Node, - nodeEnd: Node, - type: 'branch', + node: Node + nodeEnd: Node + type: 'branch' items: NestedNodes[] } @@ -24,7 +30,7 @@ export type GraphModuleState = { args: any logs?: string result?: any - scheduled_for?: string + scheduled_for?: Date job_id?: string parent_module?: string iteration_total?: number @@ -43,4 +49,4 @@ export function isLoop(item: GraphItem | NestedNodes | undefined): item is Loop export function isBranch(item: GraphItem | NestedNodes | undefined): item is Branch { return item?.['type'] === 'branch' -} \ No newline at end of file +}