diff --git a/ui/src/dashboards/constants/index.js b/ui/src/dashboards/constants/index.js index a42bcdae4e..7a09fab606 100644 --- a/ui/src/dashboards/constants/index.js +++ b/ui/src/dashboards/constants/index.js @@ -5,8 +5,9 @@ import { import {CELL_TYPE_LINE} from 'src/dashboards/graphics/graph' import {TEMP_VAR_DASHBOARD_TIME} from 'src/shared/constants' +export const UNTITLED_CELL = 'Untitled Graph' export const UNTITLED_CELL_LINE = 'Untitled Line Graph' -export const UNTITLED_CELL_STACKED = 'Untitled Stacked Gracph' +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 = @@ -55,7 +56,7 @@ export const NEW_DEFAULT_DASHBOARD_CELL = { y: 0, w: 4, h: 4, - name: UNTITLED_CELL_LINE, + name: UNTITLED_CELL, type: CELL_TYPE_LINE, queries: [], tableOptions: DEFAULT_TABLE_OPTIONS, diff --git a/ui/src/dashboards/utils/cellGetters.js b/ui/src/dashboards/utils/cellGetters.js index bdf9eb4a71..b2e4dbf427 100644 --- a/ui/src/dashboards/utils/cellGetters.js +++ b/ui/src/dashboards/utils/cellGetters.js @@ -1,24 +1,6 @@ import {NEW_DEFAULT_DASHBOARD_CELL} from 'src/dashboards/constants' -import { - CELL_TYPE_LINE, - CELL_TYPE_STACKED, - CELL_TYPE_STEPPLOT, - CELL_TYPE_BAR, - CELL_TYPE_LINE_PLUS_SINGLE_STAT, - CELL_TYPE_SINGLE_STAT, - 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' +import {CELL_TYPE_LINE} from 'src/dashboards/graphics/graph' +import {UNTITLED_CELL} from 'src/dashboards/constants' const getMostCommonValue = values => { const results = values.reduce( @@ -40,37 +22,37 @@ const getMostCommonValue = values => { return results.mostCommonValue } -const getNewTypedCellName = type => { - switch (type) { - case CELL_TYPE_LINE: - return UNTITLED_CELL_LINE - case CELL_TYPE_STACKED: - return UNTITLED_CELL_STACKED - case CELL_TYPE_STEPPLOT: - return UNTITLED_CELL_STEPPLOT - case CELL_TYPE_BAR: - return UNTITLED_CELL_BAR - case CELL_TYPE_LINE_PLUS_SINGLE_STAT: - return UNTITLED_CELL_LINE_PLUS_SINGLE_STAT - case CELL_TYPE_SINGLE_STAT: - return UNTITLED_CELL_SINGLE_STAT - case CELL_TYPE_GAUGE: - return UNTITLED_CELL_GAUGE - case CELL_TYPE_TABLE: - return UNTITLED_CELL_TABLE - } -} +// const getNewTypedCellName = type => { +// switch (type) { +// case CELL_TYPE_LINE: +// return UNTITLED_CELL_LINE +// case CELL_TYPE_STACKED: +// return UNTITLED_CELL_STACKED +// case CELL_TYPE_STEPPLOT: +// return UNTITLED_CELL_STEPPLOT +// case CELL_TYPE_BAR: +// return UNTITLED_CELL_BAR +// case CELL_TYPE_LINE_PLUS_SINGLE_STAT: +// return UNTITLED_CELL_LINE_PLUS_SINGLE_STAT +// case CELL_TYPE_SINGLE_STAT: +// return UNTITLED_CELL_SINGLE_STAT +// case CELL_TYPE_GAUGE: +// return UNTITLED_CELL_GAUGE +// case CELL_TYPE_TABLE: +// return UNTITLED_CELL_TABLE +// } +// } export const isCellUntitled = cellName => { return ( - cellName === UNTITLED_CELL_LINE || - cellName === UNTITLED_CELL_STACKED || - cellName === UNTITLED_CELL_STEPPLOT || - cellName === UNTITLED_CELL_BAR || - cellName === UNTITLED_CELL_LINE_PLUS_SINGLE_STAT || - cellName === UNTITLED_CELL_SINGLE_STAT || - cellName === UNTITLED_CELL_GAUGE || - cellName === UNTITLED_CELL_TABLE + cellName === UNTITLED_CELL + // cellName === UNTITLED_CELL_STACKED || + // cellName === UNTITLED_CELL_STEPPLOT || + // cellName === UNTITLED_CELL_BAR || + // cellName === UNTITLED_CELL_LINE_PLUS_SINGLE_STAT || + // cellName === UNTITLED_CELL_SINGLE_STAT || + // cellName === UNTITLED_CELL_GAUGE || + // cellName === UNTITLED_CELL_TABLE ) } @@ -106,7 +88,7 @@ export const getNewDashboardCell = (dashboard, cellType) => { const typedCell = { ...NEW_DEFAULT_DASHBOARD_CELL, type, - name: getNewTypedCellName(type), + name: UNTITLED_CELL, } if (dashboard.cells.length === 0) { diff --git a/ui/test/fixtures/index.ts b/ui/test/fixtures/index.ts index a0bf3d6785..735ef085db 100644 --- a/ui/test/fixtures/index.ts +++ b/ui/test/fixtures/index.ts @@ -157,16 +157,16 @@ export const cell: Cell = { y: 0, w: 8, h: 4, - name: 'Untitled Line Graph', + name: 'Untitled Graph', queries: [query], - axes: axes, + axes, type: 'line', colors: lineColors, legend: {}, - tableOptions: tableOptions, - fieldOptions: fieldOptions, + tableOptions, + fieldOptions, timeFormat: 'MM/DD/YYYY HH:mm:ss', - decimalPlaces: decimalPlaces, + decimalPlaces, links: { self: '/chronograf/v1/dashboards/9/cells/67435af2-17bf-4caa-a5fc-0dd1ffb40dab',