fix: also store and display "started at" for completed jobs (#33)

This commit is contained in:
Ruben Fiszel
2022-05-10 21:32:07 +02:00
committed by GitHub
parent ce70ec783e
commit 9bee83caae
5 changed files with 23 additions and 2 deletions
@@ -0,0 +1,3 @@
-- Add down migration script here
ALTER TABLE completed_job
DROP COLUMN started_at;
@@ -0,0 +1,4 @@
-- Add up migration script here
ALTER TABLE completed_job
ADD COLUMN started_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW();
+11
View File
@@ -2673,6 +2673,8 @@ components:
QueuedJob:
type: object
properties:
workspace_id:
type: string
id:
type: string
format: uuid
@@ -2738,6 +2740,8 @@ components:
CompletedJob:
type: object
properties:
workspace_id:
type: string
id:
type: string
format: uuid
@@ -2749,6 +2753,9 @@ components:
created_at:
type: string
format: date-time
started_at:
type: string
format: date-time
duration:
type: integer
success:
@@ -2791,6 +2798,10 @@ components:
type: boolean
required:
- id
- created_by
- duration
- created_at
- started_at
- success
- canceled
- job_kind
+4 -1
View File
@@ -92,6 +92,7 @@ struct CompletedJob {
parent_job: Option<Uuid>,
created_by: String,
created_at: chrono::DateTime<chrono::Utc>,
started_at: chrono::DateTime<chrono::Utc>,
duration: i32,
success: bool,
script_hash: Option<ScriptHash>,
@@ -433,7 +434,7 @@ async fn list_jobs(
"parent_job",
"created_by",
"created_at",
"null as started_at",
"started_at",
"null as scheduled_for",
"null as running",
"script_hash",
@@ -544,6 +545,7 @@ async fn list_completed_jobs(
"parent_job",
"created_by",
"created_at",
"started_at",
"duration",
"success",
"script_hash",
@@ -866,6 +868,7 @@ impl From<UnifiedJob> for Job {
parent_job: uj.parent_job,
created_by: uj.created_by,
created_at: uj.created_at,
started_at: uj.started_at.unwrap_or(uj.created_at),
duration: uj.duration.unwrap(),
success: uj.success.unwrap(),
script_hash: uj.script_hash,
+1 -1
View File
@@ -132,7 +132,7 @@ the bearer token they use has less privilege."
tabs={[
['script,dependencies,preview,flow', 'all'],
[`${CompletedJob.job_kind.SCRIPT},${CompletedJob.job_kind.FLOW}`, 'runs'],
[`${CompletedJob.job_kind.FLOW},${CompletedJob.job_kind.FLOWPREVIEW}`, 'previews'],
[`${CompletedJob.job_kind.PREVIEW},${CompletedJob.job_kind.FLOWPREVIEW}`, 'previews'],
[CompletedJob.job_kind.DEPENDENCIES, 'dependencies']
]}
dflt={1}