From 644badf8c78cbefdcc44a8895386d9bf5e52bd3d Mon Sep 17 00:00:00 2001 From: Hanamichi Date: Mon, 22 Aug 2022 11:11:00 +0800 Subject: [PATCH] fill field status of helmrepo in response (#5152) Signed-off-by: x893675 Signed-off-by: x893675 --- pkg/models/openpitrix/types.go | 2 +- pkg/models/openpitrix/utils.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/models/openpitrix/types.go b/pkg/models/openpitrix/types.go index 31e9c2864..3ccddcb65 100644 --- a/pkg/models/openpitrix/types.go +++ b/pkg/models/openpitrix/types.go @@ -713,7 +713,7 @@ type Repo struct { // selectors Selectors RepoSelectors `json:"selectors"` - // status eg.[active|deleted] + // status eg.[successful|failed|syncing] Status string `json:"status,omitempty"` // record status changed time diff --git a/pkg/models/openpitrix/utils.go b/pkg/models/openpitrix/utils.go index ec6be1286..2a12a08a2 100644 --- a/pkg/models/openpitrix/utils.go +++ b/pkg/models/openpitrix/utils.go @@ -429,6 +429,10 @@ func convertRepo(in *v1alpha1.HelmRepo) *Repo { out.Name = in.GetTrueName() out.Status = in.Status.State + // set default status `syncing` when helmrepo not reconcile yet + if out.Status == "" { + out.Status = v1alpha1.RepoStateSyncing + } date := strfmt.DateTime(time.Unix(in.CreationTimestamp.Unix(), 0)) out.CreateTime = &date