Move cells api calls to client
parent
36d866d20a
commit
4893c5f451
|
@ -829,9 +829,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"@influxdata/influx": {
|
||||
"version": "0.1.9",
|
||||
"resolved": "https://registry.npmjs.org/@influxdata/influx/-/influx-0.1.9.tgz",
|
||||
"integrity": "sha512-AoOK71N/jUqAJxGVFZ2quPe79eeDvtZuzF0ITzg4HXeVDZJrdWL2c1HeF/gbS1OOQcMj4UGFMXUzzeSpRaXY4g==",
|
||||
"version": "0.1.10",
|
||||
"resolved": "https://registry.npmjs.org/@influxdata/influx/-/influx-0.1.10.tgz",
|
||||
"integrity": "sha512-KGVxR2tYzRSrfCJItHhR5e+1a6iuqq6Ted7PphgThm/v/zkqwRmc4EveoudjDFgcqyh34aRw1AY73jkXj7tJ1A==",
|
||||
"requires": {
|
||||
"axios": "^0.18.0"
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@influxdata/react-custom-scrollbars": "4.3.8",
|
||||
"@influxdata/influx": "^0.1.9",
|
||||
"@influxdata/influx": "^0.1.10",
|
||||
"axios": "^0.18.0",
|
||||
"babel-polyfill": "^6.26.0",
|
||||
"bignumber.js": "^4.0.2",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// Libraries
|
||||
import {dashboardsAPI, cellsAPI} from 'src/utils/api'
|
||||
import {dashboardsAPI} from 'src/utils/api'
|
||||
import _ from 'lodash'
|
||||
|
||||
// Utils
|
||||
|
@ -18,6 +18,7 @@ import {
|
|||
} from 'src/types/v2'
|
||||
|
||||
import {Cell as CellTypeAPI} from 'src/api'
|
||||
import {client} from 'src/utils/api'
|
||||
|
||||
// Utils
|
||||
import {
|
||||
|
@ -101,12 +102,9 @@ export const addCell = async (
|
|||
dashboardID: string,
|
||||
cell: NewCell
|
||||
): Promise<Cell> => {
|
||||
const {data} = await cellsAPI.dashboardsDashboardIDCellsPost(
|
||||
dashboardID,
|
||||
cell
|
||||
)
|
||||
const result = await client.dashboards.createCell(dashboardID, cell)
|
||||
|
||||
const cellWithID = {...data, dashboardID}
|
||||
const cellWithID = {...result, dashboardID}
|
||||
|
||||
return cellWithID
|
||||
}
|
||||
|
@ -115,16 +113,16 @@ export const updateCells = async (
|
|||
id: string,
|
||||
cells: Cell[]
|
||||
): Promise<Cell[]> => {
|
||||
const {data} = await cellsAPI.dashboardsDashboardIDCellsPut(id, cells)
|
||||
const result = await client.dashboards.updateAllCells(id, cells)
|
||||
|
||||
return addDashboardIDToCells(data.cells, id)
|
||||
return addDashboardIDToCells(result, id)
|
||||
}
|
||||
|
||||
export const deleteCell = async (
|
||||
dashboardID: string,
|
||||
cell: Cell
|
||||
): Promise<void> => {
|
||||
await cellsAPI.dashboardsDashboardIDCellsCellIDDelete(dashboardID, cell.id)
|
||||
await client.dashboards.deleteCell(dashboardID, cell.id)
|
||||
}
|
||||
|
||||
export const addDashboardLabels = async (
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {DashboardsApi, CellsApi, ViewsApi, QueryApi, ProtosApi} from 'src/api'
|
||||
import {DashboardsApi, QueryApi, ProtosApi} from 'src/api'
|
||||
|
||||
import Client from '@influxdata/influx'
|
||||
|
||||
|
@ -6,8 +6,6 @@ const basePath = '/api/v2'
|
|||
|
||||
export const client = new Client(basePath)
|
||||
|
||||
export const viewsAPI = new ViewsApi({basePath})
|
||||
export const dashboardsAPI = new DashboardsApi({basePath})
|
||||
export const cellsAPI = new CellsApi({basePath})
|
||||
export const queryAPI = new QueryApi({basePath})
|
||||
export const protosAPI = new ProtosApi({basePath})
|
||||
|
|
Loading…
Reference in New Issue