From 92d862b17d82dd0108097058e942c2b39f718cf0 Mon Sep 17 00:00:00 2001 From: rainzm Date: Thu, 22 Oct 2020 19:33:55 +0800 Subject: [PATCH] fix(region): add suffix 'display' for time_points and repeat_weekdays TimePoints and RepeatWeekdays in SnapshotPolicyDetails is duplicated with thess in SnapshotPolicy, which result in the fault of reponse for request GET. --- pkg/apis/compute/snapshotpolicy.go | 8 ++++---- pkg/compute/models/snapshotpolicy.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/apis/compute/snapshotpolicy.go b/pkg/apis/compute/snapshotpolicy.go index 1c7b0feda6..a9790723fa 100644 --- a/pkg/apis/compute/snapshotpolicy.go +++ b/pkg/apis/compute/snapshotpolicy.go @@ -21,10 +21,10 @@ type SnapshotPolicyDetails struct { SSnapshotPolicy - RetentionDays int `json:"retention_days"` - RepeatWeekdays []int `json:"repeat_weekdays"` - TimePoints []int `json:"time_points"` - IsActivated *bool `json:"is_activated,omitempty"` + RetentionDays int `json:"retention_days"` + RepeatWeekdaysDisplay []int `json:"repeat_weekdays_display"` + TimePointsDisplay []int `json:"time_points_display"` + IsActivated *bool `json:"is_activated,omitempty"` BindingDiskCount int `json:"binding_disk_count"` } diff --git a/pkg/compute/models/snapshotpolicy.go b/pkg/compute/models/snapshotpolicy.go index 4cb03e1a1b..49afcd2e5a 100644 --- a/pkg/compute/models/snapshotpolicy.go +++ b/pkg/compute/models/snapshotpolicy.go @@ -370,8 +370,8 @@ func (sp *SSnapshotPolicy) GetExtraDetails( } func (sp *SSnapshotPolicy) getMoreDetails(out api.SnapshotPolicyDetails) api.SnapshotPolicyDetails { - out.RepeatWeekdays = SnapshotPolicyManager.RepeatWeekdaysToIntArray(sp.RepeatWeekdays) - out.TimePoints = SnapshotPolicyManager.TimePointsToIntArray(sp.TimePoints) + out.RepeatWeekdaysDisplay = SnapshotPolicyManager.RepeatWeekdaysToIntArray(sp.RepeatWeekdays) + out.TimePointsDisplay = SnapshotPolicyManager.TimePointsToIntArray(sp.TimePoints) out.BindingDiskCount, _ = SnapshotPolicyDiskManager.FetchDiskCountBySPID(sp.Id) return out }