From 8f9ed0cc28705c4a058921a90659bbcdc9e48737 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 30 Jul 2024 11:03:02 +0200 Subject: [PATCH] Manager & Webapp: code changes to handle the new worker tag info in Job Manager: Instead of embedding the worker tag info in a fetched `Job`, just include its UUID. Webapp: fetch the worker tag by UUID, instead of using the embedded info. --- internal/manager/api_impl/jobs.go | 2 +- internal/manager/api_impl/jobs_query_test.go | 6 +----- internal/manager/api_impl/jobs_test.go | 5 ----- web/app/src/components/jobs/JobDetails.vue | 4 ++-- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/internal/manager/api_impl/jobs.go b/internal/manager/api_impl/jobs.go index 886d594a..48ea8fe5 100644 --- a/internal/manager/api_impl/jobs.go +++ b/internal/manager/api_impl/jobs.go @@ -687,7 +687,7 @@ func jobDBtoAPI(dbJob *persistence.Job) api.Job { apiJob.DeleteRequestedAt = &dbJob.DeleteRequestedAt.Time } if dbJob.WorkerTag != nil { - apiJob.WorkerTag = workerTagDBtoAPI(dbJob.WorkerTag) + apiJob.WorkerTag = &dbJob.WorkerTag.UUID } return apiJob diff --git a/internal/manager/api_impl/jobs_query_test.go b/internal/manager/api_impl/jobs_query_test.go index 28a9e994..b8092e78 100644 --- a/internal/manager/api_impl/jobs_query_test.go +++ b/internal/manager/api_impl/jobs_query_test.go @@ -130,14 +130,10 @@ func TestFetchJob(t *testing.T) { Metadata: &api.JobMetadata{AdditionalProperties: map[string]string{ "project": "/projects/exploding-kittens", }}, + WorkerTag: ptr("d86e1b84-5ee2-4784-a178-65963eeb484b"), }, Id: "afc47568-bd9d-4368-8016-e91d945db36d", Status: api.JobStatusActive, - WorkerTag: &api.WorkerTag{ - Id: ptr("d86e1b84-5ee2-4784-a178-65963eeb484b"), - Name: "Tikkie terug Kees!", - Description: nil, // Empty description should just be excluded from the JSON. - }, } assertResponseJSON(t, echoCtx, http.StatusOK, expectedJob) diff --git a/internal/manager/api_impl/jobs_test.go b/internal/manager/api_impl/jobs_test.go index 32942cbe..b5134cab 100644 --- a/internal/manager/api_impl/jobs_test.go +++ b/internal/manager/api_impl/jobs_test.go @@ -415,11 +415,6 @@ func TestSubmitJobWithWorkerTag(t *testing.T) { DeleteRequestedAt: nil, Activity: "", Status: api.JobStatusQueued, - WorkerTag: &api.WorkerTag{ - Id: ptr(workerTagUUID), - Name: "first tag", - Description: ptr("my first tag"), - }, }) } diff --git a/web/app/src/components/jobs/JobDetails.vue b/web/app/src/components/jobs/JobDetails.vue index e2c9f075..0dcd5905 100644 --- a/web/app/src/components/jobs/JobDetails.vue +++ b/web/app/src/components/jobs/JobDetails.vue @@ -46,8 +46,8 @@
{{ jobType ? jobType.label : jobData.type }}
Worker Tag
-
- {{ jobData.worker_tag.name }} +
+ {{ workerTag.name }}
All Workers