Merge pull request #12668 from influxdata/fix-types-after-client-update
Remove add label defaults to dashboardpull/12691/head
commit
c0980e8a3f
|
@ -985,9 +985,9 @@
|
|||
}
|
||||
},
|
||||
"@influxdata/influx": {
|
||||
"version": "0.2.41",
|
||||
"resolved": "https://registry.npmjs.org/@influxdata/influx/-/influx-0.2.41.tgz",
|
||||
"integrity": "sha512-AJxNIcBHRYBD18NeLc+oYktgJLM+Q3GdcnNvxU6VKborEaOz/+uZ2aRtp+AEEx/J6TcgYepdT8/jHHnJwzI1aA==",
|
||||
"version": "0.2.42",
|
||||
"resolved": "https://registry.npmjs.org/@influxdata/influx/-/influx-0.2.42.tgz",
|
||||
"integrity": "sha512-xHywcFLfIM+MhdCjmK6T9c+mXIYgEvGENA13PDK2+G6j7YSmJZTutdYT4k472aa2uq3ziCBlYxvS5oG6P5Pd1g==",
|
||||
"requires": {
|
||||
"axios": "^0.18.0"
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@influxdata/clockface": "0.0.5",
|
||||
"@influxdata/influx": "0.2.41",
|
||||
"@influxdata/influx": "0.2.42",
|
||||
"@influxdata/react-custom-scrollbars": "4.3.8",
|
||||
"axios": "^0.18.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
import _ from 'lodash'
|
||||
|
||||
// Utils
|
||||
import {addLabelDefaults} from 'src/shared/utils/labels'
|
||||
import {incrementCloneName} from 'src/utils/naming'
|
||||
|
||||
// Types
|
||||
|
@ -27,7 +26,6 @@ export const getDashboards = async (): Promise<Dashboard[]> => {
|
|||
|
||||
return dashboards.map(d => ({
|
||||
...d,
|
||||
labels: d.labels.map(addLabelDefaults),
|
||||
cells: addDashboardIDToCells(d.cells, d.id),
|
||||
}))
|
||||
}
|
||||
|
@ -37,7 +35,6 @@ export const getDashboard = async (id: string): Promise<Dashboard> => {
|
|||
|
||||
return {
|
||||
...dashboard,
|
||||
labels: dashboard.labels.map(addLabelDefaults),
|
||||
cells: addDashboardIDToCells(dashboard.cells, dashboard.id),
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +46,6 @@ export const getDashboardsByOrgID = async (
|
|||
|
||||
return dashboards.map(d => ({
|
||||
...d,
|
||||
labels: d.labels.map(addLabelDefaults),
|
||||
cells: addDashboardIDToCells(d.cells, d.id),
|
||||
}))
|
||||
}
|
||||
|
@ -61,7 +57,6 @@ export const createDashboard = async (
|
|||
|
||||
return {
|
||||
...dashboard,
|
||||
labels: dashboard.labels.map(addLabelDefaults),
|
||||
cells: addDashboardIDToCells(dashboard.cells, dashboard.id),
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +72,6 @@ export const updateDashboard = async (
|
|||
|
||||
return {
|
||||
...updated,
|
||||
labels: updated.labels.map(addLabelDefaults),
|
||||
cells: addDashboardIDToCells(updated.cells, updated.id),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import {client} from 'src/utils/api'
|
|||
|
||||
// Utils
|
||||
import {addDashboardIDToCells} from 'src/dashboards/apis/'
|
||||
import {addLabelDefaults} from 'src/shared/utils/labels'
|
||||
|
||||
// Actions
|
||||
import {loadDashboard} from 'src/dashboards/actions/'
|
||||
|
@ -62,7 +61,6 @@ export const createDashFromProto = (
|
|||
dashboards.forEach((d: Dashboard) => {
|
||||
const updatedDashboard = {
|
||||
...d,
|
||||
labels: d.labels.map(addLabelDefaults),
|
||||
cells: addDashboardIDToCells(d.cells, d.id),
|
||||
}
|
||||
dispatch(loadDashboard(updatedDashboard))
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
// Constants
|
||||
import {DEFAULT_LABEL_COLOR_HEX} from 'src/configuration/constants/LabelColors'
|
||||
|
||||
// Types
|
||||
import {Label} from 'src/types/v2/labels'
|
||||
import {Label as LabelAPI} from '@influxdata/influx'
|
||||
|
||||
export const addLabelDefaults = (l: LabelAPI): Label => ({
|
||||
...l,
|
||||
properties: {
|
||||
...l.properties,
|
||||
// add defualt color hex if missing
|
||||
color: l.properties.color || DEFAULT_LABEL_COLOR_HEX,
|
||||
},
|
||||
})
|
Loading…
Reference in New Issue