From d082138fc02d740c3e68e0436a09567b6f4b02e2 Mon Sep 17 00:00:00 2001 From: John Hopper Date: Thu, 8 Feb 2024 14:01:28 -0800 Subject: [PATCH] chore: add visible job status function for BED-4111 --- cmd/api/src/model/jobs.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/cmd/api/src/model/jobs.go b/cmd/api/src/model/jobs.go index a7f942f9e1..85af94d0cc 100644 --- a/cmd/api/src/model/jobs.go +++ b/cmd/api/src/model/jobs.go @@ -108,15 +108,15 @@ func (s FileUploadJobs) GetValidFilterPredicatesAsStrings(column string) ([]stri type JobStatus int const ( - JobStatusInvalid JobStatus = -1 - JobStatusReady JobStatus = 0 - JobStatusRunning JobStatus = 1 - JobStatusComplete JobStatus = 2 - JobStatusCanceled JobStatus = 3 - JobStatusTimedOut JobStatus = 4 - JobStatusFailed JobStatus = 5 - JobStatusIngesting JobStatus = 6 - JobStatusAnalyzing JobStatus = 7 + JobStatusInvalid JobStatus = -1 + JobStatusReady JobStatus = 0 + JobStatusRunning JobStatus = 1 + JobStatusComplete JobStatus = 2 + JobStatusCanceled JobStatus = 3 + JobStatusTimedOut JobStatus = 4 + JobStatusFailed JobStatus = 5 + JobStatusIngesting JobStatus = 6 + JobStatusAnalyzing JobStatus = 7 JobStatusPartiallyComplete JobStatus = 8 ) @@ -147,6 +147,10 @@ func ParseJobStatus(jobStatusStr string) (JobStatus, error) { return JobStatusInvalid, fmt.Errorf("no matching job status for: %s", jobStatusStr) } +func GetVisibleJobStatuses() []JobStatus { + return []JobStatus{JobStatusComplete, JobStatusCanceled, JobStatusTimedOut, JobStatusFailed, JobStatusIngesting, JobStatusAnalyzing, JobStatusPartiallyComplete} +} + func (s JobStatus) String() string { switch s { case JobStatusReady: @@ -172,7 +176,7 @@ func (s JobStatus) String() string { case JobStatusAnalyzing: return "ANALYZING" - + case JobStatusPartiallyComplete: return "PARTIALLYCOMPLETE"