diff --git a/backend/migrations/20220509191845_started_at_completed_job.down.sql b/backend/migrations/20220509191845_started_at_completed_job.down.sql new file mode 100644 index 0000000000..3180e0cb73 --- /dev/null +++ b/backend/migrations/20220509191845_started_at_completed_job.down.sql @@ -0,0 +1,3 @@ +-- Add down migration script here +ALTER TABLE completed_job +DROP COLUMN started_at; diff --git a/backend/migrations/20220509191845_started_at_completed_job.up.sql b/backend/migrations/20220509191845_started_at_completed_job.up.sql new file mode 100644 index 0000000000..03d4e4b119 --- /dev/null +++ b/backend/migrations/20220509191845_started_at_completed_job.up.sql @@ -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(); + diff --git a/backend/openapi.yaml b/backend/openapi.yaml index c8db4e2aef..5a56517979 100644 --- a/backend/openapi.yaml +++ b/backend/openapi.yaml @@ -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 diff --git a/backend/src/jobs.rs b/backend/src/jobs.rs index 492e84054c..e3902a5716 100644 --- a/backend/src/jobs.rs +++ b/backend/src/jobs.rs @@ -92,6 +92,7 @@ struct CompletedJob { parent_job: Option, created_by: String, created_at: chrono::DateTime, + started_at: chrono::DateTime, duration: i32, success: bool, script_hash: Option, @@ -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 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, diff --git a/frontend/src/routes/runs/[...path].svelte b/frontend/src/routes/runs/[...path].svelte index e473bd5ca5..7d36246832 100644 --- a/frontend/src/routes/runs/[...path].svelte +++ b/frontend/src/routes/runs/[...path].svelte @@ -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}