diff --git a/ui/src/dashboards/constants/index.js b/ui/src/dashboards/constants/index.js index c04452de3..8a343c1d2 100644 --- a/ui/src/dashboards/constants/index.js +++ b/ui/src/dashboards/constants/index.js @@ -1,5 +1,26 @@ import {DEFAULT_TABLE_OPTIONS} from 'src/shared/constants/tableGraph' -import {CELL_TYPE_LINE, UNTITLED_CELL_LINE} from 'src/dashboards/graphics/graph' +import {CELL_TYPE_LINE} from 'src/dashboards/graphics/graph' + +export const UNTITLED_CELL_LINE = 'Untitled Line Graph' +export const UNTITLED_CELL_STACKED = 'Untitled Stacked Gracph' +export const UNTITLED_CELL_STEPPLOT = 'Untitled Step-Plot Graph' +export const UNTITLED_CELL_BAR = 'Untitled Bar Graph' +export const UNTITLED_CELL_LINE_PLUS_SINGLE_STAT = + 'Untitled Line Graph + Single Stat' +export const UNTITLED_CELL_SINGLE_STAT = 'Untitled Single Stat' +export const UNTITLED_CELL_GAUGE = 'Untitled Gauge' +export const UNTITLED_CELL_TABLE = 'Untitled Table' + +export const NEW_DEFAULT_DASHBOARD_CELL = { + x: 0, + y: 0, + w: 4, + h: 4, + name: UNTITLED_CELL_LINE, + type: CELL_TYPE_LINE, + queries: [], + tableOptions: DEFAULT_TABLE_OPTIONS, +} export const EMPTY_DASHBOARD = { id: 0, @@ -15,17 +36,6 @@ export const EMPTY_DASHBOARD = { ], } -export const NEW_DEFAULT_DASHBOARD_CELL = { - x: 0, - y: 0, - w: 4, - h: 4, - name: UNTITLED_CELL_LINE, - type: CELL_TYPE_LINE, - queries: [], - tableOptions: DEFAULT_TABLE_OPTIONS, -} - export const NEW_DASHBOARD = { name: 'Name This Dashboard', cells: [NEW_DEFAULT_DASHBOARD_CELL], diff --git a/ui/src/dashboards/utils/cellGetters.js b/ui/src/dashboards/utils/cellGetters.js index 2e67138b9..bdf9eb4a7 100644 --- a/ui/src/dashboards/utils/cellGetters.js +++ b/ui/src/dashboards/utils/cellGetters.js @@ -9,6 +9,16 @@ import { CELL_TYPE_GAUGE, CELL_TYPE_TABLE, } from 'src/dashboards/graphics/graph' +import { + UNTITLED_CELL_LINE, + UNTITLED_CELL_STACKED, + UNTITLED_CELL_STEPPLOT, + UNTITLED_CELL_BAR, + UNTITLED_CELL_LINE_PLUS_SINGLE_STAT, + UNTITLED_CELL_SINGLE_STAT, + UNTITLED_CELL_GAUGE, + UNTITLED_CELL_TABLE, +} from 'src/dashboards/constants' const getMostCommonValue = values => { const results = values.reduce( @@ -30,16 +40,6 @@ const getMostCommonValue = values => { return results.mostCommonValue } -export const UNTITLED_CELL_LINE = 'Untitled Line Graph' -export const UNTITLED_CELL_STACKED = 'Untitled Stacked Graph' -export const UNTITLED_CELL_STEPPLOT = 'Untitled Step-Plot Graph' -export const UNTITLED_CELL_BAR = 'Untitled Bar Graph' -export const UNTITLED_CELL_LINE_PLUS_SINGLE_STAT = - 'Untitled Line Graph + Single Stat' -export const UNTITLED_CELL_SINGLE_STAT = 'Untitled Single Stat' -export const UNTITLED_CELL_GAUGE = 'Untitled Gauge' -export const UNTITLED_CELL_TABLE = 'Untitled Table' - const getNewTypedCellName = type => { switch (type) { case CELL_TYPE_LINE: diff --git a/ui/test/dashboards/reducers/cellEditorOverlay.test.js b/ui/test/dashboards/reducers/cellEditorOverlay.test.js index 3063c4030..d9fd5c1c1 100644 --- a/ui/test/dashboards/reducers/cellEditorOverlay.test.js +++ b/ui/test/dashboards/reducers/cellEditorOverlay.test.js @@ -20,7 +20,8 @@ import { } from 'shared/constants/thresholds' import {validateLineColors} from 'src/shared/constants/graphColorPalettes' -import {CELL_TYPE_LINE, UNTITLED_CELL_LINE} from 'src/dashboards/graphics/graph' +import {CELL_TYPE_LINE} from 'src/dashboards/graphics/graph' +import {UNTITLED_CELL_LINE} from 'src/dashboards/constants' const defaultCellType = CELL_TYPE_LINE const defaultCellName = UNTITLED_CELL_LINE