From d0c21430599ab04fb70b8dc796db87d618072caf Mon Sep 17 00:00:00 2001 From: powerfool Date: Tue, 7 May 2024 12:01:46 +0800 Subject: [PATCH] Fix: Used topo info in status instead of spec (#351) --- .../dashboard/business/oceanbase/obtenant.go | 6 +++--- internal/dashboard/generated/swagger/docs.go | 16 +++++----------- .../dashboard/generated/swagger/swagger.json | 16 +++++----------- .../dashboard/generated/swagger/swagger.yaml | 14 +++++--------- internal/dashboard/handler/obtenant_handler.go | 2 +- 5 files changed, 19 insertions(+), 35 deletions(-) diff --git a/internal/dashboard/business/oceanbase/obtenant.go b/internal/dashboard/business/oceanbase/obtenant.go index 3a4f26cb3..3b1a0a97c 100644 --- a/internal/dashboard/business/oceanbase/obtenant.go +++ b/internal/dashboard/business/oceanbase/obtenant.go @@ -174,10 +174,10 @@ func buildOverviewFromApiType(t *v1alpha1.OBTenant) *response.OBTenantOverview { rt.Locality = t.Status.TenantRecordInfo.Locality rt.PrimaryZone = t.Status.TenantRecordInfo.PrimaryZone - for i := range t.Spec.Pools { - pool := t.Spec.Pools[i] + for i := range t.Status.Pools { + pool := t.Status.Pools[i] replica := response.OBTenantReplica{ - Zone: pool.Zone, + Zone: pool.ZoneList, Priority: pool.Priority, Type: pool.Type.Name, } diff --git a/internal/dashboard/generated/swagger/docs.go b/internal/dashboard/generated/swagger/docs.go index e3eafe75c..35062891d 100644 --- a/internal/dashboard/generated/swagger/docs.go +++ b/internal/dashboard/generated/swagger/docs.go @@ -3302,7 +3302,7 @@ const docTemplate = `{ { "enum": [ "FULL", - "INCR", + "INC", "CLEAN", "ARCHIVE" ], @@ -4560,11 +4560,8 @@ const docTemplate = `{ "endTime": { "type": "integer" }, - "instances": { - "type": "array", - "items": { - "$ref": "#/definitions/oceanbase.OBInstance" - } + "instance": { + "$ref": "#/definitions/oceanbase.OBInstance" }, "keyword": { "type": "string" @@ -7226,11 +7223,8 @@ const docTemplate = `{ "silence.SilencerFilter": { "type": "object", "properties": { - "instances": { - "type": "array", - "items": { - "$ref": "#/definitions/oceanbase.OBInstance" - } + "instance": { + "$ref": "#/definitions/oceanbase.OBInstance" }, "keyword": { "type": "string" diff --git a/internal/dashboard/generated/swagger/swagger.json b/internal/dashboard/generated/swagger/swagger.json index 0a903b421..930402435 100644 --- a/internal/dashboard/generated/swagger/swagger.json +++ b/internal/dashboard/generated/swagger/swagger.json @@ -3295,7 +3295,7 @@ { "enum": [ "FULL", - "INCR", + "INC", "CLEAN", "ARCHIVE" ], @@ -4553,11 +4553,8 @@ "endTime": { "type": "integer" }, - "instances": { - "type": "array", - "items": { - "$ref": "#/definitions/oceanbase.OBInstance" - } + "instance": { + "$ref": "#/definitions/oceanbase.OBInstance" }, "keyword": { "type": "string" @@ -7219,11 +7216,8 @@ "silence.SilencerFilter": { "type": "object", "properties": { - "instances": { - "type": "array", - "items": { - "$ref": "#/definitions/oceanbase.OBInstance" - } + "instance": { + "$ref": "#/definitions/oceanbase.OBInstance" }, "keyword": { "type": "string" diff --git a/internal/dashboard/generated/swagger/swagger.yaml b/internal/dashboard/generated/swagger/swagger.yaml index 31e5d03d4..b6ee6c30a 100644 --- a/internal/dashboard/generated/swagger/swagger.yaml +++ b/internal/dashboard/generated/swagger/swagger.yaml @@ -63,10 +63,8 @@ definitions: properties: endTime: type: integer - instances: - items: - $ref: '#/definitions/oceanbase.OBInstance' - type: array + instance: + $ref: '#/definitions/oceanbase.OBInstance' keyword: type: string serverity: @@ -1926,10 +1924,8 @@ definitions: - TypeCustomized silence.SilencerFilter: properties: - instances: - items: - $ref: '#/definitions/oceanbase.OBInstance' - type: array + instance: + $ref: '#/definitions/oceanbase.OBInstance' keyword: type: string type: object @@ -3998,7 +3994,7 @@ paths: - description: backup job type enum: - FULL - - INCR + - INC - CLEAN - ARCHIVE in: path diff --git a/internal/dashboard/handler/obtenant_handler.go b/internal/dashboard/handler/obtenant_handler.go index 601389a69..20d9c165a 100644 --- a/internal/dashboard/handler/obtenant_handler.go +++ b/internal/dashboard/handler/obtenant_handler.go @@ -566,7 +566,7 @@ func GetBackupPolicy(c *gin.Context) (*response.BackupPolicy, error) { // @Failure 500 object response.APIResponse // @Param namespace path string true "obtenant namespace" // @Param name path string true "obtenant name" -// @Param type path string true "backup job type" Enums(FULL,INCR,CLEAN,ARCHIVE) +// @Param type path string true "backup job type" Enums(FULL,INC,CLEAN,ARCHIVE) // @Param limit query int false "limit" default(10) // @Router /api/v1/obtenants/{namespace}/{name}/backup/{type}/jobs [GET] // @Security ApiKeyAuth