DEFAULT's should come first
parent
ebcdba9b66
commit
b91e1274cf
|
@ -19,7 +19,7 @@ import {
|
|||
updateFieldOptions,
|
||||
changeTimeFormat,
|
||||
} from 'src/dashboards/actions/cellEditorOverlay'
|
||||
import {TIME_FIELD_DEFAULT} from 'src/shared/constants/tableGraph'
|
||||
import {DEFAULT_TIME_FIELD} from 'src/shared/constants/tableGraph'
|
||||
import {QueryConfig} from 'src/types/query'
|
||||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||
|
||||
|
@ -90,7 +90,7 @@ export class TableOptions extends Component<Props, {}> {
|
|||
onToggleVerticalTimeAxis={this.handleToggleVerticalTimeAxis}
|
||||
/>
|
||||
<GraphOptionsSortBy
|
||||
selected={tableOptions.sortBy || TIME_FIELD_DEFAULT}
|
||||
selected={tableOptions.sortBy || DEFAULT_TIME_FIELD}
|
||||
sortByOptions={tableSortByOptions}
|
||||
onChooseSortBy={this.handleChooseSortBy}
|
||||
/>
|
||||
|
|
|
@ -4,7 +4,7 @@ import {map, reduce, filter} from 'fast.js'
|
|||
|
||||
import {
|
||||
CELL_HORIZONTAL_PADDING,
|
||||
TIME_FIELD_DEFAULT,
|
||||
DEFAULT_TIME_FIELD,
|
||||
DEFAULT_TIME_FORMAT,
|
||||
DEFAULT_PRECISION,
|
||||
} from 'src/shared/constants/tableGraph'
|
||||
|
@ -49,12 +49,12 @@ const updateMaxWidths = (
|
|||
const columnLabel = topRow[c]
|
||||
|
||||
const useTimeWidth =
|
||||
(columnLabel === TIME_FIELD_DEFAULT.internalName &&
|
||||
(columnLabel === DEFAULT_TIME_FIELD.internalName &&
|
||||
verticalTimeAxis &&
|
||||
!isTopRow) ||
|
||||
(!verticalTimeAxis &&
|
||||
isTopRow &&
|
||||
topRow[0] === TIME_FIELD_DEFAULT.internalName &&
|
||||
topRow[0] === DEFAULT_TIME_FIELD.internalName &&
|
||||
c !== 0)
|
||||
|
||||
const currentWidth = useTimeWidth
|
||||
|
@ -81,7 +81,7 @@ const updateMaxWidths = (
|
|||
export const computeFieldOptions = (existingFieldOptions, sortedLabels) => {
|
||||
const timeField =
|
||||
existingFieldOptions.find(f => f.internalName === 'time') ||
|
||||
TIME_FIELD_DEFAULT
|
||||
DEFAULT_TIME_FIELD
|
||||
let astNames = [timeField]
|
||||
|
||||
sortedLabels.forEach(({label}) => {
|
||||
|
|
|
@ -19,15 +19,15 @@ import {
|
|||
import {updateFieldOptions} from 'src/dashboards/actions/cellEditorOverlay'
|
||||
|
||||
import {
|
||||
NULL_ARRAY_INDEX,
|
||||
NULL_HOVER_TIME,
|
||||
DEFAULT_TIME_FORMAT,
|
||||
TIME_FIELD_DEFAULT,
|
||||
ASCENDING,
|
||||
DESCENDING,
|
||||
NULL_HOVER_TIME,
|
||||
NULL_ARRAY_INDEX,
|
||||
DEFAULT_TIME_FIELD,
|
||||
DEFAULT_TIME_FORMAT,
|
||||
DEFAULT_SORT_DIRECTION,
|
||||
FIX_FIRST_COLUMN_DEFAULT,
|
||||
VERTICAL_TIME_AXIS_DEFAULT,
|
||||
DEFAULT_FIX_FIRST_COLUMN,
|
||||
DEFAULT_VERTICAL_TIME_AXIS,
|
||||
} from 'src/shared/constants/tableGraph'
|
||||
|
||||
import {generateThresholdsListHexs} from 'shared/constants/colorOperations'
|
||||
|
@ -42,7 +42,7 @@ class TableGraph extends Component {
|
|||
const sortField = _.get(
|
||||
this.props,
|
||||
['tableOptions', 'sortBy', 'internalName'],
|
||||
TIME_FIELD_DEFAULT.internalName
|
||||
DEFAULT_TIME_FIELD.internalName
|
||||
)
|
||||
|
||||
this.state = {
|
||||
|
@ -259,21 +259,21 @@ class TableGraph extends Component {
|
|||
} = this.state
|
||||
|
||||
const {
|
||||
fieldOptions = [TIME_FIELD_DEFAULT],
|
||||
fieldOptions = [DEFAULT_TIME_FIELD],
|
||||
timeFormat = DEFAULT_TIME_FORMAT,
|
||||
tableOptions,
|
||||
colors,
|
||||
} = parent.props
|
||||
|
||||
const {
|
||||
verticalTimeAxis = VERTICAL_TIME_AXIS_DEFAULT,
|
||||
fixFirstColumn = FIX_FIRST_COLUMN_DEFAULT,
|
||||
verticalTimeAxis = DEFAULT_VERTICAL_TIME_AXIS,
|
||||
fixFirstColumn = DEFAULT_FIX_FIRST_COLUMN,
|
||||
} = tableOptions
|
||||
|
||||
const cellData = transformedData[rowIndex][columnIndex]
|
||||
|
||||
const timeFieldIndex = fieldOptions.findIndex(
|
||||
field => field.internalName === TIME_FIELD_DEFAULT.internalName
|
||||
field => field.internalName === DEFAULT_TIME_FIELD.internalName
|
||||
)
|
||||
|
||||
const visibleTime = _.get(fieldOptions, [timeFieldIndex, 'visible'], true)
|
||||
|
@ -370,7 +370,7 @@ class TableGraph extends Component {
|
|||
fieldOptions,
|
||||
timeFormat,
|
||||
} = this.props
|
||||
const {fixFirstColumn = FIX_FIRST_COLUMN_DEFAULT} = tableOptions
|
||||
const {fixFirstColumn = DEFAULT_FIX_FIRST_COLUMN} = tableOptions
|
||||
const columnCount = _.get(transformedData, ['0', 'length'], 0)
|
||||
const rowCount = columnCount === 0 ? 0 : transformedData.length
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ export const TIME_FORMAT_TOOLTIP_LINK =
|
|||
|
||||
export const DEFAULT_PRECISION = 0
|
||||
|
||||
export const TIME_FIELD_DEFAULT = {
|
||||
export const DEFAULT_TIME_FIELD = {
|
||||
internalName: 'time',
|
||||
displayName: '',
|
||||
visible: true,
|
||||
|
@ -18,8 +18,8 @@ export const ASCENDING = 'asc'
|
|||
export const DESCENDING = 'desc'
|
||||
export const DEFAULT_SORT_DIRECTION = ASCENDING
|
||||
|
||||
export const FIX_FIRST_COLUMN_DEFAULT = true
|
||||
export const VERTICAL_TIME_AXIS_DEFAULT = true
|
||||
export const DEFAULT_FIX_FIRST_COLUMN = true
|
||||
export const DEFAULT_VERTICAL_TIME_AXIS = true
|
||||
|
||||
export const CELL_HORIZONTAL_PADDING = 30
|
||||
|
||||
|
@ -38,9 +38,8 @@ export const FORMAT_OPTIONS = [
|
|||
]
|
||||
|
||||
export const DEFAULT_TABLE_OPTIONS = {
|
||||
verticalTimeAxis: VERTICAL_TIME_AXIS_DEFAULT,
|
||||
timeFormat: DEFAULT_TIME_FORMAT,
|
||||
sortBy: TIME_FIELD_DEFAULT,
|
||||
verticalTimeAxis: DEFAULT_VERTICAL_TIME_AXIS,
|
||||
sortBy: DEFAULT_TIME_FIELD,
|
||||
wrapping: 'truncate',
|
||||
fixFirstColumn: FIX_FIRST_COLUMN_DEFAULT,
|
||||
fixFirstColumn: DEFAULT_FIX_FIRST_COLUMN,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue