Merge pull request #3373 from influxdata/polish/untitled-graph

Polish/untitled graph
pull/10616/head
Deniz Kusefoglu 2018-05-04 10:56:34 -07:00 committed by GitHub
commit 44141e2b94
4 changed files with 13 additions and 69 deletions

View File

@ -5,15 +5,7 @@ import {
import {CELL_TYPE_LINE} from 'src/dashboards/graphics/graph'
import {TEMP_VAR_DASHBOARD_TIME} from 'src/shared/constants'
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 UNTITLED_GRAPH = 'Untitled Graph'
export const TIME_FORMAT_TOOLTIP_LINK =
'http://momentjs.com/docs/#/parsing/string-format/'
@ -55,7 +47,7 @@ export const NEW_DEFAULT_DASHBOARD_CELL = {
y: 0,
w: 4,
h: 4,
name: UNTITLED_CELL_LINE,
name: UNTITLED_GRAPH,
type: CELL_TYPE_LINE,
queries: [],
tableOptions: DEFAULT_TABLE_OPTIONS,

View File

@ -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_GRAPH} from 'src/dashboards/constants'
const getMostCommonValue = values => {
const results = values.reduce(
@ -40,38 +22,8 @@ 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
}
}
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
)
return cellName === UNTITLED_GRAPH
}
const numColumns = 12
@ -106,7 +58,7 @@ export const getNewDashboardCell = (dashboard, cellType) => {
const typedCell = {
...NEW_DEFAULT_DASHBOARD_CELL,
type,
name: getNewTypedCellName(type),
name: UNTITLED_GRAPH,
}
if (dashboard.cells.length === 0) {

View File

@ -21,10 +21,10 @@ import {
import {validateLineColors} from 'src/shared/constants/graphColorPalettes'
import {CELL_TYPE_LINE} from 'src/dashboards/graphics/graph'
import {UNTITLED_CELL_LINE} from 'src/dashboards/constants'
import {UNTITLED_GRAPH} from 'src/dashboards/constants'
const defaultCellType = CELL_TYPE_LINE
const defaultCellName = UNTITLED_CELL_LINE
const defaultCellName = UNTITLED_GRAPH
const defaultCellAxes = {
y: {
base: '10',

View File

@ -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',