diff --git a/conf/cmp/i18n/cp/scenarios/cmp-dashboard-nodes.yaml b/conf/cmp/i18n/cp/scenarios/cmp-dashboard-nodes.yaml index 2519f15732e..1ff8fb8dee3 100644 --- a/conf/cmp/i18n/cp/scenarios/cmp-dashboard-nodes.yaml +++ b/conf/cmp/i18n/cp/scenarios/cmp-dashboard-nodes.yaml @@ -109,6 +109,7 @@ zh: Low: 低 Middle: 中 High: 高 + None: 无 en: role: Role diff --git a/modules/cmp/component-protocol/components/cmp-dashboard-nodes/common/table/table.go b/modules/cmp/component-protocol/components/cmp-dashboard-nodes/common/table/table.go index 101505b6609..9fae95b0bf3 100644 --- a/modules/cmp/component-protocol/components/cmp-dashboard-nodes/common/table/table.go +++ b/modules/cmp/component-protocol/components/cmp-dashboard-nodes/common/table/table.go @@ -318,8 +318,15 @@ func (t *Table) GetDistributionValue(req, total float64, resourceType TableType) } func (t *Table) GetDistributionRate(allocate, request float64, resourceType TableType) DistributionRate { + if request == 0 { + return DistributionRate{RenderType: "text", Value: t.SDK.I18n("None")} + } rate := allocate / request - rate, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", rate), 64) + rate, err := strconv.ParseFloat(fmt.Sprintf("%.2f", rate), 64) + if err != nil { + logrus.Error(err) + return DistributionRate{RenderType: "text", Value: t.SDK.I18n("None")} + } if rate <= 0.4 { return DistributionRate{RenderType: "text", Value: t.SDK.I18n("Low"), DistributionValue: rate} } else if rate <= 0.8 { diff --git a/modules/cmp/component-protocol/components/cmp-dashboard-nodes/memTable/render.go b/modules/cmp/component-protocol/components/cmp-dashboard-nodes/memTable/render.go index 381bd4388e8..caf26083834 100644 --- a/modules/cmp/component-protocol/components/cmp-dashboard-nodes/memTable/render.go +++ b/modules/cmp/component-protocol/components/cmp-dashboard-nodes/memTable/render.go @@ -141,7 +141,7 @@ func (mt *MemInfoTable) GetProps() map[string]interface{} { {DataIndex: "IP", Title: mt.SDK.I18n("ip"), Sortable: true}, {DataIndex: "Role", Title: "Role", Sortable: true}, {DataIndex: "Version", Title: mt.SDK.I18n("version"), Sortable: true}, - {DataIndex: "Operate", Title: mt.SDK.I18n("podsList"), Fixed: "right"}, + {DataIndex: "Operate", Title: mt.SDK.I18n("operate"), Fixed: "right"}, }, "selectable": true, "pageSizeOptions": []string{"10", "20", "50", "100"}, diff --git a/modules/cmp/metrics/metrics.go b/modules/cmp/metrics/metrics.go index e51e042df5b..c331e6ce5b5 100644 --- a/modules/cmp/metrics/metrics.go +++ b/modules/cmp/metrics/metrics.go @@ -216,6 +216,7 @@ func (m *Metric) Store(response *pb.QueryWithInfluxFormatResponse, metricsReques d = &MetricsData{ Used: row.Values[2].GetNumberValue(), } + logrus.Info(k, "=====", d.Used) SetCache(k, d) res[k] = d }