From f6e029557b7c1deedb6f9af898247ee99213ab74 Mon Sep 17 00:00:00 2001 From: Tim Raymond Date: Wed, 9 Aug 2017 13:06:34 -0700 Subject: [PATCH] Add Prefix, Suffix, and Base to Axes We would like to add additional user-configurable options to the display of axes on Dashboards. This adds three fields to expand settings that the frontend can persist through the API. One field of interest here is the "Base" field which controls when and how axes transition the display of values such as bytes, kilobytes, megabytes, etc. By default, it's returned from the API as "10" to indicate decimal, but can be set to anything the frontend wishes--the immediate differing value will be "2" for the aforementioned use case. --- bolt/internal/internal.go | 13 ++++ bolt/internal/internal.pb.go | 130 +++++++++++++++++---------------- bolt/internal/internal.proto | 3 + bolt/internal/internal_test.go | 7 +- chronograf.go | 3 + 5 files changed, 92 insertions(+), 64 deletions(-) diff --git a/bolt/internal/internal.go b/bolt/internal/internal.go index fefa93e785..4ff5e3d62e 100644 --- a/bolt/internal/internal.go +++ b/bolt/internal/internal.go @@ -203,6 +203,9 @@ func MarshalDashboard(d chronograf.Dashboard) ([]byte, error) { axes[a] = &Axis{ Bounds: r.Bounds, Label: r.Label, + Prefix: r.Prefix, + Suffix: r.Suffix, + Base: r.Base, } } @@ -281,14 +284,24 @@ func UnmarshalDashboard(data []byte, d *chronograf.Dashboard) error { axes := make(map[string]chronograf.Axis, len(c.Axes)) for a, r := range c.Axes { + // axis base defaults to 10 + if r.Base == "" { + r.Base = "10" + } + if r.Bounds != nil { axes[a] = chronograf.Axis{ Bounds: r.Bounds, Label: r.Label, + Prefix: r.Prefix, + Suffix: r.Suffix, + Base: r.Base, } + } else { axes[a] = chronograf.Axis{ Bounds: []string{}, + Base: r.Base, } } } diff --git a/bolt/internal/internal.pb.go b/bolt/internal/internal.pb.go index 19a6c8d44e..8c9b099fc1 100644 --- a/bolt/internal/internal.pb.go +++ b/bolt/internal/internal.pb.go @@ -121,6 +121,9 @@ type Axis struct { LegacyBounds []int64 `protobuf:"varint,1,rep,name=legacyBounds" json:"legacyBounds,omitempty"` Bounds []string `protobuf:"bytes,2,rep,name=bounds" json:"bounds,omitempty"` Label string `protobuf:"bytes,3,opt,name=label,proto3" json:"label,omitempty"` + Prefix string `protobuf:"bytes,4,opt,name=prefix,proto3" json:"prefix,omitempty"` + Suffix string `protobuf:"bytes,5,opt,name=suffix,proto3" json:"suffix,omitempty"` + Base string `protobuf:"bytes,6,opt,name=base,proto3" json:"base,omitempty"` } func (m *Axis) Reset() { *m = Axis{} } @@ -323,67 +326,68 @@ func init() { func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) } var fileDescriptorInternal = []byte{ - // 985 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x56, 0xcd, 0x6e, 0x23, 0x45, - 0x10, 0x56, 0xcf, 0x8f, 0xed, 0x29, 0x67, 0x03, 0x6a, 0xad, 0xd8, 0x61, 0xb9, 0x98, 0x11, 0x48, - 0x06, 0x41, 0x40, 0xbb, 0x42, 0x42, 0xdc, 0x9c, 0x18, 0xad, 0x42, 0xb2, 0x4b, 0x68, 0x27, 0x81, - 0x0b, 0x5a, 0xb5, 0xc7, 0x95, 0x64, 0xb4, 0x63, 0xcf, 0xd0, 0x33, 0x13, 0x7b, 0xde, 0x82, 0x27, - 0x40, 0x42, 0xe2, 0xc4, 0x81, 0x03, 0x2f, 0xc0, 0x9d, 0xa7, 0x42, 0xd5, 0xdd, 0x33, 0x1e, 0xb3, - 0x59, 0xb4, 0x17, 0xf6, 0xd6, 0x5f, 0x55, 0xbb, 0xba, 0xe6, 0xab, 0xfa, 0x3e, 0x19, 0xf6, 0x93, - 0x55, 0x89, 0x6a, 0x25, 0xd3, 0x83, 0x5c, 0x65, 0x65, 0xc6, 0x07, 0x0d, 0x8e, 0xfe, 0x70, 0xa0, - 0x37, 0xcb, 0x2a, 0x15, 0x23, 0xdf, 0x07, 0xe7, 0x78, 0x1a, 0xb2, 0x11, 0x1b, 0xbb, 0xc2, 0x39, - 0x9e, 0x72, 0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0x0f, 0x6b, 0x33, 0xd5, 0x40, - 0xb4, 0x98, 0xb6, 0xec, 0xfb, 0x1b, 0x54, 0x96, 0xea, 0x40, 0x58, 0x44, 0x3b, 0x79, 0xaa, 0xcd, - 0xc4, 0x90, 0x6b, 0x00, 0xff, 0x10, 0x7c, 0x41, 0xe4, 0x69, 0x86, 0x77, 0xe6, 0xa2, 0xc3, 0xc2, - 0x64, 0xa3, 0xc7, 0xf6, 0x1a, 0x55, 0xb9, 0xc8, 0x73, 0x54, 0x56, 0x4a, 0x06, 0xe8, 0xda, 0xd9, - 0x1a, 0x8d, 0x0b, 0xba, 0xc2, 0x80, 0xe8, 0x47, 0x08, 0x26, 0x29, 0xaa, 0x52, 0x54, 0xe9, 0xcb, - 0xde, 0xc9, 0xc1, 0xfb, 0x66, 0xf6, 0xed, 0xb3, 0x46, 0x80, 0x74, 0xde, 0xca, 0xc6, 0xfd, 0x97, - 0x6c, 0x4e, 0x64, 0x2e, 0x8f, 0xa7, 0x7a, 0x9f, 0x5c, 0x61, 0x51, 0xf4, 0x31, 0x78, 0x24, 0xcf, - 0x4e, 0x65, 0xef, 0x55, 0xd2, 0x9e, 0xf7, 0xf4, 0x5f, 0xa4, 0xc7, 0xff, 0x04, 0x00, 0x00, 0xff, - 0xff, 0x5a, 0xf0, 0x92, 0xd4, 0x34, 0x09, 0x00, 0x00, + // 998 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xbc, 0x56, 0xcd, 0x8e, 0xe3, 0x44, + 0x10, 0x56, 0xc7, 0x76, 0x12, 0xd7, 0xec, 0x0e, 0xa8, 0xb5, 0x62, 0xcd, 0x72, 0x09, 0x16, 0x48, + 0x01, 0x69, 0x07, 0xb4, 0x2b, 0x24, 0xc4, 0x2d, 0x33, 0x41, 0xab, 0x61, 0x66, 0x97, 0xa1, 0x33, + 0x33, 0x9c, 0xd0, 0xaa, 0xe3, 0x54, 0x26,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 0x3a, 0xc2, 0xa2, 0xf0, 0x53, 0x70, 0x69, 0x4e, 0x3a, 0xcc, 0xee, + 0x9b, 0x66, 0x6c, 0xde, 0xd7, 0x7f, 0x78, 0x9e, 0xfe, 0x13, 0x00, 0x00, 0xff, 0xff, 0x35, 0xc8, + 0x8f, 0x51, 0x02, 0x09, 0x00, 0x00, } diff --git a/bolt/internal/internal.proto b/bolt/internal/internal.proto index b146cfd0a0..cb41ec8952 100644 --- a/bolt/internal/internal.proto +++ b/bolt/internal/internal.proto @@ -38,6 +38,9 @@ message Axis { repeated int64 legacyBounds = 1; // legacyBounds are an ordered 2-tuple consisting of lower and upper axis extents, respectively repeated string bounds = 2; // bounds are an arbitrary list of client-defined bounds. string label = 3; // label is a description of this axis + string prefix = 4; // specifies the prefix for axis values + string suffix = 5; // specifies the suffix for axis values + string base = 6; // defines the base for axis values } message Template { diff --git a/bolt/internal/internal_test.go b/bolt/internal/internal_test.go index 7a53243d2d..2759b7f0f5 100644 --- a/bolt/internal/internal_test.go +++ b/bolt/internal/internal_test.go @@ -168,6 +168,9 @@ func Test_MarshalDashboard(t *testing.T) { "y": chronograf.Axis{ Bounds: []string{"0", "3", "1-7", "foo"}, Label: "foo", + Prefix: "M", + Suffix: "m", + Base: "2", }, }, Type: "line", @@ -241,6 +244,7 @@ func Test_MarshalDashboard_WithLegacyBounds(t *testing.T) { Axes: map[string]chronograf.Axis{ "y": chronograf.Axis{ Bounds: []string{}, + Base: "10", }, }, Type: "line", @@ -260,7 +264,7 @@ func Test_MarshalDashboard_WithLegacyBounds(t *testing.T) { } } -func Test_MarshalDashboard_WithNoLegacyBounds(t *testing.T) { +func Test_MarshalDashboard_WithEmptyLegacyBounds(t *testing.T) { dashboard := chronograf.Dashboard{ ID: 1, Cells: []chronograf.DashboardCell{ @@ -314,6 +318,7 @@ func Test_MarshalDashboard_WithNoLegacyBounds(t *testing.T) { Axes: map[string]chronograf.Axis{ "y": chronograf.Axis{ Bounds: []string{}, + Base: "10", }, }, Type: "line", diff --git a/chronograf.go b/chronograf.go index 535adfe1e1..3affae80a6 100644 --- a/chronograf.go +++ b/chronograf.go @@ -644,6 +644,9 @@ type Axis struct { Bounds []string `json:"bounds"` // bounds are an arbitrary list of client-defined strings that specify the viewport for a cell LegacyBounds [2]int64 `json:"-"` // legacy bounds are for testing a migration from an earlier version of axis Label string `json:"label"` // label is a description of this Axis + Prefix string `json:"prefix"` // specifies a prefix for axis values + Suffix string `json:"suffix"` // specifies a suffix for axis values + Base string `json:"base"` // defines the base for axis values } // DashboardCell holds visual and query information for a cell