You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/09/24 06:37:38 UTC
[skywalking-cli] branch master updated: Fix two bugs of dashboard
(#64)
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-cli.git
The following commit(s) were added to refs/heads/master by this push:
new 0a88a7a Fix two bugs of dashboard (#64)
0a88a7a is described below
commit 0a88a7a83454221d830e0a9fbb90622933239de9
Author: Hoshea Jiang <fg...@gmail.com>
AuthorDate: Thu Sep 24 14:37:28 2020 +0800
Fix two bugs of dashboard (#64)
1. Index out of range
1. Order of buttons
---
display/graph/dashboard/global.go | 5 +++--
display/graph/gauge/gauge.go | 5 +++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/display/graph/dashboard/global.go b/display/graph/dashboard/global.go
index d28f3a7..c954ce0 100644
--- a/display/graph/dashboard/global.go
+++ b/display/graph/dashboard/global.go
@@ -106,7 +106,7 @@ func setLayout(c *container.Container, lt layoutType) error {
// newLayoutButtons returns buttons that dynamically switch the layouts.
func newLayoutButtons(c *container.Container) ([]*button.Button, error) {
- var buttons []*button.Button
+ buttons := make([]*button.Button, len(strToLayoutType))
opts := []button.Option{
button.WidthFor(longestString(template.Buttons.Texts)),
@@ -127,7 +127,8 @@ func newLayoutButtons(c *container.Container) ([]*button.Button, error) {
if err != nil {
return nil, err
}
- buttons = append(buttons, b)
+
+ buttons[int(lt)] = b
}
return buttons, nil
diff --git a/display/graph/gauge/gauge.go b/display/graph/gauge/gauge.go
index c7571ee..a99234d 100644
--- a/display/graph/gauge/gauge.go
+++ b/display/graph/gauge/gauge.go
@@ -52,6 +52,11 @@ type MetricColumn struct {
// Update updates the MetricColumn's `Absolute` and `BorderTitle`.
func (mc *MetricColumn) Update(data []*schema.SelectedRecord) error {
for i, item := range data {
+ // The number of `SelectedRecord` data may exceed the number of gauges in a `MetricColumn`.
+ if i >= len(mc.gauges) {
+ break
+ }
+
strValue := *(item.Value)
v, err := strconv.Atoi(strValue)
if err != nil {