diff --git a/pkg/keyvisual/matrix/axis.go b/pkg/keyvisual/matrix/axis.go index 4f5f134fa7..379ea97fc7 100644 --- a/pkg/keyvisual/matrix/axis.go +++ b/pkg/keyvisual/matrix/axis.go @@ -182,7 +182,7 @@ func (c *chunk) Reduce(newKeys []string) chunk { endKeys := newKeys[1:] j := 0 for i, value := range c.Values { - if equal(keys[i], endKeys[j]) { + if i > 0 && equal(keys[i], endKeys[j]) { j++ } newValues[j] += value diff --git a/pkg/keyvisual/matrix/axis_test.go b/pkg/keyvisual/matrix/axis_test.go index b4dfc4714f..ae3e994516 100644 --- a/pkg/keyvisual/matrix/axis_test.go +++ b/pkg/keyvisual/matrix/axis_test.go @@ -20,3 +20,31 @@ import ( var _ = Suite(&testAxisSuite{}) type testAxisSuite struct{} + +func (s *testAxisSuite) TestChunkReduce(c *C) { + testcases := []struct { + keys []string + values []uint64 + newKeys []string + newValues []uint64 + }{ + { + []string{"", "a", "b", "c", ""}, + []uint64{1, 10, 100, 1000}, + []string{"", "b", ""}, + []uint64{11, 1100}, + }, + { + []string{"", "a", "b", "c", ""}, + []uint64{1, 10, 100, 1000}, + []string{"", ""}, + []uint64{1111}, + }, + } + + for _, testcase := range testcases { + originChunk := createChunk(testcase.keys, testcase.values) + reduceChunk := originChunk.Reduce(testcase.newKeys) + c.Assert(reduceChunk.Values, DeepEquals, testcase.newValues) + } +} diff --git a/release-version b/release-version index 1bf7f6b34e..3809da7b70 100644 --- a/release-version +++ b/release-version @@ -1,3 +1,3 @@ # This file specifies the TiDB Dashboard internal version, which will be printed in `--version` # and UI. In release branch, changing this file will result in publishing a new version and tag. -2020.09.21.1 +2020.10.21.1 diff --git a/ui/dashboardApp/index.ts b/ui/dashboardApp/index.ts index 251697dff9..cd9bd6fcd9 100644 --- a/ui/dashboardApp/index.ts +++ b/ui/dashboardApp/index.ts @@ -56,7 +56,7 @@ async function main() { } catch (e) { Modal.error({ title: 'Failed to connect to TiDB Dashboard server', - content: e.stack, + content: '' + e, okText: 'Reload', onOk: () => window.location.reload(), })