From cb80c8a5361820f46bd4711221145bde02312eab Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Thu, 15 Mar 2018 17:35:59 -0700 Subject: [PATCH 01/38] add visible to TableColumn in backend and fix tests accordingly --- bolt/internal/internal.go | 4 + bolt/internal/internal.pb.go | 208 ++++++++++++++++++----------------- bolt/internal/internal.proto | 1 + chronograf.go | 1 + integrations/server_test.go | 7 +- server/cells_test.go | 2 +- 6 files changed, 120 insertions(+), 103 deletions(-) diff --git a/bolt/internal/internal.go b/bolt/internal/internal.go index 2c26c8a2d7..2539443fd4 100644 --- a/bolt/internal/internal.go +++ b/bolt/internal/internal.go @@ -268,6 +268,7 @@ func MarshalDashboard(d chronograf.Dashboard) ([]byte, error) { sortBy := &TableColumn{ InternalName: c.TableOptions.SortBy.InternalName, DisplayName: c.TableOptions.SortBy.DisplayName, + Visible: c.TableOptions.SortBy.Visible, } columnNames := make([]*TableColumn, len(c.TableOptions.ColumnNames)) @@ -275,6 +276,7 @@ func MarshalDashboard(d chronograf.Dashboard) ([]byte, error) { columnNames[i] = &TableColumn{ InternalName: column.InternalName, DisplayName: column.DisplayName, + Visible: column.Visible, } } @@ -435,6 +437,7 @@ func UnmarshalDashboard(data []byte, d *chronograf.Dashboard) error { if c.TableOptions.SortBy != nil { sortBy.InternalName = c.TableOptions.SortBy.InternalName sortBy.DisplayName = c.TableOptions.SortBy.DisplayName + sortBy.Visible = c.TableOptions.SortBy.Visible } tableOptions.SortBy = sortBy @@ -443,6 +446,7 @@ func UnmarshalDashboard(data []byte, d *chronograf.Dashboard) error { columnNames[i] = chronograf.TableColumn{} columnNames[i].InternalName = column.InternalName columnNames[i].DisplayName = column.DisplayName + columnNames[i].Visible = column.Visible } tableOptions.ColumnNames = columnNames tableOptions.TimeFormat = c.TableOptions.TimeFormat diff --git a/bolt/internal/internal.pb.go b/bolt/internal/internal.pb.go index 478a3c9947..d3547db61e 100644 --- a/bolt/internal/internal.pb.go +++ b/bolt/internal/internal.pb.go @@ -374,6 +374,7 @@ func (m *TableOptions) GetFixFirstColumn() bool { type TableColumn struct { InternalName string `protobuf:"bytes,1,opt,name=internalName,proto3" json:"internalName,omitempty"` DisplayName string `protobuf:"bytes,2,opt,name=displayName,proto3" json:"displayName,omitempty"` + Visible bool `protobuf:"varint,3,opt,name=visible,proto3" json:"visible,omitempty"` } func (m *TableColumn) Reset() { *m = TableColumn{} } @@ -395,6 +396,13 @@ func (m *TableColumn) GetDisplayName() string { return "" } +func (m *TableColumn) GetVisible() bool { + if m != nil { + return m.Visible + } + return false +} + type Color struct { ID string `protobuf:"bytes,1,opt,name=ID,proto3" json:"ID,omitempty"` Type string `protobuf:"bytes,2,opt,name=Type,proto3" json:"Type,omitempty"` @@ -1322,104 +1330,104 @@ func init() { func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) } var fileDescriptorInternal = []byte{ - // 1573 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x5f, 0x8f, 0xdb, 0x44, - 0x10, 0x97, 0x93, 0x38, 0x89, 0x27, 0xd7, 0xe3, 0x64, 0x8e, 0xd6, 0x14, 0x09, 0x05, 0x8b, 0x3f, - 0xe1, 0x4f, 0x0f, 0x94, 0x0a, 0x81, 0x2a, 0xa8, 0x94, 0xbb, 0xd0, 0x72, 0xf4, 0xda, 0xbb, 0x6e, - 0xee, 0x8e, 0x27, 0x54, 0x6d, 0x92, 0x4d, 0x62, 0xd5, 0xb1, 0xcd, 0x7a, 0x7d, 0x17, 0xf3, 0x01, - 0xf8, 0x18, 0x48, 0x48, 0xf0, 0x05, 0x10, 0x2f, 0x3c, 0xf1, 0xce, 0x07, 0xe1, 0x2b, 0xc0, 0x23, - 0x9a, 0xdd, 0xb5, 0xb3, 0xb9, 0xa4, 0x55, 0x91, 0x10, 0x6f, 0xfb, 0x9b, 0x19, 0xcf, 0xce, 0xce, - 0xcc, 0x6f, 0x76, 0x0d, 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xfc, 0x80, 0xb0, 0x97, 0x0f, 0x88, 0x5d, 0xb0, 0x07, 0x7c, - 0x74, 0xd8, 0x97, 0x11, 0x55, 0x89, 0x02, 0xd8, 0x8d, 0xbd, 0x91, 0x08, 0x2e, 0x98, 0x7e, 0x55, - 0x68, 0xb4, 0x76, 0xff, 0x35, 0x37, 0x5c, 0xe5, 0xff, 0xf2, 0x71, 0xe1, 0xff, 0x60, 0x41, 0xfd, - 0x88, 0xe6, 0x71, 0x26, 0xd6, 0xba, 0xb6, 0x0d, 0xad, 0x5e, 0x92, 0x84, 0xc1, 0x68, 0x85, 0xa9, - 0x86, 0x08, 0x2d, 0x1e, 0x1a, 0xf5, 0x50, 0xb9, 0x30, 0x45, 0x38, 0xfc, 0x0f, 0xe4, 0x9b, 0x40, - 0x5d, 0xf0, 0xc6, 0xf0, 0x57, 0x4f, 0x01, 0xa9, 0xc4, 0xa4, 0xf5, 0x32, 0x11, 0x4f, 0xc2, 0xf8, - 0x52, 0x66, 0xa7, 0x49, 0x4a, 0xec, 0xff, 0x51, 0x81, 0xda, 0xff, 0x75, 0x8f, 0x6f, 0x81, 0x15, - 0xe8, 0xe6, 0xb0, 0x82, 0xf2, 0x56, 0x6f, 0x18, 0xb7, 0xba, 0x07, 0x8d, 0x9c, 0xd3, 0x68, 0xca, - 0x52, 0xaf, 0x29, 0xa7, 0x51, 0x01, 0xa5, 0x46, 0xf2, 0x4e, 0x5d, 0xe7, 0x0e, 0x29, 0x60, 0xc9, - 0x23, 0x30, 0x78, 0xf4, 0x81, 0xbe, 0xf9, 0x5b, 0x32, 0x22, 0x6f, 0x35, 0x2d, 0x57, 0x2f, 0xfc, - 0xff, 0xee, 0x86, 0xfd, 0xcb, 0x02, 0xbb, 0x24, 0xe1, 0xc1, 0x2a, 0x09, 0x0f, 0x96, 0x24, 0xec, - 0xef, 0x17, 0x24, 0xec, 0xef, 0x23, 0x26, 0x27, 0x05, 0x09, 0xc9, 0x09, 0x16, 0xeb, 0x3e, 0x8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, 0xc4, 0x7e, 0x5e, - 0x7e, 0xd7, 0x0f, 0x00, 0x00, + // 1582 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x8e, 0xdb, 0x44, + 0x14, 0x96, 0x93, 0x38, 0x89, 0x4f, 0xb6, 0xcb, 0xca, 0x2c, 0xad, 0x29, 0x12, 0x0a, 0x16, 0x3f, + 0xe1, 0xa7, 0x0b, 0x4a, 0x85, 0x40, 0x15, 0x54, 0xca, 0x6e, 0x68, 0x59, 0xba, 0xed, 0x6e, 0x27, + 0xbb, 0xcb, 0x15, 0xaa, 0x26, 0xc9, 0x24, 0xb1, 0xea, 0xd8, 0x66, 0x6c, 0xef, 0xc6, 0x3c, 0x00, + 0x8f, 0x81, 0x84, 0x04, 0x2f, 0x80, 0xb8, 0xe1, 0x8a, 0x7b, 0x1e, 0x84, 0x57, 0x80, 0x4b, 0x74, + 0xe6, 0xc7, 0x99, 0x6c, 0xd2, 0xaa, 0x48, 0x88, 0xbb, 0xf9, 0xce, 0x39, 0x3e, 0x73, 0xfe, 0xcf, + 0x18, 0xb6, 0x83, 0x28, 0x63, 0x3c, 0xa2, 0xe1, 0x5e, 0xc2, 0xe3, 0x2c, 0x76, 0x9b, 0x1a, 0xfb, + 0x7f, 0x56, 0xa0, 0x3e, 0x88, 0x73, 0x3e, 0x62, 0xee, 0x36, 0x54, 0x0e, 0xfb, 0x9e, 0xd5, 0xb6, + 0x3a, 0x55, 0x52, 0x39, 0xec, 0xbb, 0x2e, 0xd4, 0x1e, 0xd1, 0x39, 0xf3, 0x2a, 0x6d, 0xab, 0xe3, + 0x10, 0x71, 0x46, 0xda, 0x69, 0x91, 0x30, 0xaf, 0x2a, 0x69, 0x78, 0x76, 0x6f, 0x42, 0xf3, 0x2c, + 0x45, 0x6d, 0x73, 0xe6, 0xd5, 0x04, 0xbd, 0xc4, 0xc8, 0x3b, 0xa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xaf, 0xbb, 0xe2, 0xff, 0x56, 0x85, 0x6b, 0x2b, 0xd7, 0xb9, 0x5b, 0x60, 0x2d, 0x84, + 0xe5, 0x36, 0xb1, 0x16, 0x88, 0x0a, 0x61, 0xb5, 0x4d, 0xac, 0x02, 0xd1, 0xa5, 0xa8, 0x0d, 0x9b, + 0x58, 0x97, 0x88, 0x66, 0xa2, 0x22, 0x6c, 0x62, 0xcd, 0xdc, 0x77, 0xa1, 0xf1, 0x6d, 0xce, 0x78, + 0xc0, 0x52, 0xcf, 0x16, 0xd6, 0xbd, 0xb4, 0xb4, 0xee, 0x71, 0xce, 0x78, 0x41, 0x34, 0x1f, 0xa3, + 0x21, 0xaa, 0x49, 0x96, 0x86, 0x38, 0x23, 0x2d, 0xc3, 0xca, 0x6b, 0x48, 0x1a, 0x9e, 0x55, 0x14, + 0x65, 0x3d, 0x60, 0x14, 0x3f, 0x86, 0x1a, 0x5d, 0xb0, 0xd4, 0x73, 0x84, 0xfe, 0x37, 0x9e, 0x11, + 0xb0, 0xbd, 0xde, 0x82, 0xa5, 0x5f, 0x44, 0x19, 0x2f, 0x88, 0x10, 0x77, 0xdf, 0x81, 0xfa, 0x28, + 0x0e, 0x63, 0x9e, 0x7a, 0x70, 0xd5, 0xb0, 0x03, 0xa4, 0x13, 0xc5, 0x76, 0x3b, 0x50, 0x0f, 0xd9, + 0x94, 0x45, 0x63, 0x51, 0x19, 0xad, 0xee, 0xce, 0x52, 0xf0, 0x48, 0xd0, 0x89, 0xe2, 0xbb, 0x77, + 0x60, 0x2b, 0xa3, 0xc3, 0x90, 0x1d, 0x27, 0x18, 0xc5, 0x54, 0x54, 0x49, 0xab, 0x7b, 0xdd, 0xc8, + 0x87, 0xc1, 0x25, 0x2b, 0xb2, 0x37, 0xef, 0x83, 0x53, 0x5a, 0x88, 0x4d, 0xf2, 0x94, 0x15, 0x22, + 0xde, 0x0e, 0xc1, 0xa3, 0xfb, 0x26, 0xd8, 0x17, 0x34, 0xcc, 0x65, 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 0x57, 0xcb, 0xac, 0xdc, + 0x2f, 0xa3, 0xb0, 0x91, 0xa7, 0x22, 0x5a, 0x2b, 0x93, 0xf5, 0x22, 0xff, 0x29, 0xa7, 0xab, 0x32, + 0x9b, 0x12, 0xbe, 0x96, 0x95, 0x36, 0xb4, 0xd4, 0xff, 0xa5, 0xf8, 0x5b, 0x53, 0x43, 0xd5, 0x20, + 0xf9, 0x5d, 0xa8, 0x1f, 0xc4, 0xd1, 0x24, 0x98, 0xba, 0x1d, 0xa8, 0xf5, 0xf2, 0x6c, 0x26, 0x34, + 0xb6, 0xba, 0xbb, 0x46, 0xe3, 0xe7, 0xd9, 0x4c, 0xca, 0x10, 0x21, 0xe1, 0x7f, 0x06, 0xb0, 0xa4, + 0xe1, 0x96, 0x58, 0x66, 0xe3, 0x11, 0xbb, 0xc4, 0x92, 0x49, 0x85, 0x96, 0x26, 0xd9, 0xc0, 0xf1, + 0x3f, 0x07, 0x67, 0x3f, 0x0f, 0xc2, 0xf1, 0x61, 0x34, 0x89, 0x71, 0x74, 0x9c, 0x33, 0x9e, 0x2e, + 0xf3, 0xa5, 0x21, 0x86, 0x1b, 0xa7, 0x48, 0xd9, 0x43, 0x0a, 0x0d, 0xeb, 0xe2, 0xff, 0xfe, 0xf6, + 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf4, 0xe4, 0x20, 0x8a, 0xf1, 0x0f, 0x00, 0x00, } diff --git a/bolt/internal/internal.proto b/bolt/internal/internal.proto index 201fd5d628..86e8f30dea 100644 --- a/bolt/internal/internal.proto +++ b/bolt/internal/internal.proto @@ -52,6 +52,7 @@ message TableOptions { message TableColumn { string internalName = 1; // name of column string displayName = 2; // what column is renamed to + bool visible = 3; // Represents whether TableColumn is visible } message Color { diff --git a/chronograf.go b/chronograf.go index e9de4b32d0..a1b2a205c8 100644 --- a/chronograf.go +++ b/chronograf.go @@ -564,6 +564,7 @@ type DashboardCell struct { type TableColumn struct { InternalName string `json:"internalName"` DisplayName string `json:"displayName"` + Visible bool `json:"visible"` } // TableOptions is a type of options for a DashboardCell with type Table diff --git a/integrations/server_test.go b/integrations/server_test.go index 93381dea44..8077258960 100644 --- a/integrations/server_test.go +++ b/integrations/server_test.go @@ -548,7 +548,9 @@ func TestServer(t *testing.T) { "verticalTimeAxis": false, "sortBy":{ "internalName": "", - "displayName": ""}, + "displayName": "", + "visible": false + }, "wrapping": "", "columnNames": null, "fixFirstColumn": false @@ -797,7 +799,8 @@ func TestServer(t *testing.T) { "verticalTimeAxis":false, "sortBy":{ "internalName":"", - "displayName":"" + "displayName":"", + "visible":false }, "wrapping":"", "columnNames":null, diff --git a/server/cells_test.go b/server/cells_test.go index a74f914c7b..a526fb3ac8 100644 --- a/server/cells_test.go +++ b/server/cells_test.go @@ -532,7 +532,7 @@ func TestService_ReplaceDashboardCell(t *testing.T) { } } `))), - want: `{"i":"3c5c4102-fa40-4585-a8f9-917c77e37192","x":0,"y":0,"w":4,"h":4,"name":"Untitled Cell","queries":[{"query":"SELECT mean(\"usage_user\") AS \"mean_usage_user\" FROM \"telegraf\".\"autogen\".\"cpu\" WHERE time \u003e :dashboardTime: AND \"cpu\"=:cpu: GROUP BY :interval: FILL(null)","queryConfig":{"id":"3cd3eaa4-a4b8-44b3-b69e-0c7bf6b91d9e","database":"telegraf","measurement":"cpu","retentionPolicy":"autogen","fields":[{"value":"mean","type":"func","alias":"mean_usage_user","args":[{"value":"usage_user","type":"field","alias":""}]}],"tags":{"cpu":["ChristohersMBP2.lan"]},"groupBy":{"time":"2s","tags":[]},"areTagsAccepted":true,"fill":"null","rawText":"SELECT mean(\"usage_user\") AS \"mean_usage_user\" FROM \"telegraf\".\"autogen\".\"cpu\" WHERE time \u003e :dashboardTime: AND \"cpu\"=:cpu: GROUP BY :interval: FILL(null)","range":{"upper":"","lower":"now() - 15m"},"shifts":[]},"source":""}],"axes":{"x":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""},"y":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""},"y2":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""}},"type":"line","colors":[{"id":"0","type":"min","hex":"#00C9FF","name":"laser","value":"0"},{"id":"1","type":"max","hex":"#9394FF","name":"comet","value":"100"}],"legend":{},"tableOptions":{"timeFormat":"","verticalTimeAxis":false,"sortBy":{"internalName":"","displayName":""},"wrapping":"","columnNames":null,"fixFirstColumn":false},"links":{"self":"/chronograf/v1/dashboards/1/cells/3c5c4102-fa40-4585-a8f9-917c77e37192"}} + want: `{"i":"3c5c4102-fa40-4585-a8f9-917c77e37192","x":0,"y":0,"w":4,"h":4,"name":"Untitled Cell","queries":[{"query":"SELECT mean(\"usage_user\") AS \"mean_usage_user\" FROM \"telegraf\".\"autogen\".\"cpu\" WHERE time \u003e :dashboardTime: AND \"cpu\"=:cpu: GROUP BY :interval: FILL(null)","queryConfig":{"id":"3cd3eaa4-a4b8-44b3-b69e-0c7bf6b91d9e","database":"telegraf","measurement":"cpu","retentionPolicy":"autogen","fields":[{"value":"mean","type":"func","alias":"mean_usage_user","args":[{"value":"usage_user","type":"field","alias":""}]}],"tags":{"cpu":["ChristohersMBP2.lan"]},"groupBy":{"time":"2s","tags":[]},"areTagsAccepted":true,"fill":"null","rawText":"SELECT mean(\"usage_user\") AS \"mean_usage_user\" FROM \"telegraf\".\"autogen\".\"cpu\" WHERE time \u003e :dashboardTime: AND \"cpu\"=:cpu: GROUP BY :interval: FILL(null)","range":{"upper":"","lower":"now() - 15m"},"shifts":[]},"source":""}],"axes":{"x":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""},"y":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""},"y2":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""}},"type":"line","colors":[{"id":"0","type":"min","hex":"#00C9FF","name":"laser","value":"0"},{"id":"1","type":"max","hex":"#9394FF","name":"comet","value":"100"}],"legend":{},"tableOptions":{"timeFormat":"","verticalTimeAxis":false,"sortBy":{"internalName":"","displayName":"","visible":false},"wrapping":"","columnNames":null,"fixFirstColumn":false},"links":{"self":"/chronograf/v1/dashboards/1/cells/3c5c4102-fa40-4585-a8f9-917c77e37192"}} `, }, { From d23eb9337b918ce4042adee78f90d4673d17dbf5 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Thu, 15 Mar 2018 17:56:49 -0700 Subject: [PATCH 02/38] introduce visible as prop to CustomizableColumns and remove duplicate constants --- .../GraphOptionsCustomizableColumn.tsx | 23 +++++++++++++++---- .../GraphOptionsCustomizeColumns.tsx | 2 ++ .../dashboards/reducers/cellEditorOverlay.js | 2 ++ ui/src/shared/constants/tableGraph.js | 6 ++++- ui/src/shared/constants/thresholds.js | 12 ---------- 5 files changed, 27 insertions(+), 18 deletions(-) diff --git a/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx b/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx index cfed2453a6..71e96ec647 100644 --- a/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx +++ b/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx @@ -5,11 +5,13 @@ import InputClickToEdit from 'src/shared/components/InputClickToEdit' type Column = { internalName: string displayName: string + visible: boolean } interface Props { internalName: string displayName: string + visible: boolean onColumnRename: (column: Column) => void } @@ -18,19 +20,30 @@ class GraphOptionsCustomizableColumn extends PureComponent { super(props) this.handleColumnRename = this.handleColumnRename.bind(this) + this.handleToggleVisible = this.handleToggleVisible.bind(this) } - handleColumnRename(rename) { - const {onColumnRename, internalName} = this.props - onColumnRename({internalName, displayName: rename}) + handleColumnRename(rename: string) { + const {onColumnRename, internalName, visible} = this.props + onColumnRename({internalName, displayName: rename, visible}) + } + + handleToggleVisible() { + const {onColumnRename, internalName, displayName, visible} = this.props + onColumnRename({internalName, displayName, visible: !visible}) } render() { - const {internalName, displayName} = this.props + const {internalName, displayName, visible} = this.props + console.log('VISIBLE:', visible) return (
-
+
+ {internalName}
= ({ key={uuid.v4()} internalName={col.internalName} displayName={col.displayName} + visible={col.visible} onColumnRename={onColumnRename} /> ) diff --git a/ui/src/dashboards/reducers/cellEditorOverlay.js b/ui/src/dashboards/reducers/cellEditorOverlay.js index 4629e89750..402f488f64 100644 --- a/ui/src/dashboards/reducers/cellEditorOverlay.js +++ b/ui/src/dashboards/reducers/cellEditorOverlay.js @@ -11,6 +11,8 @@ import { import {initializeOptions} from 'src/dashboards/constants/cellEditor' +import {initializeOptions} from 'src/shared/constants/tableGraph' + export const initialState = { cell: null, thresholdsListType: THRESHOLD_TYPE_TEXT, diff --git a/ui/src/shared/constants/tableGraph.js b/ui/src/shared/constants/tableGraph.js index 2f3c9d9444..83b439412c 100644 --- a/ui/src/shared/constants/tableGraph.js +++ b/ui/src/shared/constants/tableGraph.js @@ -6,7 +6,11 @@ export const NULL_HOVER_TIME = '0' export const TIME_FORMAT_DEFAULT = 'MM/DD/YYYY HH:mm:ss.ss' export const TIME_FORMAT_CUSTOM = 'Custom' -export const TIME_COLUMN_DEFAULT = {internalName: 'time', displayName: ''} +export const TIME_COLUMN_DEFAULT = { + internalName: 'time', + displayName: '', + visible: true, +} export const FIX_FIRST_COLUMN_DEFAULT = true diff --git a/ui/src/shared/constants/thresholds.js b/ui/src/shared/constants/thresholds.js index 9941bef092..05409fe2eb 100644 --- a/ui/src/shared/constants/thresholds.js +++ b/ui/src/shared/constants/thresholds.js @@ -13,8 +13,6 @@ export const THRESHOLD_TYPE_TEXT = 'text' export const THRESHOLD_TYPE_BG = 'background' export const THRESHOLD_TYPE_BASE = 'base' -export const TIME_FORMAT_DEFAULT = 'MM/DD/YYYY HH:mm:ss.ss' - export const THRESHOLD_COLORS = [ { hex: '#BF3D5E', @@ -121,16 +119,6 @@ export const DEFAULT_THRESHOLDS_LIST_COLORS = [ }, ] -export const DEFAULT_TABLE_COLORS = [ - { - type: THRESHOLD_TYPE_BG, - hex: THRESHOLD_COLORS[18].hex, - id: THRESHOLD_TYPE_BASE, - name: THRESHOLD_COLORS[18].name, - value: 0, - }, -] - export const validateThresholdsListColors = (colors, type) => { if (!colors || colors.length === 0) { return DEFAULT_THRESHOLDS_LIST_COLORS From fede364f8853edc2b6925531a63e392a4f76754a Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Fri, 16 Mar 2018 14:49:16 -0700 Subject: [PATCH 03/38] connect tableOptions field visibility toggle to tableGraph --- .../GraphOptionsCustomizableColumn.tsx | 19 +++---- .../GraphOptionsCustomizeColumns.tsx | 6 +-- ui/src/dashboards/components/TableOptions.tsx | 13 +++-- ui/src/shared/components/TableGraph.js | 54 ++++++++++++++++--- .../style/components/ceo-display-options.scss | 15 +++++- .../GraphOptionsCustomizableColumn.test.tsx | 15 +++--- .../GraphOptionsCustomizeColumns.test.tsx | 2 +- 7 files changed, 91 insertions(+), 33 deletions(-) diff --git a/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx b/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx index 71e96ec647..8b452585be 100644 --- a/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx +++ b/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx @@ -12,7 +12,7 @@ interface Props { internalName: string displayName: string visible: boolean - onColumnRename: (column: Column) => void + onColumnUpdate: (column: Column) => void } class GraphOptionsCustomizableColumn extends PureComponent { @@ -24,26 +24,26 @@ class GraphOptionsCustomizableColumn extends PureComponent { } handleColumnRename(rename: string) { - const {onColumnRename, internalName, visible} = this.props - onColumnRename({internalName, displayName: rename, visible}) + const {onColumnUpdate, internalName, visible} = this.props + onColumnUpdate({internalName, displayName: rename, visible}) } handleToggleVisible() { - const {onColumnRename, internalName, displayName, visible} = this.props - onColumnRename({internalName, displayName, visible: !visible}) + const {onColumnUpdate, internalName, displayName, visible} = this.props + onColumnUpdate({internalName, displayName, visible: !visible}) } render() { const {internalName, displayName, visible} = this.props - console.log('VISIBLE:', visible) return (
- + {internalName}
{ onBlur={this.handleColumnRename} placeholder="Rename..." appearAsNormalInput={true} + disabled={!visible} />
) diff --git a/ui/src/dashboards/components/GraphOptionsCustomizeColumns.tsx b/ui/src/dashboards/components/GraphOptionsCustomizeColumns.tsx index f14c05d25f..2bae083327 100644 --- a/ui/src/dashboards/components/GraphOptionsCustomizeColumns.tsx +++ b/ui/src/dashboards/components/GraphOptionsCustomizeColumns.tsx @@ -11,12 +11,12 @@ type Column = { interface Props { columns: Column[] - onColumnRename: (column: Column) => void + onColumnUpdate: (column: Column) => void } const GraphOptionsCustomizeColumns: SFC = ({ columns, - onColumnRename, + onColumnUpdate, }) => { return (
@@ -28,7 +28,7 @@ const GraphOptionsCustomizeColumns: SFC = ({ internalName={col.internalName} displayName={col.displayName} visible={col.visible} - onColumnRename={onColumnRename} + onColumnUpdate={onColumnUpdate} /> ) })} diff --git a/ui/src/dashboards/components/TableOptions.tsx b/ui/src/dashboards/components/TableOptions.tsx index 5d9a8f7ab2..c27bb3041d 100644 --- a/ui/src/dashboards/components/TableOptions.tsx +++ b/ui/src/dashboards/components/TableOptions.tsx @@ -21,6 +21,7 @@ import {updateTableOptions} from 'src/dashboards/actions/cellEditorOverlay' type TableColumn = { internalName: string displayName: string + visible: boolean } type Options = { @@ -74,7 +75,7 @@ export class TableOptions extends PureComponent { const existing = this.columnNames.find( c => c.internalName === internalName ) - return existing || {internalName, displayName: ''} + return existing || {internalName, displayName: '', visible: true} }) }) ) @@ -92,7 +93,11 @@ export class TableOptions extends PureComponent { handleChooseSortBy = option => { const {tableOptions, handleUpdateTableOptions} = this.props - const sortBy = {displayName: option.text, internalName: option.key} + const sortBy = { + displayName: option.text, + internalName: option.key, + visible: true, + } handleUpdateTableOptions({...tableOptions, sortBy}) } @@ -115,7 +120,7 @@ export class TableOptions extends PureComponent { handleUpdateTableOptions({...tableOptions, fixFirstColumn}) } - handleColumnRename = column => { + handleColumnUpdate = column => { const {handleUpdateTableOptions, tableOptions} = this.props const {columnNames} = tableOptions const updatedColumns = columnNames.map( @@ -173,7 +178,7 @@ export class TableOptions extends PureComponent {
diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index 8ac5960d76..3e2eeae41a 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -24,26 +24,56 @@ class TableGraph extends Component { this.state = { data: [[]], unzippedData: [[]], + visibleData: [[]], hoveredColumnIndex: NULL_COLUMN_INDEX, hoveredRowIndex: NULL_ROW_INDEX, sortByColumnIndex: -1, + invisibleFieldIndices: [], } } componentWillReceiveProps(nextProps) { const {data, unzippedData} = timeSeriesToTableGraph(nextProps.data) - const {tableOptions: {sortBy: {internalName}}} = nextProps + const { + tableOptions: {sortBy: {internalName}, columnNames, verticalTimeAxis}, + } = nextProps const sortByColumnIndex = _.indexOf(data[0], internalName) - const sortedData = _.sortBy(_.drop(data, 1), sortByColumnIndex) + const sortedData = [ + data[0], + ..._.sortBy(_.drop(data, 1), sortByColumnIndex), + ] + + if (verticalTimeAxis) { + const visibleColumns = {} + const filteredData = sortedData.map((row, i) => { + return row.filter((col, j) => { + if (i === 0) { + const foundColumn = columnNames.find( + column => column.internalName === col + ) + visibleColumns[j] = foundColumn && foundColumn.visible + } + return visibleColumns[j] + }) + }) + const visibleData = filteredData[0].length ? filteredData : [[]] + } + this.setState({ - data: [data[0], ...sortedData], + data: sortedData, + visibleData, unzippedData, sortByColumnIndex, }) } + componentWillMount() { + this._data = [[]] + this._visibleData = [[]] + } + calcHoverTimeIndex = (data, hoverTime, verticalTimeAxis) => { if (isEmpty(data) || hoverTime === NULL_HOVER_TIME) { return undefined @@ -101,11 +131,17 @@ class TableGraph extends Component { FIX_FIRST_COLUMN_DEFAULT ) + const timeField = columnNames.find( + column => column.internalName === TIME_COLUMN_DEFAULT.internalName + ) + const isFixedRow = rowIndex === 0 && columnIndex > 0 const isFixedColumn = fixFirstColumn && rowIndex > 0 && columnIndex === 0 - const isTimeData = tableOptions.verticalTimeAxis - ? rowIndex > 0 && columnIndex === 0 - : isFixedRow + const isTimeData = + timeField.visible && + (tableOptions.verticalTimeAxis + ? rowIndex > 0 && columnIndex === 0 + : isFixedRow) const isFixedCorner = rowIndex === 0 && columnIndex === 0 const isLastRow = rowIndex === rowCount - 1 const isLastColumn = columnIndex === columnCount - 1 @@ -168,7 +204,9 @@ class TableGraph extends Component { const verticalTimeAxis = _.get(tableOptions, 'verticalTimeAxis', true) - const data = verticalTimeAxis ? this.state.data : this.state.unzippedData + const data = verticalTimeAxis + ? this.state.visibleData + : this.state.unzippedData const columnCount = _.get(data, ['0', 'length'], 0) const rowCount = data.length @@ -193,7 +231,7 @@ class TableGraph extends Component { ref={gridContainer => (this.gridContainer = gridContainer)} onMouseOut={this.handleMouseOut} > - {!isEmpty(data) && + {!isEmpty(visibleData) && span { + padding-right: 5px; + + &:hover { + cursor: pointer; + } + } +} +.column-controls--label-hidden { + color: $g0-obsidian; } .column-controls-input { flex: 1 0 0; display: flex; align-items: center; } + + /* Cell Editor Overlay - Single-Stat Controls ------------------------------------------------------------------------------ diff --git a/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx b/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx index 477807e29d..4e05b0c421 100644 --- a/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx +++ b/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx @@ -9,7 +9,8 @@ const setup = (override = {}) => { const props = { internalName: '', displayName: '', - onColumnRename: () => {}, + visible: true, + onColumnUpdate: () => {}, ...override, } @@ -42,17 +43,17 @@ describe('Dashboards.Components.GraphOptionsCustomizableColumn', () => { }) describe('instance methods', () => { - describe('#handleColumnRename', () => { - it('calls onColumnRename once', () => { - const onColumnRename = jest.fn() + describe('#handleColumnUpdate', () => { + it('calls onColumnUpdate once', () => { + const onColumnUpdate = jest.fn() const internalName = 'test' - const {instance} = setup({onColumnRename, internalName}) + const {instance} = setup({onColumnUpdate, internalName}) const rename = 'TEST' instance.handleColumnRename(rename) - expect(onColumnRename).toHaveBeenCalledTimes(1) - expect(onColumnRename).toHaveBeenCalledWith({ + expect(onColumnUpdate).toHaveBeenCalledTimes(1) + expect(onColumnUpdate).toHaveBeenCalledWith({ internalName, displayName: rename, }) diff --git a/ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx b/ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx index 23dee525e4..4fd67f34ee 100644 --- a/ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx +++ b/ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx @@ -9,7 +9,7 @@ import {shallow} from 'enzyme' const setup = (override = {}) => { const props = { columns: [], - onColumnRename: () => {}, + onColumnUpdate: () => {}, ...override, } From d3198f2e453ddc9987ff60714256f3f26ec5baa0 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Fri, 16 Mar 2018 15:39:21 -0700 Subject: [PATCH 04/38] add filtering out invisible rows for horizontal time axis --- ui/src/shared/components/TableGraph.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index 3e2eeae41a..dba80faac7 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -45,9 +45,10 @@ class TableGraph extends Component { ..._.sortBy(_.drop(data, 1), sortByColumnIndex), ] + let filteredData = [[]] if (verticalTimeAxis) { const visibleColumns = {} - const filteredData = sortedData.map((row, i) => { + filteredData = sortedData.map((row, i) => { return row.filter((col, j) => { if (i === 0) { const foundColumn = columnNames.find( @@ -58,9 +59,17 @@ class TableGraph extends Component { return visibleColumns[j] }) }) - const visibleData = filteredData[0].length ? filteredData : [[]] + } else { + filteredData = data.filter(row => { + const foundField = columnNames.find( + column => column.internalName === row[0] + ) + return foundField && foundField.visible + }) } + const visibleData = filteredData[0].length ? filteredData : [[]] + this.setState({ data: sortedData, visibleData, From 03e884e2d6e37718c3324bae6a6fe893fa2469f1 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Fri, 16 Mar 2018 16:04:01 -0700 Subject: [PATCH 05/38] update GraphOptionsCustomizableColumn.test with visible prop and toggling it --- .../GraphOptionsCustomizableColumn.test.tsx | 43 ++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx b/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx index 4e05b0c421..ab5d7ce1b1 100644 --- a/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx +++ b/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx @@ -26,8 +26,10 @@ describe('Dashboards.Components.GraphOptionsCustomizableColumn', () => { const {wrapper} = setup() const label = wrapper.find('div').last() const input = wrapper.find(InputClickToEdit) + const icon = wrapper.find('span') expect(label.exists()).toBe(true) + expect(icon.exists()).toBe(true) expect(input.exists()).toBe(true) }) @@ -36,18 +38,34 @@ describe('Dashboards.Components.GraphOptionsCustomizableColumn', () => { const internalName = 'test' const {wrapper} = setup({internalName}) const label = wrapper.find('div').last() + const icon = wrapper.find('span') + expect(label.exists()).toBe(true) expect(label.children().contains(internalName)).toBe(true) + expect(icon.exists()).toBe(true) + }) + }) + + describe('when visible is false', () => { + it('displays disabled inputClickToEdit', () => { + const visible = false + const {wrapper} = setup({visible}) + const input = wrapper.find(InputClickToEdit) + + expect(input.prop('disabled')).toBe(!visible) }) }) }) describe('instance methods', () => { describe('#handleColumnUpdate', () => { - it('calls onColumnUpdate once', () => { + it('calls onColumnUpdate once with internalName, new name, and visible', () => { const onColumnUpdate = jest.fn() const internalName = 'test' - const {instance} = setup({onColumnUpdate, internalName}) + const {instance, props: {visible}} = setup({ + onColumnUpdate, + internalName, + }) const rename = 'TEST' instance.handleColumnRename(rename) @@ -56,6 +74,27 @@ describe('Dashboards.Components.GraphOptionsCustomizableColumn', () => { expect(onColumnUpdate).toHaveBeenCalledWith({ internalName, displayName: rename, + visible, + }) + }) + }) + + describe('#handleToggleVisible', () => { + it('calls onColumnUpdate once with !visible, internalName, and displayName', () => { + const onColumnUpdate = jest.fn() + const visible = true + const {instance, props: {internalName, displayName}} = setup({ + visible, + onColumnUpdate, + }) + + instance.handleToggleVisible() + + expect(onColumnUpdate).toHaveBeenCalledTimes(1) + expect(onColumnUpdate).toHaveBeenCalledWith({ + internalName, + displayName, + visible: !visible, }) }) }) From cb9c6ac00d13311461f0f13447640c40db6f7f4b Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Fri, 16 Mar 2018 17:03:20 -0700 Subject: [PATCH 06/38] WIP change backend TableColumn to RenamableField and ColumnNames in TableOptions to FieldNames --- bolt/internal/internal.go | 32 ++--- bolt/internal/internal.pb.go | 239 +++++++++++++++++---------------- bolt/internal/internal.proto | 8 +- bolt/internal/internal_test.go | 14 +- chronograf.go | 16 +-- integrations/server_test.go | 4 +- server/cells_test.go | 2 +- 7 files changed, 158 insertions(+), 157 deletions(-) diff --git a/bolt/internal/internal.go b/bolt/internal/internal.go index 2539443fd4..b151ebb339 100644 --- a/bolt/internal/internal.go +++ b/bolt/internal/internal.go @@ -265,18 +265,18 @@ func MarshalDashboard(d chronograf.Dashboard) ([]byte, error) { } } - sortBy := &TableColumn{ + sortBy := &RenamableField{ InternalName: c.TableOptions.SortBy.InternalName, DisplayName: c.TableOptions.SortBy.DisplayName, Visible: c.TableOptions.SortBy.Visible, } - columnNames := make([]*TableColumn, len(c.TableOptions.ColumnNames)) - for i, column := range c.TableOptions.ColumnNames { - columnNames[i] = &TableColumn{ - InternalName: column.InternalName, - DisplayName: column.DisplayName, - Visible: column.Visible, + fieldNames := make([]*RenamableField, len(c.TableOptions.FieldNames)) + for i, field := range c.TableOptions.FieldNames { + fieldNames[i] = &RenamableField{ + InternalName: field.InternalName, + DisplayName: field.DisplayName, + Visible: field.Visible, } } @@ -285,7 +285,7 @@ func MarshalDashboard(d chronograf.Dashboard) ([]byte, error) { VerticalTimeAxis: c.TableOptions.VerticalTimeAxis, SortBy: sortBy, Wrapping: c.TableOptions.Wrapping, - ColumnNames: columnNames, + FieldNames: fieldNames, FixFirstColumn: c.TableOptions.FixFirstColumn, } @@ -433,7 +433,7 @@ func UnmarshalDashboard(data []byte, d *chronograf.Dashboard) error { tableOptions := chronograf.TableOptions{} if c.TableOptions != nil { - sortBy := chronograf.TableColumn{} + sortBy := chronograf.RenamableField{} if c.TableOptions.SortBy != nil { sortBy.InternalName = c.TableOptions.SortBy.InternalName sortBy.DisplayName = c.TableOptions.SortBy.DisplayName @@ -441,14 +441,14 @@ func UnmarshalDashboard(data []byte, d *chronograf.Dashboard) error { } tableOptions.SortBy = sortBy - columnNames := make([]chronograf.TableColumn, len(c.TableOptions.ColumnNames)) - for i, column := range c.TableOptions.ColumnNames { - columnNames[i] = chronograf.TableColumn{} - columnNames[i].InternalName = column.InternalName - columnNames[i].DisplayName = column.DisplayName - columnNames[i].Visible = column.Visible + fieldNames := make([]chronograf.RenamableField, len(c.TableOptions.FieldNames)) + for i, field := range c.TableOptions.FieldNames { + fieldNames[i] = chronograf.RenamableField{} + fieldNames[i].InternalName = field.InternalName + fieldNames[i].DisplayName = field.DisplayName + fieldNames[i].Visible = field.Visible } - tableOptions.ColumnNames = columnNames + tableOptions.FieldNames = fieldNames tableOptions.TimeFormat = c.TableOptions.TimeFormat tableOptions.VerticalTimeAxis = c.TableOptions.VerticalTimeAxis tableOptions.Wrapping = c.TableOptions.Wrapping diff --git a/bolt/internal/internal.pb.go b/bolt/internal/internal.pb.go index d3547db61e..3e1d7ab2c2 100644 --- a/bolt/internal/internal.pb.go +++ b/bolt/internal/internal.pb.go @@ -12,7 +12,7 @@ It has these top-level messages: Dashboard DashboardCell TableOptions - TableColumn + RenamableField Color Legend Axis @@ -316,12 +316,12 @@ func (m *DashboardCell) GetTableOptions() *TableOptions { } type TableOptions struct { - TimeFormat string `protobuf:"bytes,1,opt,name=timeFormat,proto3" json:"timeFormat,omitempty"` - VerticalTimeAxis bool `protobuf:"varint,2,opt,name=verticalTimeAxis,proto3" json:"verticalTimeAxis,omitempty"` - SortBy *TableColumn `protobuf:"bytes,3,opt,name=sortBy" json:"sortBy,omitempty"` - Wrapping string `protobuf:"bytes,4,opt,name=wrapping,proto3" json:"wrapping,omitempty"` - ColumnNames []*TableColumn `protobuf:"bytes,5,rep,name=columnNames" json:"columnNames,omitempty"` - FixFirstColumn bool `protobuf:"varint,6,opt,name=fixFirstColumn,proto3" json:"fixFirstColumn,omitempty"` + TimeFormat string `protobuf:"bytes,1,opt,name=timeFormat,proto3" json:"timeFormat,omitempty"` + VerticalTimeAxis bool `protobuf:"varint,2,opt,name=verticalTimeAxis,proto3" json:"verticalTimeAxis,omitempty"` + SortBy *RenamableField `protobuf:"bytes,3,opt,name=sortBy" json:"sortBy,omitempty"` + Wrapping string `protobuf:"bytes,4,opt,name=wrapping,proto3" json:"wrapping,omitempty"` + FieldNames []*RenamableField `protobuf:"bytes,5,rep,name=fieldNames" json:"fieldNames,omitempty"` + FixFirstColumn bool `protobuf:"varint,6,opt,name=fixFirstColumn,proto3" json:"fixFirstColumn,omitempty"` } func (m *TableOptions) Reset() { *m = TableOptions{} } @@ -343,7 +343,7 @@ func (m *TableOptions) GetVerticalTimeAxis() bool { return false } -func (m *TableOptions) GetSortBy() *TableColumn { +func (m *TableOptions) GetSortBy() *RenamableField { if m != nil { return m.SortBy } @@ -357,9 +357,9 @@ func (m *TableOptions) GetWrapping() string { return "" } -func (m *TableOptions) GetColumnNames() []*TableColumn { +func (m *TableOptions) GetFieldNames() []*RenamableField { if m != nil { - return m.ColumnNames + return m.FieldNames } return nil } @@ -371,32 +371,32 @@ func (m *TableOptions) GetFixFirstColumn() bool { return false } -type TableColumn struct { +type RenamableField struct { InternalName string `protobuf:"bytes,1,opt,name=internalName,proto3" json:"internalName,omitempty"` DisplayName string `protobuf:"bytes,2,opt,name=displayName,proto3" json:"displayName,omitempty"` Visible bool `protobuf:"varint,3,opt,name=visible,proto3" json:"visible,omitempty"` } -func (m *TableColumn) Reset() { *m = TableColumn{} } -func (m *TableColumn) String() string { return proto.CompactTextString(m) } -func (*TableColumn) ProtoMessage() {} -func (*TableColumn) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{4} } +func (m *RenamableField) Reset() { *m = RenamableField{} } +func (m *RenamableField) String() string { return proto.CompactTextString(m) } +func (*RenamableField) ProtoMessage() {} +func (*RenamableField) Descriptor() ([]byte, []int) { return fileDescriptorInternal, []int{4} } -func (m *TableColumn) GetInternalName() string { +func (m *RenamableField) GetInternalName() string { if m != nil { return m.InternalName } return "" } -func (m *TableColumn) GetDisplayName() string { +func (m *RenamableField) GetDisplayName() string { if m != nil { return m.DisplayName } return "" } -func (m *TableColumn) GetVisible() bool { +func (m *RenamableField) GetVisible() bool { if m != nil { return m.Visible } @@ -1304,7 +1304,7 @@ func init() { proto.RegisterType((*Dashboard)(nil), "internal.Dashboard") proto.RegisterType((*DashboardCell)(nil), "internal.DashboardCell") proto.RegisterType((*TableOptions)(nil), "internal.TableOptions") - proto.RegisterType((*TableColumn)(nil), "internal.TableColumn") + proto.RegisterType((*RenamableField)(nil), "internal.RenamableField") proto.RegisterType((*Color)(nil), "internal.Color") proto.RegisterType((*Legend)(nil), "internal.Legend") proto.RegisterType((*Axis)(nil), "internal.Axis") @@ -1330,104 +1330,105 @@ func init() { func init() { proto.RegisterFile("internal.proto", fileDescriptorInternal) } var fileDescriptorInternal = []byte{ - // 1582 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xdd, 0x8e, 0xdb, 0x44, - 0x14, 0x96, 0x93, 0x38, 0x89, 0x4f, 0xb6, 0xcb, 0xca, 0x2c, 0xad, 0x29, 0x12, 0x0a, 0x16, 0x3f, - 0xe1, 0xa7, 0x0b, 0x4a, 0x85, 0x40, 0x15, 0x54, 0xca, 0x6e, 0x68, 0x59, 0xba, 0xed, 0x6e, 0x27, - 0xbb, 0xcb, 0x15, 0xaa, 0x26, 0xc9, 0x24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x1d, 0xea, 0x43, 0xc9, 0xad, 0xb4, 0xab, 0x1d, 0x87, 0x28, 0x84, 0xa6, 0x85, 0x74, - 0xc8, 0x42, 0xe5, 0x82, 0x04, 0x28, 0x9d, 0x70, 0x36, 0x09, 0x16, 0xca, 0x0d, 0x85, 0x90, 0x9e, - 0xe6, 0x13, 0xa4, 0x4b, 0x4f, 0x14, 0x42, 0x07, 0x86, 0x34, 0x2d, 0x5b, 0x1e, 0xcf, 0xa8, 0x39, - 0x1d, 0xd1, 0x50, 0xf7, 0xbc, 0x04, 0xfe, 0xef, 0x16, 0xee, 0x02, 0x39, 0xc3, 0xd6, 0x22, 0xfc, - 0x2a, 0x34, 0x71, 0xbe, 0x3d, 0xb9, 0xa0, 0x5c, 0x39, 0xdc, 0x40, 0x7c, 0x4e, 0xb9, 0xfb, 0x21, - 0xd4, 0x45, 0x6b, 0x6c, 0x98, 0xa7, 0x5a, 0x9d, 0x88, 0x2a, 0x51, 0x62, 0xe5, 0xc4, 0xa9, 0x19, - 0x13, 0xa7, 0x74, 0xd6, 0x36, 0x9d, 0xbd, 0x05, 0x36, 0x8e, 0xae, 0x42, 0x58, 0xbf, 0x51, 0xb3, - 0x1c, 0x70, 0x52, 0xca, 0x3f, 0x83, 0x6b, 0x2b, 0x37, 0x96, 0x37, 0x59, 0xab, 0x37, 0x2d, 0xdb, - 0xdc, 0x51, 0x6d, 0x8d, 0x6d, 0x94, 0xb2, 0x90, 0x8d, 0x32, 0x36, 0x56, 0x55, 0x57, 0x62, 0xff, - 0x47, 0x6b, 0xa9, 0x57, 0xdc, 0x87, 0x25, 0x3a, 0x8a, 0xe7, 0x73, 0x1a, 0x8d, 0x95, 0x6a, 0x0d, - 0x31, 0x6e, 0xe3, 0xa1, 0x52, 0x5d, 0x19, 0x0f, 0x11, 0xf3, 0x44, 0x65, 0xb0, 0xc2, 0x13, 0xac, - 0x9d, 0x39, 0xa3, 0x69, 0xce, 0xd9, 0x9c, 0x45, 0x99, 0x0a, 0x81,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fa, 0x4e, 0x2e, 0x7a, 0x87, 0x68, 0x58, 0xf6, 0x11, 0x18, 0x7d, 0xf4, 0x81, 0x7a, 0x13, - 0xb4, 0x84, 0x45, 0xde, 0x6a, 0x58, 0xae, 0x3e, 0x05, 0xfe, 0xbb, 0xdd, 0xfb, 0x97, 0x05, 0x76, - 0xd9, 0x84, 0x07, 0xab, 0x4d, 0x78, 0xb0, 0x6c, 0xc2, 0xfe, 0xbe, 0x6e, 0xc2, 0xfe, 0x3e, 0x62, - 0x72, 0xa2, 0x9b, 0x90, 0x9c, 0x60, 0xb2, 0xee, 0xf3, 0x38, 0x4f, 0xf6, 0x0b, 0x99, 0x55, 0x87, - 0x94, 0x18, 0x2b, 0xf7, 0xeb, 0x19, 0xe3, 0x2a, 0xd4, 0x0e, 0x51, 0x08, 0xeb, 0xfc, 0x48, 0x0c, - 0x28, 0x19, 0x5c, 0x09, 0xdc, 0xb7, 0xc0, 0x26, 0x18, 0x3c, 0x11, 0xe1, 0x95, 0xbc, 0x08, 0x32, - 0x91, 0x5c, 0x54, 0x2a, 0xff, 0x05, 0x54, 0xc1, 0xeb, 0x3f, 0x83, 0xf7, 0xa1, 0x3e, 0x98, 0x05, - 0x93, 0x4c, 0xbf, 0xac, 0x5e, 0x36, 0x06, 0x5c, 0x30, 0x67, 0x82, 0x47, 0x94, 0x88, 0xff, 0x18, - 0x9c, 0x92, 0xb8, 0x34, 0xc7, 0x32, 0xcd, 0x71, 0xa1, 0x76, 0x16, 0x05, 0x99, 0x6e, 0x75, 0x3c, - 0xa3, 0xb3, 0x8f, 0x73, 0x1a, 0x65, 0x41, 0x56, 0xe8, 0x56, 0xd7, 0xd8, 0xbf, 0xad, 0xcc, 0x47, - 0x75, 0x67, 0x49, 0xc2, 0xb8, 0x1a, 0x1b, 0x12, 0x88, 0x4b, 0xe2, 0x4b, 0x26, 0x27, 0x7e, 0x95, - 0x48, 0xe0, 0x7f, 0x03, 0x4e, 0x2f, 0x64, 0x3c, 0x23, 0x79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0xb0, 0xa4, - 0xe1, 0x96, 0x58, 0x66, 0xe3, 0x11, 0xbb, 0xc4, 0x92, 0x49, 0x85, 0x96, 0x26, 0xd9, 0xc0, 0xf1, - 0x3f, 0x07, 0x67, 0x3f, 0x0f, 0xc2, 0xf1, 0x61, 0x34, 0x89, 0x71, 0x74, 0x9c, 0x33, 0x9e, 0x2e, - 0xf3, 0xa5, 0x21, 0x86, 0x1b, 0xa7, 0x48, 0xd9, 0x43, 0x0a, 0x0d, 0xeb, 0xe2, 0xff, 0xfe, 0xf6, - 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf4, 0xe4, 0x20, 0x8a, 0xf1, 0x0f, 0x00, 0x00, + // 1586 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0x5f, 0x8f, 0xdb, 0x44, + 0x10, 0x97, 0x93, 0x38, 0x89, 0x27, 0xd7, 0xe3, 0x64, 0x4e, 0xad, 0x29, 0x12, 0x0a, 0x16, 0x7f, + 0xc2, 0x9f, 0x1e, 0x55, 0x2a, 0xa4, 0xaa, 0x82, 0x4a, 0xb9, 0x0b, 0x2d, 0x47, 0xaf, 0xbd, 0xeb, + 0xe6, 0xee, 0x78, 0x42, 0xd5, 0x26, 0x99, 0x24, 0x56, 0x1d, 0xdb, 0xac, 0xed, 0xbb, 0x98, 0x8f, + 0xc0, 0x87, 0x40, 0x42, 0x82, 0x2f, 0x80, 0x78, 0xe1, 0x89, 0x77, 0x3e, 0x08, 0x5f, 0x01, 0x1e, + 0xd1, 0xec, 0xae, 0x1d, 0xe7, 0x92, 0x56, 0x45, 0x42, 0xbc, 0xed, 0x6f, 0x66, 0x3c, 0xbb, 0xf3, + 0x7f, 0x0c, 0xdb, 0x5e, 0x90, 0xa0, 0x08, 0xb8, 0xbf, 0x17, 0x89, 0x30, 0x09, 0xed, 0x66, 0x8e, + 0xdd, 0x3f, 0x2b, 0x50,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0x00, 0xff, 0xff, 0xda, 0x7c, 0x0d, 0xab, 0xf8, 0x0f, + 0x00, 0x00, } diff --git a/bolt/internal/internal.proto b/bolt/internal/internal.proto index 86e8f30dea..eae027cdad 100644 --- a/bolt/internal/internal.proto +++ b/bolt/internal/internal.proto @@ -43,16 +43,16 @@ message DashboardCell { message TableOptions { string timeFormat = 1; // format for time bool verticalTimeAxis = 2; // time axis should be a column not row - TableColumn sortBy = 3; // which column should a table be sorted by + RenamableField sortBy = 3; // which column should a table be sorted by string wrapping = 4; // option for text wrapping - repeated TableColumn columnNames = 5; // names and renames for columns + repeated RenamableField fieldNames = 5; // names and renames for column/row fields bool fixFirstColumn = 6; // first column should be fixed/frozen } -message TableColumn { +message RenamableField { string internalName = 1; // name of column string displayName = 2; // what column is renamed to - bool visible = 3; // Represents whether TableColumn is visible + bool visible = 3; // Represents whether RenamableField is visible } message Color { diff --git a/bolt/internal/internal_test.go b/bolt/internal/internal_test.go index b8397d5d4e..75c87816f1 100644 --- a/bolt/internal/internal_test.go +++ b/bolt/internal/internal_test.go @@ -195,8 +195,8 @@ func Test_MarshalDashboard(t *testing.T) { }, }, TableOptions: chronograf.TableOptions{ - TimeFormat: "", - ColumnNames: []chronograf.TableColumn{}, + TimeFormat: "", + FieldNames: []chronograf.RenamableField{}, }, }, }, @@ -318,8 +318,8 @@ func Test_MarshalDashboard_WithLegacyBounds(t *testing.T) { Orientation: "bottom", }, TableOptions: chronograf.TableOptions{ - TimeFormat: "MM:DD:YYYY", - ColumnNames: []chronograf.TableColumn{}, + TimeFormat: "MM:DD:YYYY", + FieldNames: []chronograf.RenamableField{}, }, Type: "line", }, @@ -434,8 +434,8 @@ func Test_MarshalDashboard_WithEmptyLegacyBounds(t *testing.T) { }, }, TableOptions: chronograf.TableOptions{ - TimeFormat: "MM:DD:YYYY", - ColumnNames: []chronograf.TableColumn{}, + TimeFormat: "MM:DD:YYYY", + FieldNames: []chronograf.RenamableField{}, }, Type: "line", }, @@ -474,7 +474,7 @@ func Test_MarshalDashboard_WithEmptyCellType(t *testing.T) { Axes: map[string]chronograf.Axis{}, CellColors: []chronograf.CellColor{}, TableOptions: chronograf.TableOptions{ - ColumnNames: []chronograf.TableColumn{}, + FieldNames: []chronograf.RenamableField{}, }, }, }, diff --git a/chronograf.go b/chronograf.go index a1b2a205c8..16715ee6d3 100644 --- a/chronograf.go +++ b/chronograf.go @@ -560,8 +560,8 @@ type DashboardCell struct { TableOptions TableOptions `json:"tableOptions,omitempty"` } -// TableColumn is a column in a DashboardCell of type Table -type TableColumn struct { +// RenamableField is a column/row field in a DashboardCell of type Table +type RenamableField struct { InternalName string `json:"internalName"` DisplayName string `json:"displayName"` Visible bool `json:"visible"` @@ -569,12 +569,12 @@ type TableColumn struct { // TableOptions is a type of options for a DashboardCell with type Table type TableOptions struct { - TimeFormat string `json:"timeFormat"` - VerticalTimeAxis bool `json:"verticalTimeAxis"` - SortBy TableColumn `json:"sortBy"` - Wrapping string `json:"wrapping"` - ColumnNames []TableColumn `json:"columnNames"` - FixFirstColumn bool `json:"fixFirstColumn"` + TimeFormat string `json:"timeFormat"` + VerticalTimeAxis bool `json:"verticalTimeAxis"` + SortBy RenamableField `json:"sortBy"` + Wrapping string `json:"wrapping"` + FieldNames []RenamableField `json:"fieldNames"` + FixFirstColumn bool `json:"fixFirstColumn"` } // DashboardsStore is the storage and retrieval of dashboards diff --git a/integrations/server_test.go b/integrations/server_test.go index 8077258960..d35f8fb6ed 100644 --- a/integrations/server_test.go +++ b/integrations/server_test.go @@ -552,7 +552,7 @@ func TestServer(t *testing.T) { "visible": false }, "wrapping": "", - "columnNames": null, + "fieldNames": null, "fixFirstColumn": false }, "links": { @@ -803,7 +803,7 @@ func TestServer(t *testing.T) { "visible":false }, "wrapping":"", - "columnNames":null, + "fieldNames":null, "fixFirstColumn":false }, "legend":{ diff --git a/server/cells_test.go b/server/cells_test.go index a526fb3ac8..38c2ef5c5e 100644 --- a/server/cells_test.go +++ b/server/cells_test.go @@ -532,7 +532,7 @@ func TestService_ReplaceDashboardCell(t *testing.T) { } } `))), - want: `{"i":"3c5c4102-fa40-4585-a8f9-917c77e37192","x":0,"y":0,"w":4,"h":4,"name":"Untitled Cell","queries":[{"query":"SELECT mean(\"usage_user\") AS \"mean_usage_user\" FROM \"telegraf\".\"autogen\".\"cpu\" WHERE time \u003e :dashboardTime: AND \"cpu\"=:cpu: GROUP BY :interval: FILL(null)","queryConfig":{"id":"3cd3eaa4-a4b8-44b3-b69e-0c7bf6b91d9e","database":"telegraf","measurement":"cpu","retentionPolicy":"autogen","fields":[{"value":"mean","type":"func","alias":"mean_usage_user","args":[{"value":"usage_user","type":"field","alias":""}]}],"tags":{"cpu":["ChristohersMBP2.lan"]},"groupBy":{"time":"2s","tags":[]},"areTagsAccepted":true,"fill":"null","rawText":"SELECT mean(\"usage_user\") AS \"mean_usage_user\" FROM \"telegraf\".\"autogen\".\"cpu\" WHERE time \u003e :dashboardTime: AND \"cpu\"=:cpu: GROUP BY :interval: FILL(null)","range":{"upper":"","lower":"now() - 15m"},"shifts":[]},"source":""}],"axes":{"x":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""},"y":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""},"y2":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""}},"type":"line","colors":[{"id":"0","type":"min","hex":"#00C9FF","name":"laser","value":"0"},{"id":"1","type":"max","hex":"#9394FF","name":"comet","value":"100"}],"legend":{},"tableOptions":{"timeFormat":"","verticalTimeAxis":false,"sortBy":{"internalName":"","displayName":"","visible":false},"wrapping":"","columnNames":null,"fixFirstColumn":false},"links":{"self":"/chronograf/v1/dashboards/1/cells/3c5c4102-fa40-4585-a8f9-917c77e37192"}} + want: `{"i":"3c5c4102-fa40-4585-a8f9-917c77e37192","x":0,"y":0,"w":4,"h":4,"name":"Untitled Cell","queries":[{"query":"SELECT mean(\"usage_user\") AS \"mean_usage_user\" FROM \"telegraf\".\"autogen\".\"cpu\" WHERE time \u003e :dashboardTime: AND \"cpu\"=:cpu: GROUP BY :interval: FILL(null)","queryConfig":{"id":"3cd3eaa4-a4b8-44b3-b69e-0c7bf6b91d9e","database":"telegraf","measurement":"cpu","retentionPolicy":"autogen","fields":[{"value":"mean","type":"func","alias":"mean_usage_user","args":[{"value":"usage_user","type":"field","alias":""}]}],"tags":{"cpu":["ChristohersMBP2.lan"]},"groupBy":{"time":"2s","tags":[]},"areTagsAccepted":true,"fill":"null","rawText":"SELECT mean(\"usage_user\") AS \"mean_usage_user\" FROM \"telegraf\".\"autogen\".\"cpu\" WHERE time \u003e :dashboardTime: AND \"cpu\"=:cpu: GROUP BY :interval: FILL(null)","range":{"upper":"","lower":"now() - 15m"},"shifts":[]},"source":""}],"axes":{"x":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""},"y":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""},"y2":{"bounds":["",""],"label":"","prefix":"","suffix":"","base":"","scale":""}},"type":"line","colors":[{"id":"0","type":"min","hex":"#00C9FF","name":"laser","value":"0"},{"id":"1","type":"max","hex":"#9394FF","name":"comet","value":"100"}],"legend":{},"tableOptions":{"timeFormat":"","verticalTimeAxis":false,"sortBy":{"internalName":"","displayName":"","visible":false},"wrapping":"","fieldNames":null,"fixFirstColumn":false},"links":{"self":"/chronograf/v1/dashboards/1/cells/3c5c4102-fa40-4585-a8f9-917c77e37192"}} `, }, { From d8daddde8f0947b3892d0b268538e1660283e1d9 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Fri, 16 Mar 2018 17:58:32 -0700 Subject: [PATCH 07/38] update columnNames to fieldNames and columns to fields in front end for tablegraphs --- .../GraphOptionsCustomizableColumn.tsx | 62 ----------- .../GraphOptionsCustomizeColumns.tsx | 39 ------- .../components/GraphOptionsTimeFormat.tsx | 4 +- ui/src/dashboards/components/TableOptions.tsx | 54 +++++----- ui/src/shared/components/TableGraph.js | 86 ++++++++------- ui/src/shared/constants/tableGraph.js | 6 +- .../style/components/ceo-display-options.scss | 8 +- .../GraphOptionsCustomizableColumn.test.tsx | 102 ------------------ .../GraphOptionsCustomizeColumns.test.tsx | 34 ------ .../components/TableOptions.test.tsx | 14 +-- 10 files changed, 82 insertions(+), 327 deletions(-) delete mode 100644 ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx delete mode 100644 ui/src/dashboards/components/GraphOptionsCustomizeColumns.tsx delete mode 100644 ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx delete mode 100644 ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx diff --git a/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx b/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx deleted file mode 100644 index 8b452585be..0000000000 --- a/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import React, {PureComponent} from 'react' - -import InputClickToEdit from 'src/shared/components/InputClickToEdit' - -type Column = { - internalName: string - displayName: string - visible: boolean -} - -interface Props { - internalName: string - displayName: string - visible: boolean - onColumnUpdate: (column: Column) => void -} - -class GraphOptionsCustomizableColumn extends PureComponent { - constructor(props) { - super(props) - - this.handleColumnRename = this.handleColumnRename.bind(this) - this.handleToggleVisible = this.handleToggleVisible.bind(this) - } - - handleColumnRename(rename: string) { - const {onColumnUpdate, internalName, visible} = this.props - onColumnUpdate({internalName, displayName: rename, visible}) - } - - handleToggleVisible() { - const {onColumnUpdate, internalName, displayName, visible} = this.props - onColumnUpdate({internalName, displayName, visible: !visible}) - } - - render() { - const {internalName, displayName, visible} = this.props - - return ( -
-
- - {internalName} -
- -
- ) - } -} - -export default GraphOptionsCustomizableColumn diff --git a/ui/src/dashboards/components/GraphOptionsCustomizeColumns.tsx b/ui/src/dashboards/components/GraphOptionsCustomizeColumns.tsx deleted file mode 100644 index 2bae083327..0000000000 --- a/ui/src/dashboards/components/GraphOptionsCustomizeColumns.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import React, {SFC} from 'react' - -import GraphOptionsCustomizableColumn from 'src/dashboards/components/GraphOptionsCustomizableColumn' -import uuid from 'uuid' - -type Column = { - internalName: string - displayName: string - visible: boolean -} - -interface Props { - columns: Column[] - onColumnUpdate: (column: Column) => void -} - -const GraphOptionsCustomizeColumns: SFC = ({ - columns, - onColumnUpdate, -}) => { - return ( -
- - {columns.map(col => { - return ( - - ) - })} -
- ) -} - -export default GraphOptionsCustomizeColumns diff --git a/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx b/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx index b20cbec48f..cb794d4c48 100644 --- a/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx +++ b/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx @@ -72,9 +72,9 @@ class GraphOptionsTimeFormat extends PureComponent { onChoose={this.handleChooseFormat} /> {showCustom && -
+
{ super(props) } - get columnNames() { - const {tableOptions: {columnNames}} = this.props - return columnNames || [] + get fieldNames() { + const {tableOptions: {fieldNames}} = this.props + return fieldNames || [] } get timeColumn() { return ( - this.columnNames.find(c => c.internalName === 'time') || - TIME_COLUMN_DEFAULT + this.fieldNames.find(f => f.internalName === 'time') || TIME_FIELD_DEFAULT ) } - get computedColumnNames() { + get computedFieldNames() { const {queryConfigs} = this.props const queryFields = _.flatten( queryConfigs.map(({measurement, fields}) => { return fields.map(({alias}) => { const internalName = `${measurement}.${alias}` - const existing = this.columnNames.find( - c => c.internalName === internalName + const existing = this.fieldNames.find( + f => f.internalName === internalName ) return existing || {internalName, displayName: '', visible: true} }) @@ -87,7 +86,7 @@ export class TableOptions extends PureComponent { const {handleUpdateTableOptions, tableOptions} = this.props handleUpdateTableOptions({ ...tableOptions, - columnNames: this.computedColumnNames, + fieldNames: this.computedFieldNames, }) } @@ -120,28 +119,23 @@ export class TableOptions extends PureComponent { handleUpdateTableOptions({...tableOptions, fixFirstColumn}) } - handleColumnUpdate = column => { + handleFieldUpdate = field => { const {handleUpdateTableOptions, tableOptions} = this.props - const {columnNames} = tableOptions - const updatedColumns = columnNames.map( - op => (op.internalName === column.internalName ? column : op) + const {fieldNames} = tableOptions + const updatedFields = fieldNames.map( + op => (op.internalName === field.internalName ? field : op) ) - handleUpdateTableOptions({...tableOptions, columnNames: updatedColumns}) + handleUpdateTableOptions({...tableOptions, fieldNames: updatedFields}) } render() { const { - tableOptions: { - timeFormat, - columnNames: columns, - verticalTimeAxis, - fixFirstColumn, - }, + tableOptions: {timeFormat, fieldNames, verticalTimeAxis, fixFirstColumn}, onResetFocus, tableOptions, } = this.props - const tableSortByOptions = this.computedColumnNames.map(col => ({ + const tableSortByOptions = this.computedFieldNames.map(col => ({ text: col.displayName || col.internalName, key: col.internalName, })) @@ -163,7 +157,7 @@ export class TableOptions extends PureComponent { onToggleVerticalTimeAxis={this.onToggleVerticalTimeAxis} /> @@ -176,9 +170,9 @@ export class TableOptions extends PureComponent { onToggleFixFirstColumn={this.handleToggleFixFirstColumn} />
-
diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index dba80faac7..b6a9e90cb5 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -13,11 +13,36 @@ import { NULL_ROW_INDEX, NULL_HOVER_TIME, TIME_FORMAT_DEFAULT, - TIME_COLUMN_DEFAULT, + TIME_FIELD_DEFAULT, FIX_FIRST_COLUMN_DEFAULT, } from 'src/shared/constants/tableGraph' import {generateThresholdsListHexs} from 'shared/constants/colorOperations' +const filterInvisibleRows = (data, verticalTimeAxis, fieldNames) => { + let visibleData = [[]] + if (verticalTimeAxis) { + const visibleColumns = {} + visibleData = data.map((row, i) => { + return row.filter((col, j) => { + if (i === 0) { + const foundField = fieldNames.find( + field => field.internalName === col + ) + visibleColumns[j] = foundField && foundField.visible + } + return visibleColumns[j] + }) + }) + } else { + visibleData = data.filter(row => { + const foundField = fieldNames.find(field => field.internalName === row[0]) + return foundField && foundField.visible + }) + } + + return visibleData[0].length ? visibleData : [[]] +} + class TableGraph extends Component { constructor(props) { super(props) @@ -36,7 +61,7 @@ class TableGraph extends Component { const {data, unzippedData} = timeSeriesToTableGraph(nextProps.data) const { - tableOptions: {sortBy: {internalName}, columnNames, verticalTimeAxis}, + tableOptions: {sortBy: {internalName}, fieldNames, verticalTimeAxis}, } = nextProps const sortByColumnIndex = _.indexOf(data[0], internalName) @@ -45,30 +70,11 @@ class TableGraph extends Component { ..._.sortBy(_.drop(data, 1), sortByColumnIndex), ] - let filteredData = [[]] - if (verticalTimeAxis) { - const visibleColumns = {} - filteredData = sortedData.map((row, i) => { - return row.filter((col, j) => { - if (i === 0) { - const foundColumn = columnNames.find( - column => column.internalName === col - ) - visibleColumns[j] = foundColumn && foundColumn.visible - } - return visibleColumns[j] - }) - }) - } else { - filteredData = data.filter(row => { - const foundField = columnNames.find( - column => column.internalName === row[0] - ) - return foundField && foundField.visible - }) - } - - const visibleData = filteredData[0].length ? filteredData : [[]] + const visibleData = filterInvisibleRows( + sortedData, + verticalTimeAxis, + fieldNames + ) this.setState({ data: sortedData, @@ -78,11 +84,6 @@ class TableGraph extends Component { }) } - componentWillMount() { - this._data = [[]] - this._visibleData = [[]] - } - calcHoverTimeIndex = (data, hoverTime, verticalTimeAxis) => { if (isEmpty(data) || hoverTime === NULL_HOVER_TIME) { return undefined @@ -131,17 +132,15 @@ class TableGraph extends Component { const columnCount = _.get(data, ['0', 'length'], 0) const rowCount = data.length const timeFormat = _.get(tableOptions, 'timeFormat', TIME_FORMAT_DEFAULT) - const columnNames = _.get(tableOptions, 'columnNames', [ - TIME_COLUMN_DEFAULT, - ]) + const columnNames = _.get(tableOptions, 'fieldNames', [TIME_FIELD_DEFAULT]) const fixFirstColumn = _.get( tableOptions, 'fixFirstColumn', FIX_FIRST_COLUMN_DEFAULT ) - const timeField = columnNames.find( - column => column.internalName === TIME_COLUMN_DEFAULT.internalName + const timeField = fieldNames.find( + field => field.internalName === TIME_FIELD_DEFAULT.internalName ) const isFixedRow = rowIndex === 0 && columnIndex > 0 @@ -187,11 +186,10 @@ class TableGraph extends Component { }) const cellData = data[rowIndex][columnIndex] - const foundColumn = columnNames.find( - column => column.internalName === cellData - ) - const columnName = - foundColumn && (foundColumn.displayName || foundColumn.internalName) + + const foundField = fieldNames.find(field => field.internalName === cellData) + const fieldName = + foundField && (foundField.displayName || foundField.internalName) return (
{isTimeData ? `${moment(cellData).format(timeFormat)}` - : columnName || `${cellData}`} + : fieldName || `${cellData}`}
) } @@ -255,8 +253,8 @@ class TableGraph extends Component { timeFormat={ tableOptions ? tableOptions.timeFormat : TIME_FORMAT_DEFAULT } - columnNames={ - tableOptions ? tableOptions.columnNames : [TIME_COLUMN_DEFAULT] + fieldNames={ + tableOptions ? tableOptions.fieldNames : [TIME_FIELD_DEFAULT] } scrollToRow={scrollToRow} scrollToColumn={scrollToColumn} diff --git a/ui/src/shared/constants/tableGraph.js b/ui/src/shared/constants/tableGraph.js index 83b439412c..2407f0a96c 100644 --- a/ui/src/shared/constants/tableGraph.js +++ b/ui/src/shared/constants/tableGraph.js @@ -6,7 +6,7 @@ export const NULL_HOVER_TIME = '0' export const TIME_FORMAT_DEFAULT = 'MM/DD/YYYY HH:mm:ss.ss' export const TIME_FORMAT_CUSTOM = 'Custom' -export const TIME_COLUMN_DEFAULT = { +export const TIME_FIELD_DEFAULT = { internalName: 'time', displayName: '', visible: true, @@ -29,8 +29,8 @@ export const FORMAT_OPTIONS = [ export const DEFAULT_TABLE_OPTIONS = { verticalTimeAxis: true, timeFormat: TIME_FORMAT_DEFAULT, - sortBy: TIME_COLUMN_DEFAULT, + sortBy: TIME_FIELD_DEFAULT, wrapping: 'truncate', - columnNames: [TIME_COLUMN_DEFAULT], + fieldNames: [TIME_FIELD_DEFAULT], fixFirstColumn: FIX_FIRST_COLUMN_DEFAULT, } diff --git a/ui/src/style/components/ceo-display-options.scss b/ui/src/style/components/ceo-display-options.scss index 25b9f0d202..8212fd7413 100644 --- a/ui/src/style/components/ceo-display-options.scss +++ b/ui/src/style/components/ceo-display-options.scss @@ -207,7 +207,7 @@ $graph-type--gutter: 4px; } .gauge-controls--section, -.column-controls--section { +.field-controls--section { width: 100%; display: flex; flex-wrap: nowrap; @@ -257,7 +257,7 @@ button.btn.btn-primary.btn-sm.gauge-controls--add-threshold { } -.column-controls--label, .column-controls--label-hidden { +.field-controls--label, .field-controls--label-hidden { @extend %gauge-controls-label-styles; color: $g16-pearl; background-color: $g4-onyx; @@ -271,10 +271,10 @@ button.btn.btn-primary.btn-sm.gauge-controls--add-threshold { } } } -.column-controls--label-hidden { +.field-controls--label-hidden { color: $g0-obsidian; } -.column-controls-input { +.field-controls-input { flex: 1 0 0; display: flex; align-items: center; diff --git a/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx b/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx deleted file mode 100644 index ab5d7ce1b1..0000000000 --- a/ui/test/dashboards/components/GraphOptionsCustomizableColumn.test.tsx +++ /dev/null @@ -1,102 +0,0 @@ -import React from 'react' - -import GraphOptionsCustomizableColumn from 'src/dashboards/components/GraphOptionsCustomizableColumn' -import InputClickToEdit from 'src/shared/components/InputClickToEdit' - -import {shallow} from 'enzyme' - -const setup = (override = {}) => { - const props = { - internalName: '', - displayName: '', - visible: true, - onColumnUpdate: () => {}, - ...override, - } - - const wrapper = shallow() - const instance = wrapper.instance() as GraphOptionsCustomizableColumn - - return {wrapper, props, instance} -} - -describe('Dashboards.Components.GraphOptionsCustomizableColumn', () => { - describe('rendering', () => { - it('displays both label div and InputClickToEdit', () => { - const {wrapper} = setup() - const label = wrapper.find('div').last() - const input = wrapper.find(InputClickToEdit) - const icon = wrapper.find('span') - - expect(label.exists()).toBe(true) - expect(icon.exists()).toBe(true) - expect(input.exists()).toBe(true) - }) - - describe('when there is an internalName', () => { - it('displays the value', () => { - const internalName = 'test' - const {wrapper} = setup({internalName}) - const label = wrapper.find('div').last() - const icon = wrapper.find('span') - - expect(label.exists()).toBe(true) - expect(label.children().contains(internalName)).toBe(true) - expect(icon.exists()).toBe(true) - }) - }) - - describe('when visible is false', () => { - it('displays disabled inputClickToEdit', () => { - const visible = false - const {wrapper} = setup({visible}) - const input = wrapper.find(InputClickToEdit) - - expect(input.prop('disabled')).toBe(!visible) - }) - }) - }) - - describe('instance methods', () => { - describe('#handleColumnUpdate', () => { - it('calls onColumnUpdate once with internalName, new name, and visible', () => { - const onColumnUpdate = jest.fn() - const internalName = 'test' - const {instance, props: {visible}} = setup({ - onColumnUpdate, - internalName, - }) - const rename = 'TEST' - - instance.handleColumnRename(rename) - - expect(onColumnUpdate).toHaveBeenCalledTimes(1) - expect(onColumnUpdate).toHaveBeenCalledWith({ - internalName, - displayName: rename, - visible, - }) - }) - }) - - describe('#handleToggleVisible', () => { - it('calls onColumnUpdate once with !visible, internalName, and displayName', () => { - const onColumnUpdate = jest.fn() - const visible = true - const {instance, props: {internalName, displayName}} = setup({ - visible, - onColumnUpdate, - }) - - instance.handleToggleVisible() - - expect(onColumnUpdate).toHaveBeenCalledTimes(1) - expect(onColumnUpdate).toHaveBeenCalledWith({ - internalName, - displayName, - visible: !visible, - }) - }) - }) - }) -}) diff --git a/ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx b/ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx deleted file mode 100644 index 4fd67f34ee..0000000000 --- a/ui/test/dashboards/components/GraphOptionsCustomizeColumns.test.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react' - -import GraphOptionsCustomizeColumns from 'src/dashboards/components/GraphOptionsCustomizeColumns' -import GraphOptionsCustomizableColumn from 'src/dashboards/components/GraphOptionsCustomizableColumn' -import {TIME_COLUMN_DEFAULT} from 'src/shared/constants/tableGraph' - -import {shallow} from 'enzyme' - -const setup = (override = {}) => { - const props = { - columns: [], - onColumnUpdate: () => {}, - ...override, - } - - const wrapper = shallow() - - return {wrapper, props} -} - -describe('Dashboards.Components.GraphOptionsCustomizeColumns', () => { - describe('rendering', () => { - it('displays label and all columns passed in', () => { - const columns = [TIME_COLUMN_DEFAULT] - const {wrapper} = setup({columns}) - const label = wrapper.find('label') - const customizableColumns = wrapper.find(GraphOptionsCustomizableColumn) - - expect(label.exists()).toBe(true) - expect(customizableColumns.exists()).toBe(true) - expect(customizableColumns.length).toBe(columns.length) - }) - }) -}) diff --git a/ui/test/dashboards/components/TableOptions.test.tsx b/ui/test/dashboards/components/TableOptions.test.tsx index 79dbc59149..bf9618f857 100644 --- a/ui/test/dashboards/components/TableOptions.test.tsx +++ b/ui/test/dashboards/components/TableOptions.test.tsx @@ -7,7 +7,7 @@ import GraphOptionsTimeFormat from 'src/dashboards/components/GraphOptionsTimeFo import GraphOptionsTimeAxis from 'src/dashboards/components/GraphOptionsTimeAxis' import GraphOptionsSortBy from 'src/dashboards/components/GraphOptionsSortBy' import GraphOptionsTextWrapping from 'src/dashboards/components/GraphOptionsTextWrapping' -import GraphOptionsCustomizeColumns from 'src/dashboards/components/GraphOptionsCustomizeColumns' +import GraphOptionsCustomizeFields from 'src/dashboards/components/GraphOptionsCustomizeFields' import ThresholdsList from 'src/shared/components/ThresholdsList' import ThresholdsListTypeToggle from 'src/shared/components/ThresholdsListTypeToggle' import GraphOptionsFixFirstColumn from 'src/dashboards/components/GraphOptionsFixFirstColumn' @@ -49,9 +49,9 @@ const defaultProps = { tableOptions: { timeFormat: '', verticalTimeAxis: true, - sortBy: {internalName: '', displayName: ''}, + sortBy: {internalName: '', displayName: '', visible: true}, wrapping: '', - columnNames: [], + fieldNames: [], fixFirstColumn: true, }, onResetFocus: () => {}, @@ -97,7 +97,7 @@ describe('Dashboards.Components.TableOptions', () => { }, ] - expect(instance.computedColumnNames).toEqual(expected) + expect(instance.computedFieldNames).toEqual(expected) }) }) }) @@ -136,8 +136,8 @@ describe('Dashboards.Components.TableOptions', () => { const graphOptionsFixFirstColumn = wrapper.find( GraphOptionsFixFirstColumn ) - const graphOptionsCustomizeColumns = wrapper.find( - GraphOptionsCustomizeColumns + const graphOptionsCustomizeFields = wrapper.find( + GraphOptionsCustomizeFields ) const thresholdsList = wrapper.find(ThresholdsList) const thresholdsListTypeToggle = wrapper.find(ThresholdsListTypeToggle) @@ -152,7 +152,7 @@ describe('Dashboards.Components.TableOptions', () => { expect(graphOptionsSortBy.exists()).toBe(true) expect(graphOptionsTextWrapping.exists()).toBe(true) expect(graphOptionsFixFirstColumn.exists()).toBe(true) - expect(graphOptionsCustomizeColumns.exists()).toBe(true) + expect(graphOptionsCustomizeFields.exists()).toBe(true) expect(thresholdsList.exists()).toBe(true) expect(thresholdsListTypeToggle.exists()).toBe(true) }) From c644c77364c76edaf261bdfa107bd4ea065e1730 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Fri, 16 Mar 2018 18:00:27 -0700 Subject: [PATCH 08/38] add renamed files from columnNames to fieldName changes --- .../GraphOptionsCustomizableField.tsx | 62 +++++++++++ .../GraphOptionsCustomizeFields.tsx | 36 +++++++ .../GraphOptionsCustomizableField.test.tsx | 102 ++++++++++++++++++ .../GraphOptionsCustomizeFields.test.tsx | 34 ++++++ 4 files changed, 234 insertions(+) create mode 100644 ui/src/dashboards/components/GraphOptionsCustomizableField.tsx create mode 100644 ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx create mode 100644 ui/test/dashboards/components/GraphOptionsCustomizableField.test.tsx create mode 100644 ui/test/dashboards/components/GraphOptionsCustomizeFields.test.tsx diff --git a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx new file mode 100644 index 0000000000..829f05443e --- /dev/null +++ b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx @@ -0,0 +1,62 @@ +import React, {PureComponent} from 'react' + +import InputClickToEdit from 'src/shared/components/InputClickToEdit' + +type Field = { + internalName: string + displayName: string + visible: boolean +} + +interface Props { + internalName: string + displayName: string + visible: boolean + onFieldUpdate: (field: Field) => void +} + +class GraphOptionsCustomizableField extends PureComponent { + constructor(props) { + super(props) + + this.handleFieldRename = this.handleFieldRename.bind(this) + this.handleToggleVisible = this.handleToggleVisible.bind(this) + } + + handleFieldRename(rename: string) { + const {onFieldUpdate, internalName, visible} = this.props + onFieldUpdate({internalName, displayName: rename, visible}) + } + + handleToggleVisible() { + const {onFieldUpdate, internalName, displayName, visible} = this.props + onFieldUpdate({internalName, displayName, visible: !visible}) + } + + render() { + const {internalName, displayName, visible} = this.props + + return ( +
+
+ + {internalName} +
+ +
+ ) + } +} + +export default GraphOptionsCustomizableField diff --git a/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx b/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx new file mode 100644 index 0000000000..7683e329da --- /dev/null +++ b/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx @@ -0,0 +1,36 @@ +import React, {SFC} from 'react' + +import GraphOptionsCustomizableField from 'src/dashboards/components/GraphOptionsCustomizableField' +import uuid from 'uuid' + +type Field = { + internalName: string + displayName: string + visible: boolean +} + +interface Props { + fields: Field[] + onFieldUpdate: (field: Field) => void +} + +const GraphOptionsCustomizeFields: SFC = ({fields, onFieldUpdate}) => { + return ( +
+ + {fields.map(field => { + return ( + + ) + })} +
+ ) +} + +export default GraphOptionsCustomizeFields diff --git a/ui/test/dashboards/components/GraphOptionsCustomizableField.test.tsx b/ui/test/dashboards/components/GraphOptionsCustomizableField.test.tsx new file mode 100644 index 0000000000..cf41d10e35 --- /dev/null +++ b/ui/test/dashboards/components/GraphOptionsCustomizableField.test.tsx @@ -0,0 +1,102 @@ +import React from 'react' + +import GraphOptionsCustomizableField from 'src/dashboards/components/GraphOptionsCustomizableField' +import InputClickToEdit from 'src/shared/components/InputClickToEdit' + +import {shallow} from 'enzyme' + +const setup = (override = {}) => { + const props = { + internalName: '', + displayName: '', + visible: true, + onFieldUpdate: () => {}, + ...override, + } + + const wrapper = shallow() + const instance = wrapper.instance() as GraphOptionsCustomizableField + + return {wrapper, props, instance} +} + +describe('Dashboards.Components.GraphOptionsCustomizableField', () => { + describe('rendering', () => { + it('displays both label div and InputClickToEdit', () => { + const {wrapper} = setup() + const label = wrapper.find('div').last() + const input = wrapper.find(InputClickToEdit) + const icon = wrapper.find('span') + + expect(label.exists()).toBe(true) + expect(icon.exists()).toBe(true) + expect(input.exists()).toBe(true) + }) + + describe('when there is an internalName', () => { + it('displays the value', () => { + const internalName = 'test' + const {wrapper} = setup({internalName}) + const label = wrapper.find('div').last() + const icon = wrapper.find('span') + + expect(label.exists()).toBe(true) + expect(label.children().contains(internalName)).toBe(true) + expect(icon.exists()).toBe(true) + }) + }) + + describe('when visible is false', () => { + it('displays disabled inputClickToEdit', () => { + const visible = false + const {wrapper} = setup({visible}) + const input = wrapper.find(InputClickToEdit) + + expect(input.prop('disabled')).toBe(!visible) + }) + }) + }) + + describe('instance methods', () => { + describe('#handleFieldUpdate', () => { + it('calls onFieldUpdate once with internalName, new name, and visible', () => { + const onFieldUpdate = jest.fn() + const internalName = 'test' + const {instance, props: {visible}} = setup({ + onFieldUpdate, + internalName, + }) + const rename = 'TEST' + + instance.handleFieldRename(rename) + + expect(onFieldUpdate).toHaveBeenCalledTimes(1) + expect(onFieldUpdate).toHaveBeenCalledWith({ + internalName, + displayName: rename, + visible, + }) + }) + }) + + describe('#handleToggleVisible', () => { + it('calls onFieldUpdate once with !visible, internalName, and displayName', () => { + const onFieldUpdate = jest.fn() + const visible = true + const {instance, props: {internalName, displayName}} = setup({ + visible, + onFieldUpdate, + }) + + instance.handleToggleVisible() + + expect(onFieldUpdate).toHaveBeenCalledTimes(1) + expect(onFieldUpdate).toHaveBeenCalledWith({ + internalName, + displayName, + visible: !visible, + }) + }) + }) + }) +}) diff --git a/ui/test/dashboards/components/GraphOptionsCustomizeFields.test.tsx b/ui/test/dashboards/components/GraphOptionsCustomizeFields.test.tsx new file mode 100644 index 0000000000..107a191d72 --- /dev/null +++ b/ui/test/dashboards/components/GraphOptionsCustomizeFields.test.tsx @@ -0,0 +1,34 @@ +import React from 'react' + +import GraphOptionsCustomizeFields from 'src/dashboards/components/GraphOptionsCustomizeFields' +import GraphOptionsCustomizableField from 'src/dashboards/components/GraphOptionsCustomizableField' +import {TIME_FIELD_DEFAULT} from 'src/shared/constants/tableGraph' + +import {shallow} from 'enzyme' + +const setup = (override = {}) => { + const props = { + fields: [], + onFieldUpdate: () => {}, + ...override, + } + + const wrapper = shallow() + + return {wrapper, props} +} + +describe('Dashboards.Components.GraphOptionsCustomizableField', () => { + describe('rendering', () => { + it('displays label and all fields passed in', () => { + const fields = [TIME_FIELD_DEFAULT] + const {wrapper} = setup({fields}) + const label = wrapper.find('label') + const CustomizableFields = wrapper.find(GraphOptionsCustomizableField) + + expect(label.exists()).toBe(true) + expect(CustomizableFields.exists()).toBe(true) + expect(CustomizableFields.length).toBe(fields.length) + }) + }) +}) From fe47c672448ee5e53ab1056443e42af482505da8 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Mon, 19 Mar 2018 11:57:36 -0700 Subject: [PATCH 09/38] add scrolling to customizeFields when there are a lot of them in CEO options --- .../GraphOptionsCustomizableField.tsx | 2 +- .../GraphOptionsCustomizeFields.tsx | 24 ++++++++++--------- ui/src/dashboards/components/TableOptions.tsx | 2 +- .../style/components/ceo-display-options.scss | 5 +++- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx index 829f05443e..351ac1faf6 100644 --- a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx +++ b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx @@ -28,7 +28,7 @@ class GraphOptionsCustomizableField extends PureComponent { onFieldUpdate({internalName, displayName: rename, visible}) } - handleToggleVisible() { + handleToggleVisible(e) { const {onFieldUpdate, internalName, displayName, visible} = this.props onFieldUpdate({internalName, displayName, visible: !visible}) } diff --git a/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx b/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx index 7683e329da..788af1961b 100644 --- a/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx +++ b/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx @@ -18,17 +18,19 @@ const GraphOptionsCustomizeFields: SFC = ({fields, onFieldUpdate}) => { return (
- {fields.map(field => { - return ( - - ) - })} +
+ {fields.map(field => { + return ( + + ) + })} +
) } diff --git a/ui/src/dashboards/components/TableOptions.tsx b/ui/src/dashboards/components/TableOptions.tsx index 233b3222ff..bc904fb665 100644 --- a/ui/src/dashboards/components/TableOptions.tsx +++ b/ui/src/dashboards/components/TableOptions.tsx @@ -123,7 +123,7 @@ export class TableOptions extends PureComponent { const {handleUpdateTableOptions, tableOptions} = this.props const {fieldNames} = tableOptions const updatedFields = fieldNames.map( - op => (op.internalName === field.internalName ? field : op) + f => (f.internalName === field.internalName ? field : f) ) handleUpdateTableOptions({...tableOptions, fieldNames: updatedFields}) } diff --git a/ui/src/style/components/ceo-display-options.scss b/ui/src/style/components/ceo-display-options.scss index 8212fd7413..526c6a462c 100644 --- a/ui/src/style/components/ceo-display-options.scss +++ b/ui/src/style/components/ceo-display-options.scss @@ -256,7 +256,10 @@ button.btn.btn-primary.btn-sm.gauge-controls--add-threshold { flex: 1 0 0; } - +.field-controls--group { + max-height: 235px; + overflow-y: scroll; +} .field-controls--label, .field-controls--label-hidden { @extend %gauge-controls-label-styles; color: $g16-pearl; From 11d872f16ecc5a70c5410cf3faeb2cb4fe887e82 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Tue, 20 Mar 2018 12:57:02 -0700 Subject: [PATCH 10/38] rebase to master and fix bugs --- .../GraphOptionsCustomizableField.tsx | 2 +- .../dashboards/reducers/cellEditorOverlay.js | 2 - ui/src/shared/components/TableGraph.js | 75 +++++++++---------- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx index 351ac1faf6..829f05443e 100644 --- a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx +++ b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx @@ -28,7 +28,7 @@ class GraphOptionsCustomizableField extends PureComponent { onFieldUpdate({internalName, displayName: rename, visible}) } - handleToggleVisible(e) { + handleToggleVisible() { const {onFieldUpdate, internalName, displayName, visible} = this.props onFieldUpdate({internalName, displayName, visible: !visible}) } diff --git a/ui/src/dashboards/reducers/cellEditorOverlay.js b/ui/src/dashboards/reducers/cellEditorOverlay.js index 402f488f64..4629e89750 100644 --- a/ui/src/dashboards/reducers/cellEditorOverlay.js +++ b/ui/src/dashboards/reducers/cellEditorOverlay.js @@ -11,8 +11,6 @@ import { import {initializeOptions} from 'src/dashboards/constants/cellEditor' -import {initializeOptions} from 'src/shared/constants/tableGraph' - export const initialState = { cell: null, thresholdsListType: THRESHOLD_TYPE_TEXT, diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index b6a9e90cb5..444516cc4a 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -18,27 +18,26 @@ import { } from 'src/shared/constants/tableGraph' import {generateThresholdsListHexs} from 'shared/constants/colorOperations' -const filterInvisibleRows = (data, verticalTimeAxis, fieldNames) => { - let visibleData = [[]] - if (verticalTimeAxis) { - const visibleColumns = {} - visibleData = data.map((row, i) => { - return row.filter((col, j) => { - if (i === 0) { - const foundField = fieldNames.find( - field => field.internalName === col - ) - visibleColumns[j] = foundField && foundField.visible - } - return visibleColumns[j] - }) +const filterInvisibleRows = (data, fieldNames) => { + const visibleData = data.filter(row => { + const foundField = fieldNames.find(field => field.internalName === row[0]) + return foundField && foundField.visible + }) + + return visibleData.length ? visibleData : [[]] +} + +const filterInvisibleColumns = (data, fieldNames) => { + const visibleColumns = {} + visibleData = data.map((row, i) => { + return row.filter((col, j) => { + if (i === 0) { + const foundField = fieldNames.find(field => field.internalName === col) + visibleColumns[j] = foundField && foundField.visible + } + return visibleColumns[j] }) - } else { - visibleData = data.filter(row => { - const foundField = fieldNames.find(field => field.internalName === row[0]) - return foundField && foundField.visible - }) - } + }) return visibleData[0].length ? visibleData : [[]] } @@ -59,29 +58,29 @@ class TableGraph extends Component { componentWillReceiveProps(nextProps) { const {data, unzippedData} = timeSeriesToTableGraph(nextProps.data) - const { tableOptions: {sortBy: {internalName}, fieldNames, verticalTimeAxis}, } = nextProps - const sortByColumnIndex = _.indexOf(data[0], internalName) - const sortedData = [ - data[0], - ..._.sortBy(_.drop(data, 1), sortByColumnIndex), - ] + if (!isEmpty(data[0])) { + const sortedData = [ + data[0], + ..._.sortBy(_.drop(data, 1), sortByColumnIndex), + ] - const visibleData = filterInvisibleRows( - sortedData, - verticalTimeAxis, - fieldNames - ) + const sortByColumnIndex = _.indexOf(data[0], internalName) - this.setState({ - data: sortedData, - visibleData, - unzippedData, - sortByColumnIndex, - }) + const visibleData = verticalTimeAxis + ? filterInvisibleColumns(sortedData, fieldNames) + : filterInvisibleRows(sortedData, fieldNames) + + this.setState({ + data: sortedData, + visibleData, + unzippedData, + sortByColumnIndex, + }) + } } calcHoverTimeIndex = (data, hoverTime, verticalTimeAxis) => { @@ -238,7 +237,7 @@ class TableGraph extends Component { ref={gridContainer => (this.gridContainer = gridContainer)} onMouseOut={this.handleMouseOut} > - {!isEmpty(visibleData) && + {!isEmpty(data) && Date: Tue, 20 Mar 2018 13:00:04 -0700 Subject: [PATCH 11/38] update tableoptions.test with visible --- ui/test/dashboards/components/TableOptions.test.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ui/test/dashboards/components/TableOptions.test.tsx b/ui/test/dashboards/components/TableOptions.test.tsx index bf9618f857..40bbdec134 100644 --- a/ui/test/dashboards/components/TableOptions.test.tsx +++ b/ui/test/dashboards/components/TableOptions.test.tsx @@ -78,22 +78,27 @@ describe('Dashboards.Components.TableOptions', () => { { displayName: '', internalName: 'time', + visible: true, }, { displayName: '', internalName: 'dev.boom', + visible: true, }, { displayName: '', internalName: 'dev.again', + visible: true, }, { displayName: '', internalName: 'prod.boom', + visible: true, }, { displayName: '', internalName: 'prod.again', + visible: true, }, ] From 25ab47c68968cfb69484c8b3d0a6c56b8fa7f159 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Tue, 20 Mar 2018 15:38:19 -0700 Subject: [PATCH 12/38] WIP get labels from tableGraph instead of building them in tableOptions --- .../components/CellEditorOverlay.js | 8 +++++++ .../dashboards/components/DisplayOptions.js | 3 +++ ui/src/dashboards/components/TableOptions.tsx | 21 +++++++------------ ui/src/dashboards/components/Visualization.js | 3 +++ ui/src/shared/components/RefreshingGraph.js | 3 +++ ui/src/shared/components/TableGraph.js | 15 ++++++++----- ui/src/utils/timeSeriesToDygraph.js | 1 + 7 files changed, 35 insertions(+), 19 deletions(-) diff --git a/ui/src/dashboards/components/CellEditorOverlay.js b/ui/src/dashboards/components/CellEditorOverlay.js index f866f61bb9..d096404c63 100644 --- a/ui/src/dashboards/components/CellEditorOverlay.js +++ b/ui/src/dashboards/components/CellEditorOverlay.js @@ -48,6 +48,7 @@ class CellEditorOverlay extends Component { activeQueryIndex: 0, isDisplayOptionsTabActive: false, staticLegend: IS_STATIC_LEGEND(legend), + dataLabels: [], } } @@ -259,6 +260,10 @@ class CellEditorOverlay extends Component { this.overlayRef.focus() } + setDataLabels = dataLabels => { + this.setState({dataLabels}) + } + render() { const { onCancel, @@ -273,6 +278,7 @@ class CellEditorOverlay extends Component { isDisplayOptionsTabActive, queriesWorkingDraft, staticLegend, + dataLabels, } = this.state const queryActions = { @@ -305,6 +311,7 @@ class CellEditorOverlay extends Component { queryConfigs={queriesWorkingDraft} editQueryStatus={editQueryStatus} staticLegend={staticLegend} + setDataLabels={this.setDataLabels} /> : ) default: @@ -93,6 +95,7 @@ DisplayOptions.propTypes = { onToggleStaticLegend: func.isRequired, staticLegend: bool, onResetFocus: func.isRequired, + dataLabels: arrayOf(string), } const mapStateToProps = ({cellEditorOverlay: {cell, cell: {axes}}}) => ({ diff --git a/ui/src/dashboards/components/TableOptions.tsx b/ui/src/dashboards/components/TableOptions.tsx index bc904fb665..83fcb2aa14 100644 --- a/ui/src/dashboards/components/TableOptions.tsx +++ b/ui/src/dashboards/components/TableOptions.tsx @@ -46,6 +46,7 @@ interface Props { handleUpdateTableOptions: (options: Options) => void tableOptions: Options onResetFocus: () => void + dataLabels: string[] } export class TableOptions extends PureComponent { @@ -65,21 +66,12 @@ export class TableOptions extends PureComponent { } get computedFieldNames() { - const {queryConfigs} = this.props + const {dataLabels} = this.props - const queryFields = _.flatten( - queryConfigs.map(({measurement, fields}) => { - return fields.map(({alias}) => { - const internalName = `${measurement}.${alias}` - const existing = this.fieldNames.find( - f => f.internalName === internalName - ) - return existing || {internalName, displayName: '', visible: true} - }) - }) - ) - - return [this.timeColumn, ...queryFields] + return dataLabels.map(label => { + const existing = this.fieldNames.find(f => f.internalName === label) + return existing || {internalName: label, displayName: '', visible: true} + }) } componentWillMount() { @@ -133,6 +125,7 @@ export class TableOptions extends PureComponent { tableOptions: {timeFormat, fieldNames, verticalTimeAxis, fixFirstColumn}, onResetFocus, tableOptions, + dataLabels, } = this.props const tableSortByOptions = this.computedFieldNames.map(col => ({ diff --git a/ui/src/dashboards/components/Visualization.js b/ui/src/dashboards/components/Visualization.js index a8b48313ce..d84a76ed06 100644 --- a/ui/src/dashboards/components/Visualization.js +++ b/ui/src/dashboards/components/Visualization.js @@ -22,6 +22,7 @@ const DashVisualization = ( staticLegend, thresholdsListColors, tableOptions, + setDataLabels, }, {source: {links: {proxy}}} ) => { @@ -42,6 +43,7 @@ const DashVisualization = ( editQueryStatus={editQueryStatus} resizerTopHeight={resizerTopHeight} staticLegend={staticLegend} + setDataLabels={setDataLabels} />
@@ -86,6 +88,7 @@ DashVisualization.propTypes = { }).isRequired ), staticLegend: bool, + setDataLabels: func, } DashVisualization.contextTypes = { diff --git a/ui/src/shared/components/RefreshingGraph.js b/ui/src/shared/components/RefreshingGraph.js index 5d732a38ce..8a8399e1c2 100644 --- a/ui/src/shared/components/RefreshingGraph.js +++ b/ui/src/shared/components/RefreshingGraph.js @@ -23,6 +23,7 @@ const RefreshingGraph = ({ cellID, queries, tableOptions, + setDataLabels, templates, timeRange, cellHeight, @@ -100,6 +101,7 @@ const RefreshingGraph = ({ hoverTime={hoverTime} onSetHoverTime={onSetHoverTime} inView={inView} + setDataLabels={setDataLabels} /> ) } @@ -166,6 +168,7 @@ RefreshingGraph.propTypes = { cellID: string, inView: bool, tableOptions: shape({}), + setDataLabels: func, } RefreshingGraph.defaultProps = { diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index 444516cc4a..c301b88992 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -29,7 +29,7 @@ const filterInvisibleRows = (data, fieldNames) => { const filterInvisibleColumns = (data, fieldNames) => { const visibleColumns = {} - visibleData = data.map((row, i) => { + const visibleData = data.map((row, i) => { return row.filter((col, j) => { if (i === 0) { const foundField = fieldNames.find(field => field.internalName === col) @@ -57,19 +57,23 @@ class TableGraph extends Component { } componentWillReceiveProps(nextProps) { - const {data, unzippedData} = timeSeriesToTableGraph(nextProps.data) + const {labels, data, unzippedData} = timeSeriesToTableGraph(nextProps.data) const { tableOptions: {sortBy: {internalName}, fieldNames, verticalTimeAxis}, + setDataLabels, } = nextProps - if (!isEmpty(data[0])) { + if (setDataLabels) { + setDataLabels(labels) + } + + const sortByColumnIndex = _.indexOf(data[0], internalName) + const sortedData = [ data[0], ..._.sortBy(_.drop(data, 1), sortByColumnIndex), ] - const sortByColumnIndex = _.indexOf(data[0], internalName) - const visibleData = verticalTimeAxis ? filterInvisibleColumns(sortedData, fieldNames) : filterInvisibleRows(sortedData, fieldNames) @@ -287,6 +291,7 @@ TableGraph.propTypes = { value: string.isRequired, }).isRequired ), + setDataLabels: func, } export default TableGraph diff --git a/ui/src/utils/timeSeriesToDygraph.js b/ui/src/utils/timeSeriesToDygraph.js index b5d18c3cc9..03e16dba0e 100644 --- a/ui/src/utils/timeSeriesToDygraph.js +++ b/ui/src/utils/timeSeriesToDygraph.js @@ -180,6 +180,7 @@ export const timeSeriesToTableGraph = raw => { const data = tableData.length ? [labels, ...tableData] : [[]] const unzippedData = _.unzip(data) return { + labels, data, unzippedData, } From 599b5718dc972261632d92c0d70df0c3d32a4d5c Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Tue, 20 Mar 2018 17:29:19 -0700 Subject: [PATCH 13/38] rebase branch to master --- ui/src/shared/components/TableGraph.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index c301b88992..fb4b66a2e7 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -135,7 +135,7 @@ class TableGraph extends Component { const columnCount = _.get(data, ['0', 'length'], 0) const rowCount = data.length const timeFormat = _.get(tableOptions, 'timeFormat', TIME_FORMAT_DEFAULT) - const columnNames = _.get(tableOptions, 'fieldNames', [TIME_FIELD_DEFAULT]) + const fieldNames = _.get(tableOptions, 'fieldNames', [TIME_FIELD_DEFAULT]) const fixFirstColumn = _.get( tableOptions, 'fixFirstColumn', From 59f05bb84c58f428d9b47e005cb5ea4809b39eed Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Tue, 20 Mar 2018 18:54:35 -0700 Subject: [PATCH 14/38] fix time formattin bug Co-authored-by: Deniz Kusefoglu --- .../dashboards/components/GraphOptionsTimeFormat.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx b/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx index cb794d4c48..2db452f300 100644 --- a/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx +++ b/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx @@ -35,18 +35,22 @@ class GraphOptionsTimeFormat extends PureComponent { return this.props.onTimeFormatChange } + handleChangeFormat = format => { + this.onTimeFormatChange(format) + this.setState({format}) + } + handleChooseFormat = (formatOption: TimeFormatOptions) => { if (formatOption.text === TIME_FORMAT_CUSTOM) { this.setState({customFormat: true}) } else { - this.setState({format: formatOption.text, customFormat: false}) this.onTimeFormatChange(formatOption.text) + this.setState({format: formatOption.text, customFormat: false}) } } render() { const {format, customFormat} = this.state - const {onTimeFormatChange} = this.props const tipContent = 'For information on formatting, see http://momentjs.com/docs/#/parsing/string-format/' @@ -76,8 +80,8 @@ class GraphOptionsTimeFormat extends PureComponent { From f87c380b22fdfd3f94d3e2f3389270fff6deb656 Mon Sep 17 00:00:00 2001 From: ebb-tide Date: Tue, 20 Mar 2018 20:03:12 -0700 Subject: [PATCH 15/38] set null row and column to null array index --- ui/src/shared/components/TableGraph.js | 25 ++++++++++++------------- ui/src/shared/constants/tableGraph.js | 3 +-- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index 7271ea32c8..218afb7174 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -9,8 +9,7 @@ import moment from 'moment' import {timeSeriesToTableGraph} from 'src/utils/timeSeriesToDygraph' import { - NULL_COLUMN_INDEX, - NULL_ROW_INDEX, + NULL_ARRAY_INDEX, NULL_HOVER_TIME, TIME_FORMAT_DEFAULT, TIME_FIELD_DEFAULT, @@ -53,10 +52,10 @@ class TableGraph extends Component { data: [[]], unzippedData: [[]], visibleData: [[]], - hoveredColumnIndex: NULL_COLUMN_INDEX, - hoveredRowIndex: NULL_ROW_INDEX, - sortByColumnIndex: NULL_COLUMN_INDEX, - clickToSortFieldIndex: NULL_COLUMN_INDEX, + hoveredColumnIndex: NULL_ARRAY_INDEX, + hoveredRowIndex: NULL_ARRAY_INDEX, + sortByColumnIndex: NULL_ARRAY_INDEX, + clickToSortFieldIndex: NULL_ARRAY_INDEX, clicktoSortDirection: DEFAULT_SORT, } } @@ -78,7 +77,7 @@ class TableGraph extends Component { } if ( - sortByColumnIndex === NULL_COLUMN_INDEX || + sortByColumnIndex === NULL_ARRAY_INDEX || _.get(this.props, ['tableOptions', 'sortBy', 'internalName'], '') !== internalName ) { @@ -97,12 +96,12 @@ class TableGraph extends Component { visibleData, unzippedData: _.unzip(sortedData), sortByColumnIndex: newSortByColumnIndex, - clickToSortFieldIndex: NULL_COLUMN_INDEX, + clickToSortFieldIndex: NULL_ARRAY_INDEX, clicktoSortDirection: DEFAULT_SORT, }) return } - const clicked = clickToSortFieldIndex !== NULL_COLUMN_INDEX + const clicked = clickToSortFieldIndex !== NULL_ARRAY_INDEX const sortIndex = clicked ? clickToSortFieldIndex : sortByColumnIndex const direction = clicked ? clicktoSortDirection : DEFAULT_SORT const sortedData = [ @@ -151,8 +150,8 @@ class TableGraph extends Component { if (this.props.onSetHoverTime) { this.props.onSetHoverTime(NULL_HOVER_TIME) this.setState({ - hoveredColumnIndex: NULL_COLUMN_INDEX, - hoveredRowIndex: NULL_ROW_INDEX, + hoveredColumnIndex: NULL_ARRAY_INDEX, + hoveredRowIndex: NULL_ARRAY_INDEX, }) } } @@ -297,11 +296,11 @@ class TableGraph extends Component { const tableWidth = _.get(this, ['gridContainer', 'clientWidth'], 0) const tableHeight = _.get(this, ['gridContainer', 'clientHeight'], 0) const hoverTimeIndex = - hoveredRowIndex === NULL_ROW_INDEX + hoveredRowIndex === NULL_ARRAY_INDEX ? this.calcHoverTimeIndex(data, hoverTime, verticalTimeAxis) : hoveredRowIndex const fixedColumnCount = tableOptions.fixFirstColumn ? 1 : undefined - const hoveringThisTable = hoveredColumnIndex !== NULL_COLUMN_INDEX + const hoveringThisTable = hoveredColumnIndex !== NULL_ARRAY_INDEX const scrollToRow = !hoveringThisTable && verticalTimeAxis ? hoverTimeIndex : undefined const scrollToColumn = diff --git a/ui/src/shared/constants/tableGraph.js b/ui/src/shared/constants/tableGraph.js index 90d524eebe..5687560ce8 100644 --- a/ui/src/shared/constants/tableGraph.js +++ b/ui/src/shared/constants/tableGraph.js @@ -1,5 +1,4 @@ -export const NULL_COLUMN_INDEX = -1 -export const NULL_ROW_INDEX = -1 +export const NULL_ARRAY_INDEX = -1 export const NULL_HOVER_TIME = '0' From f8cf8155a252d70fd2fad62da9def99ab417cebd Mon Sep 17 00:00:00 2001 From: ebb-tide Date: Tue, 20 Mar 2018 21:42:52 -0700 Subject: [PATCH 16/38] Make sorting sane --- ui/src/shared/components/TableGraph.js | 165 ++++++++++++------------- 1 file changed, 80 insertions(+), 85 deletions(-) diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index 218afb7174..4c6118c886 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -41,10 +41,27 @@ const filterInvisibleColumns = (data, fieldNames) => { return visibleColumns[j] }) }) - return visibleData[0].length ? visibleData : [[]] } +const processData = ( + data, + sortFieldName, + direction, + verticalTimeAxis, + fieldNames +) => { + const sortIndex = _.indexOf(data[0], sortFieldName) + const sortedData = [ + data[0], + ..._.orderBy(_.drop(data, 1), sortIndex, [direction]), + ] + const visibleData = verticalTimeAxis + ? filterInvisibleColumns(sortedData, fieldNames) + : filterInvisibleRows(sortedData, fieldNames) + return {sortedData, unzippedData: _.unzip(sortedData), visibleData} +} + class TableGraph extends Component { constructor(props) { super(props) @@ -54,69 +71,54 @@ class TableGraph extends Component { visibleData: [[]], hoveredColumnIndex: NULL_ARRAY_INDEX, hoveredRowIndex: NULL_ARRAY_INDEX, - sortByColumnIndex: NULL_ARRAY_INDEX, - clickToSortFieldIndex: NULL_ARRAY_INDEX, - clicktoSortDirection: DEFAULT_SORT, + sortField: '', + sortDirection: DEFAULT_SORT, } } componentWillReceiveProps(nextProps) { const {labels, data} = timeSeriesToTableGraph(nextProps.data) - const { - clickToSortFieldIndex, - clicktoSortDirection, - sortByColumnIndex, - } = this.state + if (isEmpty(data[0])) { + return + } + const {sortField, sortDirection} = this.state const { tableOptions: {sortBy: {internalName}, fieldNames, verticalTimeAxis}, setDataLabels, } = nextProps - if (!isEmpty(data[0])) { - if (setDataLabels) { - setDataLabels(labels) - } - if ( - sortByColumnIndex === NULL_ARRAY_INDEX || - _.get(this.props, ['tableOptions', 'sortBy', 'internalName'], '') !== - internalName - ) { - const newSortByColumnIndex = _.indexOf(data[0], internalName) - const sortedData = [ - data[0], - ..._.orderBy(_.drop(data, 1), newSortByColumnIndex, [DEFAULT_SORT]), - ] - - const visibleData = verticalTimeAxis - ? filterInvisibleColumns(sortedData, fieldNames) - : filterInvisibleRows(sortedData, fieldNames) - - this.setState({ - data: sortedData, - visibleData, - unzippedData: _.unzip(sortedData), - sortByColumnIndex: newSortByColumnIndex, - clickToSortFieldIndex: NULL_ARRAY_INDEX, - clicktoSortDirection: DEFAULT_SORT, - }) - return - } - const clicked = clickToSortFieldIndex !== NULL_ARRAY_INDEX - const sortIndex = clicked ? clickToSortFieldIndex : sortByColumnIndex - const direction = clicked ? clicktoSortDirection : DEFAULT_SORT - const sortedData = [ - data[0], - ..._.orderBy(_.drop(data, 1), sortIndex, [direction]), - ] - const visibleData = verticalTimeAxis - ? filterInvisibleColumns(sortedData, fieldNames) - : filterInvisibleRows(sortedData, fieldNames) - this.setState({ - data: sortedData, - visibleData, - unzippedData: _.unzip(sortedData), - }) + if (setDataLabels) { + setDataLabels(labels) } + + let direction, sortFieldName + if ( + _.isEmpty(sortField) || + _.get(this.props, ['tableOptions', 'sortBy', 'internalName'], '') !== + _.get(nextProps, ['tableOptions', 'sortBy', 'internalName'], '') + ) { + direction = DEFAULT_SORT + sortFieldName = internalName + } else { + direction = sortDirection + sortFieldName = sortField + } + + const {sortedData, unzippedData, visibleData} = processData( + data, + sortFieldName, + direction, + verticalTimeAxis, + fieldNames + ) + + this.setState({ + data: sortedData, + visibleData, + unzippedData, + sortField: sortFieldName, + sortDirection: direction, + }) } calcHoverTimeIndex = (data, hoverTime, verticalTimeAxis) => { @@ -156,36 +158,33 @@ class TableGraph extends Component { } } - handleClickFieldName = (columnIndex, rowIndex) => () => { + handleClickFieldName = fieldName => () => { const {tableOptions} = this.props - const {clickToSortFieldIndex, clicktoSortDirection, data} = this.state + const {data, sortField, sortDirection} = this.state const verticalTimeAxis = _.get(tableOptions, 'verticalTimeAxis', true) - const newIndex = verticalTimeAxis ? columnIndex : rowIndex + const fieldNames = _.get(tableOptions, 'fieldNames', [TIME_FIELD_DEFAULT]) - if (clickToSortFieldIndex === newIndex) { - const direction = - clicktoSortDirection === ASCENDING ? DESCENDING : ASCENDING - const sortedData = [ - data[0], - ..._.orderBy(_.drop(data, 1), clickToSortFieldIndex, [direction]), - ] - this.setState({ - data: sortedData, - unzippedData: _.unzip(sortedData), - clicktoSortDirection: direction, - }) - return + let direction + if (fieldName === sortField) { + direction = sortDirection === ASCENDING ? DESCENDING : ASCENDING + } else { + direction = DEFAULT_SORT } - const sortedData = [ - data[0], - ..._.orderBy(_.drop(data, 1), clickToSortFieldIndex, [DEFAULT_SORT]), - ] + const {sortedData, unzippedData, visibleData} = processData( + data, + fieldName, + direction, + verticalTimeAxis, + fieldNames + ) + this.setState({ data: sortedData, - unzippedData: _.unzip(sortedData), - clickToSortFieldIndex: newIndex, - clicktoSortDirection: DEFAULT_SORT, + unzippedData, + visibleData, + sortField: fieldName, + sortDirection: direction, }) } @@ -262,9 +261,7 @@ class TableGraph extends Component { key={key} style={cellStyle} className={cellClass} - onClick={ - isFieldName ? this.handleClickFieldName(columnIndex, rowIndex) : null - } + onClick={isFieldName ? this.handleClickFieldName(cellData) : null} onMouseOver={this.handleHover(columnIndex, rowIndex)} > {isTimeData @@ -276,11 +273,10 @@ class TableGraph extends Component { render() { const { - sortByColumnIndex, - clickToSortFieldIndex, - clicktoSortDirection, hoveredColumnIndex, hoveredRowIndex, + sortField, + sortDirection, } = this.state const {hoverTime, tableOptions, colors} = this.props const verticalTimeAxis = _.get(tableOptions, 'verticalTimeAxis', true) @@ -333,9 +329,8 @@ class TableGraph extends Component { scrollToRow={scrollToRow} scrollToColumn={scrollToColumn} verticalTimeAxis={verticalTimeAxis} - sortByColumnIndex={sortByColumnIndex} - clickToSortFieldIndex={clickToSortFieldIndex} - clicktoSortDirection={clicktoSortDirection} + sortField={sortField} + sortDirection={sortDirection} cellRenderer={this.cellRenderer} hoveredColumnIndex={hoveredColumnIndex} hoveredRowIndex={hoveredRowIndex} From 8f2f08b85b82cb2932ae1b9fb77a2caf0f41e180 Mon Sep 17 00:00:00 2001 From: ebb-tide Date: Tue, 20 Mar 2018 21:57:15 -0700 Subject: [PATCH 17/38] Pull isEmpty from lodash --- ui/src/shared/components/TableGraph.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index 4c6118c886..0bf331ffd8 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -2,7 +2,6 @@ import React, {Component} from 'react' import PropTypes from 'prop-types' import _ from 'lodash' import classnames from 'classnames' -import isEmpty from 'lodash/isEmpty' import {MultiGrid} from 'react-virtualized' import moment from 'moment' @@ -78,7 +77,7 @@ class TableGraph extends Component { componentWillReceiveProps(nextProps) { const {labels, data} = timeSeriesToTableGraph(nextProps.data) - if (isEmpty(data[0])) { + if (_.isEmpty(data[0])) { return } const {sortField, sortDirection} = this.state @@ -122,7 +121,7 @@ class TableGraph extends Component { } calcHoverTimeIndex = (data, hoverTime, verticalTimeAxis) => { - if (isEmpty(data) || hoverTime === NULL_HOVER_TIME) { + if (_.isEmpty(data) || hoverTime === NULL_HOVER_TIME) { return undefined } if (verticalTimeAxis) { @@ -308,7 +307,7 @@ class TableGraph extends Component { ref={gridContainer => (this.gridContainer = gridContainer)} onMouseOut={this.handleMouseOut} > - {!isEmpty(data) && + {!_.isEmpty(data) && Date: Wed, 21 Mar 2018 10:44:23 -0700 Subject: [PATCH 18/38] WIP add partial functionality for hiding columns/rows --- .../dashboards/components/GraphOptionsCustomizableField.tsx | 5 ++++- ui/src/shared/components/TableGraph.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx index 829f05443e..651cfa2a14 100644 --- a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx +++ b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx @@ -43,7 +43,10 @@ class GraphOptionsCustomizableField extends PureComponent { visible ? 'field-controls--label' : 'field-controls--label-hidden' } > - + {internalName}
Date: Wed, 21 Mar 2018 11:24:06 -0700 Subject: [PATCH 19/38] fix hiding columns when vertically flipped Co-authored-by: Deniz Kusefoglu --- ui/src/shared/components/TableGraph.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index 3bbd799e65..cd75a063b4 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -22,22 +22,23 @@ import {generateThresholdsListHexs} from 'shared/constants/colorOperations' const filterInvisibleRows = (data, fieldNames) => { const visibleData = data.filter(row => { - const foundField = fieldNames.find(field => field.internalName === row[0]) - return foundField && foundField.visible + const rowName = row[0] + const foundField = fieldNames.find(f => f.internalName === rowName) + return foundField ? foundField.visible : true }) return visibleData.length ? visibleData : [[]] } const filterInvisibleColumns = (data, fieldNames) => { - const visibleColumns = {} + const visibility = {} const visibleData = data.map((row, i) => { return row.filter((col, j) => { if (i === 0) { const foundField = fieldNames.find(field => field.internalName === col) - visibleColumns[j] = foundField && foundField.visible + visibility[j] = foundField ? foundField.visible : true } - return visibleColumns[j] + return visibility[j] }) }) return visibleData[0].length ? visibleData : [[]] @@ -192,7 +193,9 @@ class TableGraph extends Component { const {hoveredColumnIndex, hoveredRowIndex} = this.state const {tableOptions, colors} = this.props const verticalTimeAxis = _.get(tableOptions, 'verticalTimeAxis', true) - const data = verticalTimeAxis ? this.state.data : this.state.unzippedData + const data = verticalTimeAxis + ? this.state.visibleData + : this.state.unzippedData const timeFormat = _.get(tableOptions, 'timeFormat', TIME_FORMAT_DEFAULT) const fieldNames = _.get(tableOptions, 'fieldNames', [TIME_FIELD_DEFAULT]) const fixFirstColumn = _.get( From 784d9b8945602ab819fa08b229fc3e5581f5f8cd Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Wed, 21 Mar 2018 12:49:02 -0700 Subject: [PATCH 20/38] update processData functionality in tableGraph Co-authored-by: Deniz Kusefoglu --- ui/src/shared/components/TableGraph.js | 68 ++++++++++---------------- 1 file changed, 26 insertions(+), 42 deletions(-) diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index cd75a063b4..e5ebffde54 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -20,19 +20,9 @@ const DEFAULT_SORT = ASCENDING import {generateThresholdsListHexs} from 'shared/constants/colorOperations' -const filterInvisibleRows = (data, fieldNames) => { - const visibleData = data.filter(row => { - const rowName = row[0] - const foundField = fieldNames.find(f => f.internalName === rowName) - return foundField ? foundField.visible : true - }) - - return visibleData.length ? visibleData : [[]] -} - const filterInvisibleColumns = (data, fieldNames) => { const visibility = {} - const visibleData = data.map((row, i) => { + const filteredData = data.map((row, i) => { return row.filter((col, j) => { if (i === 0) { const foundField = fieldNames.find(field => field.internalName === col) @@ -41,7 +31,7 @@ const filterInvisibleColumns = (data, fieldNames) => { return visibility[j] }) }) - return visibleData[0].length ? visibleData : [[]] + return filteredData[0].length ? filteredData : [[]] } const processData = ( @@ -51,16 +41,15 @@ const processData = ( verticalTimeAxis, fieldNames ) => { - const sortIndex = _.indexOf(data[0], sortFieldName) + const filteredData = filterInvisibleColumns(data, fieldNames) + const sortIndex = _.indexOf(filteredData[0], sortFieldName) const sortedData = [ - data[0], - ..._.orderBy(_.drop(data, 1), sortIndex, [direction]), + filteredData[0], + ..._.orderBy(_.drop(filteredData, 1), sortIndex, [direction]), ] - const visibleData = verticalTimeAxis - ? filterInvisibleColumns(sortedData, fieldNames) - : filterInvisibleRows(_.unzip(sortedData), fieldNames) + const processedData = verticalTimeAxis ? sortedData : _.unzip(sortedData) - return {sortedData, unzippedData: _.unzip(sortedData), visibleData} + return {processedData} } class TableGraph extends Component { @@ -69,7 +58,8 @@ class TableGraph extends Component { this.state = { data: [[]], unzippedData: [[]], - visibleData: [[]], + filteredData: [[]], + processedData: [[]], hoveredColumnIndex: NULL_ARRAY_INDEX, hoveredRowIndex: NULL_ARRAY_INDEX, sortField: '', @@ -82,6 +72,7 @@ class TableGraph extends Component { if (_.isEmpty(data[0])) { return } + const {sortField, sortDirection} = this.state const { tableOptions: {sortBy: {internalName}, fieldNames, verticalTimeAxis}, @@ -105,7 +96,7 @@ class TableGraph extends Component { sortFieldName = sortField } - const {sortedData, unzippedData, visibleData} = processData( + const {processedData} = processData( data, sortFieldName, direction, @@ -114,9 +105,8 @@ class TableGraph extends Component { ) this.setState({ - data: sortedData, - visibleData, - unzippedData, + data, + processedData, sortField: sortFieldName, sortDirection: direction, }) @@ -172,7 +162,7 @@ class TableGraph extends Component { direction = DEFAULT_SORT } - const {sortedData, unzippedData, visibleData} = processData( + const {processedData} = processData( data, fieldName, direction, @@ -181,21 +171,17 @@ class TableGraph extends Component { ) this.setState({ - data: sortedData, - unzippedData, - visibleData, + processedData, sortField: fieldName, sortDirection: direction, }) } cellRenderer = ({columnIndex, rowIndex, key, parent, style}) => { - const {hoveredColumnIndex, hoveredRowIndex} = this.state + const {hoveredColumnIndex, hoveredRowIndex, processedData} = this.state const {tableOptions, colors} = this.props const verticalTimeAxis = _.get(tableOptions, 'verticalTimeAxis', true) - const data = verticalTimeAxis - ? this.state.visibleData - : this.state.unzippedData + const timeFormat = _.get(tableOptions, 'timeFormat', TIME_FORMAT_DEFAULT) const fieldNames = _.get(tableOptions, 'fieldNames', [TIME_FIELD_DEFAULT]) const fixFirstColumn = _.get( @@ -216,7 +202,7 @@ class TableGraph extends Component { const isFieldName = verticalTimeAxis ? rowIndex === 0 : columnIndex === 0 const isFixedCorner = rowIndex === 0 && columnIndex === 0 - const dataIsNumerical = _.isNumber(data[rowIndex][columnIndex]) + const dataIsNumerical = _.isNumber(processedData[rowIndex][columnIndex]) const isHighlightedRow = rowIndex === parent.props.scrollToRow || (rowIndex === hoveredRowIndex && hoveredRowIndex !== 0) @@ -229,7 +215,7 @@ class TableGraph extends Component { if (!isFixedRow && !isFixedColumn && !isFixedCorner) { const {bgColor, textColor} = generateThresholdsListHexs( colors, - data[rowIndex][columnIndex] + processedData[rowIndex][columnIndex] ) cellStyle = { @@ -249,7 +235,7 @@ class TableGraph extends Component { 'table-graph-cell__isFieldName': isFieldName, }) - const cellData = data[rowIndex][columnIndex] + const cellData = processedData[rowIndex][columnIndex] const foundField = fieldNames.find(field => field.internalName === cellData) const fieldName = @@ -279,16 +265,14 @@ class TableGraph extends Component { hoveredRowIndex, sortField, sortDirection, + processedData, + data, } = this.state const {hoverTime, tableOptions, colors} = this.props const verticalTimeAxis = _.get(tableOptions, 'verticalTimeAxis', true) - const data = verticalTimeAxis - ? this.state.visibleData - : this.state.unzippedData - - const columnCount = _.get(data, ['0', 'length'], 0) - const rowCount = data.length + const columnCount = _.get(processedData, ['0', 'length'], 0) + const rowCount = processedData.length const COLUMN_MIN_WIDTH = 98 const COLUMN_MAX_WIDTH = 500 const ROW_HEIGHT = 30 @@ -311,7 +295,7 @@ class TableGraph extends Component { ref={gridContainer => (this.gridContainer = gridContainer)} onMouseOut={this.handleMouseOut} > - {!_.isEmpty(data) && + {!_.isEmpty(processedData) && Date: Wed, 21 Mar 2018 14:25:48 -0700 Subject: [PATCH 21/38] fix hovertime issue in tableGraphs Co-authored-by: Deniz Kusefoglu --- ui/src/shared/components/TableGraph.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index e5ebffde54..edcdaba6fe 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -57,8 +57,6 @@ class TableGraph extends Component { super(props) this.state = { data: [[]], - unzippedData: [[]], - filteredData: [[]], processedData: [[]], hoveredColumnIndex: NULL_ARRAY_INDEX, hoveredRowIndex: NULL_ARRAY_INDEX, @@ -126,12 +124,16 @@ class TableGraph extends Component { handleHover = (columnIndex, rowIndex) => () => { const {onSetHoverTime, tableOptions: {verticalTimeAxis}} = this.props - const data = verticalTimeAxis ? this.state.data : this.state.unzippedData + const {data} = this.state + if (rowIndex === 0) { + return + } if (onSetHoverTime) { const hoverTime = verticalTimeAxis ? data[rowIndex][0] - : data[0][columnIndex] + : data[columnIndex][0] onSetHoverTime(hoverTime.toString()) + console.log(moment(hoverTime).format(this.props.tableOptions.timeFormat)) } this.setState({ hoveredColumnIndex: columnIndex, From adc33b20bf7c3d5e33e71d5a1bb2e281cad2515c Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Wed, 21 Mar 2018 14:26:58 -0700 Subject: [PATCH 22/38] remove console log --- ui/src/shared/components/TableGraph.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index edcdaba6fe..4dfaef20e7 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -133,7 +133,6 @@ class TableGraph extends Component { ? data[rowIndex][0] : data[columnIndex][0] onSetHoverTime(hoverTime.toString()) - console.log(moment(hoverTime).format(this.props.tableOptions.timeFormat)) } this.setState({ hoveredColumnIndex: columnIndex, From af513a75f727a00848d00cd8b80d0d775a5a0b87 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Wed, 21 Mar 2018 14:50:38 -0700 Subject: [PATCH 23/38] fix checking for empty data in tableGraph Co-authored-by: Deniz Kusefoglu --- ui/src/dashboards/components/TableOptions.tsx | 1 + ui/src/shared/components/TableGraph.js | 15 +++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ui/src/dashboards/components/TableOptions.tsx b/ui/src/dashboards/components/TableOptions.tsx index 37f57854c6..104a5f989d 100644 --- a/ui/src/dashboards/components/TableOptions.tsx +++ b/ui/src/dashboards/components/TableOptions.tsx @@ -119,6 +119,7 @@ export class TableOptions extends PureComponent { sortBy.internalName === field.internalName ? {...sortBy, displayName: field.displayName} : sortBy + handleUpdateTableOptions({ ...tableOptions, fieldNames: updatedFields, diff --git a/ui/src/shared/components/TableGraph.js b/ui/src/shared/components/TableGraph.js index 4dfaef20e7..75bdd52dec 100644 --- a/ui/src/shared/components/TableGraph.js +++ b/ui/src/shared/components/TableGraph.js @@ -41,13 +41,13 @@ const processData = ( verticalTimeAxis, fieldNames ) => { - const filteredData = filterInvisibleColumns(data, fieldNames) - const sortIndex = _.indexOf(filteredData[0], sortFieldName) + const sortIndex = _.indexOf(data[0], sortFieldName) const sortedData = [ - filteredData[0], - ..._.orderBy(_.drop(filteredData, 1), sortIndex, [direction]), + data[0], + ..._.orderBy(_.drop(data, 1), sortIndex, [direction]), ] - const processedData = verticalTimeAxis ? sortedData : _.unzip(sortedData) + const filteredData = filterInvisibleColumns(sortedData, fieldNames) + const processedData = verticalTimeAxis ? filteredData : _.unzip(filteredData) return {processedData} } @@ -273,7 +273,7 @@ class TableGraph extends Component { const verticalTimeAxis = _.get(tableOptions, 'verticalTimeAxis', true) const columnCount = _.get(processedData, ['0', 'length'], 0) - const rowCount = processedData.length + const rowCount = columnCount === 0 ? 0 : processedData.length const COLUMN_MIN_WIDTH = 98 const COLUMN_MAX_WIDTH = 500 const ROW_HEIGHT = 30 @@ -289,14 +289,13 @@ class TableGraph extends Component { !hoveringThisTable && verticalTimeAxis ? hoverTimeIndex : undefined const scrollToColumn = !hoveringThisTable && !verticalTimeAxis ? hoverTimeIndex : undefined - return (
(this.gridContainer = gridContainer)} onMouseOut={this.handleMouseOut} > - {!_.isEmpty(processedData) && + {rowCount > 0 && Date: Wed, 21 Mar 2018 14:54:09 -0700 Subject: [PATCH 24/38] fix tooltip custom time format bug --- ui/src/dashboards/components/GraphOptionsTimeFormat.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx b/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx index 7d8ebbbdf5..99e8247ebf 100644 --- a/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx +++ b/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx @@ -61,7 +61,7 @@ class GraphOptionsTimeFormat extends PureComponent {
@@ -354,10 +356,9 @@ class CellEditorOverlay extends Component { } } -const CEOBottom = ({children}) => -
- {children} -
+const CEOBottom = ({children}) => ( +
{children}
+) const {arrayOf, func, node, number, shape, string} = PropTypes diff --git a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx index 3c4ed39f4c..2e1904a63a 100644 --- a/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx +++ b/ui/src/dashboards/components/GraphOptionsCustomizableField.tsx @@ -2,7 +2,7 @@ import React, {PureComponent} from 'react' import InputClickToEdit from 'src/shared/components/InputClickToEdit' -type Field = { +interface Field { internalName: string displayName: string visible: boolean diff --git a/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx b/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx index 788af1961b..c3eedae8f0 100644 --- a/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx +++ b/ui/src/dashboards/components/GraphOptionsCustomizeFields.tsx @@ -3,7 +3,7 @@ import React, {SFC} from 'react' import GraphOptionsCustomizableField from 'src/dashboards/components/GraphOptionsCustomizableField' import uuid from 'uuid' -type Field = { +interface Field { internalName: string displayName: string visible: boolean diff --git a/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx b/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx index 6393b4c923..366ffc92d3 100644 --- a/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx +++ b/ui/src/dashboards/components/GraphOptionsTimeFormat.tsx @@ -61,7 +61,7 @@ class GraphOptionsTimeFormat extends PureComponent {
) } From 3fecf9770faba47e98e963b5557c75613f87c620 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Thu, 22 Mar 2018 12:43:41 -0700 Subject: [PATCH 36/38] remove GraphOptionsCustomizableColumn --- .../GraphOptionsCustomizableColumn.tsx | 46 ------------------- 1 file changed, 46 deletions(-) delete mode 100644 ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx diff --git a/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx b/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx deleted file mode 100644 index 1400a82e5e..0000000000 --- a/ui/src/dashboards/components/GraphOptionsCustomizableColumn.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import React, {PureComponent} from 'react' - -import InputClickToEdit from 'src/shared/components/InputClickToEdit' - -interface Column { - internalName: string - displayName: string -} - -interface Props { - internalName: string - displayName: string - onColumnRename: (column: Column) => void -} - -class GraphOptionsCustomizableColumn extends PureComponent { - constructor(props) { - super(props) - - this.handleColumnRename = this.handleColumnRename.bind(this) - } - - public handleColumnRename(rename) { - const {onColumnRename, internalName} = this.props - onColumnRename({internalName, displayName: rename}) - } - - public render() { - const {internalName, displayName} = this.props - - return ( -
-
{internalName}
- -
- ) - } -} - -export default GraphOptionsCustomizableColumn From b58354f1447ee2248f38014b46085bd943216522 Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Thu, 22 Mar 2018 12:47:41 -0700 Subject: [PATCH 37/38] remove graph options test wrapping from tableoptions test --- ui/test/dashboards/components/TableOptions.test.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/ui/test/dashboards/components/TableOptions.test.tsx b/ui/test/dashboards/components/TableOptions.test.tsx index e75d29b83d..3b6944e6ae 100644 --- a/ui/test/dashboards/components/TableOptions.test.tsx +++ b/ui/test/dashboards/components/TableOptions.test.tsx @@ -4,7 +4,6 @@ import {TableOptions} from 'src/dashboards/components/TableOptions' import GraphOptionsFixFirstColumn from 'src/dashboards/components/GraphOptionsFixFirstColumn' import GraphOptionsSortBy from 'src/dashboards/components/GraphOptionsSortBy' -import GraphOptionsTextWrapping from 'src/dashboards/components/GraphOptionsTextWrapping' import GraphOptionsCustomizeFields from 'src/dashboards/components/GraphOptionsCustomizeFields' import GraphOptionsTimeAxis from 'src/dashboards/components/GraphOptionsTimeAxis' import GraphOptionsTimeFormat from 'src/dashboards/components/GraphOptionsTimeFormat' @@ -51,7 +50,6 @@ describe('Dashboards.Components.TableOptions', () => { const graphOptionsTimeFormat = wrapper.find(GraphOptionsTimeFormat) const graphOptionsTimeAxis = wrapper.find(GraphOptionsTimeAxis) const graphOptionsSortBy = wrapper.find(GraphOptionsSortBy) - const graphOptionsTextWrapping = wrapper.find(GraphOptionsTextWrapping) const graphOptionsFixFirstColumn = wrapper.find( GraphOptionsFixFirstColumn ) @@ -65,7 +63,6 @@ describe('Dashboards.Components.TableOptions', () => { expect(graphOptionsTimeFormat.exists()).toBe(true) expect(graphOptionsTimeAxis.exists()).toBe(true) expect(graphOptionsSortBy.exists()).toBe(true) - expect(graphOptionsTextWrapping.exists()).toBe(true) expect(graphOptionsFixFirstColumn.exists()).toBe(true) expect(graphOptionsCustomizeFields.exists()).toBe(true) expect(thresholdsList.exists()).toBe(true) From 098e060ecb7d9a187f9302833915c3a312cb71db Mon Sep 17 00:00:00 2001 From: Iris Scholten Date: Thu, 22 Mar 2018 13:20:00 -0700 Subject: [PATCH 38/38] fix tslint alphabetizing errors --- .../GraphOptionsCustomizableField.test.tsx | 15 +++++++-------- .../GraphOptionsCustomizeFields.test.tsx | 5 ++--- .../dashboards/components/TableOptions.test.tsx | 15 ++++++--------- 3 files changed, 15 insertions(+), 20 deletions(-) diff --git a/ui/test/dashboards/components/GraphOptionsCustomizableField.test.tsx b/ui/test/dashboards/components/GraphOptionsCustomizableField.test.tsx index cf41d10e35..efd71333a1 100644 --- a/ui/test/dashboards/components/GraphOptionsCustomizableField.test.tsx +++ b/ui/test/dashboards/components/GraphOptionsCustomizableField.test.tsx @@ -1,16 +1,15 @@ +import {shallow} from 'enzyme' import React from 'react' import GraphOptionsCustomizableField from 'src/dashboards/components/GraphOptionsCustomizableField' import InputClickToEdit from 'src/shared/components/InputClickToEdit' -import {shallow} from 'enzyme' - const setup = (override = {}) => { const props = { - internalName: '', displayName: '', - visible: true, + internalName: '', onFieldUpdate: () => {}, + visible: true, ...override, } @@ -63,8 +62,8 @@ describe('Dashboards.Components.GraphOptionsCustomizableField', () => { const onFieldUpdate = jest.fn() const internalName = 'test' const {instance, props: {visible}} = setup({ - onFieldUpdate, internalName, + onFieldUpdate, }) const rename = 'TEST' @@ -72,8 +71,8 @@ describe('Dashboards.Components.GraphOptionsCustomizableField', () => { expect(onFieldUpdate).toHaveBeenCalledTimes(1) expect(onFieldUpdate).toHaveBeenCalledWith({ - internalName, displayName: rename, + internalName, visible, }) }) @@ -84,16 +83,16 @@ describe('Dashboards.Components.GraphOptionsCustomizableField', () => { const onFieldUpdate = jest.fn() const visible = true const {instance, props: {internalName, displayName}} = setup({ - visible, onFieldUpdate, + visible, }) instance.handleToggleVisible() expect(onFieldUpdate).toHaveBeenCalledTimes(1) expect(onFieldUpdate).toHaveBeenCalledWith({ - internalName, displayName, + internalName, visible: !visible, }) }) diff --git a/ui/test/dashboards/components/GraphOptionsCustomizeFields.test.tsx b/ui/test/dashboards/components/GraphOptionsCustomizeFields.test.tsx index 107a191d72..71d8325a19 100644 --- a/ui/test/dashboards/components/GraphOptionsCustomizeFields.test.tsx +++ b/ui/test/dashboards/components/GraphOptionsCustomizeFields.test.tsx @@ -1,11 +1,10 @@ +import {shallow} from 'enzyme' import React from 'react' -import GraphOptionsCustomizeFields from 'src/dashboards/components/GraphOptionsCustomizeFields' import GraphOptionsCustomizableField from 'src/dashboards/components/GraphOptionsCustomizableField' +import GraphOptionsCustomizeFields from 'src/dashboards/components/GraphOptionsCustomizeFields' import {TIME_FIELD_DEFAULT} from 'src/shared/constants/tableGraph' -import {shallow} from 'enzyme' - const setup = (override = {}) => { const props = { fields: [], diff --git a/ui/test/dashboards/components/TableOptions.test.tsx b/ui/test/dashboards/components/TableOptions.test.tsx index 3b6944e6ae..6dda3556e6 100644 --- a/ui/test/dashboards/components/TableOptions.test.tsx +++ b/ui/test/dashboards/components/TableOptions.test.tsx @@ -1,30 +1,27 @@ +import {shallow} from 'enzyme' import React from 'react' - -import {TableOptions} from 'src/dashboards/components/TableOptions' - +import GraphOptionsCustomizeFields from 'src/dashboards/components/GraphOptionsCustomizeFields' import GraphOptionsFixFirstColumn from 'src/dashboards/components/GraphOptionsFixFirstColumn' import GraphOptionsSortBy from 'src/dashboards/components/GraphOptionsSortBy' -import GraphOptionsCustomizeFields from 'src/dashboards/components/GraphOptionsCustomizeFields' import GraphOptionsTimeAxis from 'src/dashboards/components/GraphOptionsTimeAxis' import GraphOptionsTimeFormat from 'src/dashboards/components/GraphOptionsTimeFormat' +import {TableOptions} from 'src/dashboards/components/TableOptions' import FancyScrollbar from 'src/shared/components/FancyScrollbar' import ThresholdsList from 'src/shared/components/ThresholdsList' import ThresholdsListTypeToggle from 'src/shared/components/ThresholdsListTypeToggle' -import {shallow} from 'enzyme' - const defaultProps = { + dataLabels: [], handleUpdateTableOptions: () => {}, onResetFocus: () => {}, tableOptions: { columnNames: [], + fieldNames: [], fixFirstColumn: true, + sortBy: {displayName: '', internalName: '', visible: true}, timeFormat: '', verticalTimeAxis: true, - sortBy: {internalName: '', displayName: '', visible: true}, - fieldNames: [], }, - dataLabels: [], } const setup = (override = {}) => {