Switch write to client library
parent
37b189174f
commit
ae3139cc65
|
@ -3,13 +3,13 @@ import _ from 'lodash'
|
|||
|
||||
// Apis
|
||||
import {
|
||||
writeLineProtocol,
|
||||
createTelegrafConfig,
|
||||
updateTelegrafConfig,
|
||||
createScraperTarget,
|
||||
updateScraperTarget,
|
||||
getTelegrafConfig,
|
||||
} from 'src/onboarding/apis/index'
|
||||
import {client} from 'src/utils/api'
|
||||
|
||||
// Utils
|
||||
import {createNewPlugin} from 'src/dataLoaders/utils/pluginConfigs'
|
||||
|
@ -418,7 +418,7 @@ export const writeLineProtocolAction = (
|
|||
) => async dispatch => {
|
||||
try {
|
||||
dispatch(setLPStatus(RemoteDataState.Loading))
|
||||
await writeLineProtocol(org, bucket, body, precision)
|
||||
await client.write.create(org, bucket, body, {precision})
|
||||
dispatch(setLPStatus(RemoteDataState.Done))
|
||||
} catch (error) {
|
||||
dispatch(setLPStatus(RemoteDataState.Error))
|
||||
|
|
|
@ -4,11 +4,10 @@ import _ from 'lodash'
|
|||
import {setupAPI, sourcesAPI} from 'src/utils/api'
|
||||
|
||||
// Utils
|
||||
import {telegrafsAPI, writeAPI, scraperTargetsApi} from 'src/utils/api'
|
||||
import {telegrafsAPI, scraperTargetsApi} from 'src/utils/api'
|
||||
|
||||
import {
|
||||
Telegraf,
|
||||
WritePrecision,
|
||||
TelegrafRequest,
|
||||
OnboardingResponse,
|
||||
ScraperTargetRequest,
|
||||
|
@ -96,25 +95,6 @@ export const getTelegrafConfigs = async (org: string): Promise<Telegraf[]> => {
|
|||
}
|
||||
}
|
||||
|
||||
export const writeLineProtocol = async (
|
||||
org: string,
|
||||
bucket: string,
|
||||
body: string,
|
||||
precision: WritePrecision
|
||||
): Promise<any> => {
|
||||
const data = await writeAPI.writePost(
|
||||
org,
|
||||
bucket,
|
||||
body,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
precision
|
||||
)
|
||||
return data
|
||||
}
|
||||
|
||||
export const createTelegrafConfig = async (
|
||||
telegrafConfig: TelegrafRequest
|
||||
): Promise<Telegraf> => {
|
||||
|
|
|
@ -2,9 +2,7 @@ import {
|
|||
DashboardsApi,
|
||||
CellsApi,
|
||||
TelegrafsApi,
|
||||
AuthorizationsApi,
|
||||
ViewsApi,
|
||||
WriteApi,
|
||||
SourcesApi,
|
||||
QueryApi,
|
||||
SetupApi,
|
||||
|
@ -22,8 +20,6 @@ export const viewsAPI = new ViewsApi({basePath})
|
|||
export const dashboardsAPI = new DashboardsApi({basePath})
|
||||
export const cellsAPI = new CellsApi({basePath})
|
||||
export const telegrafsAPI = new TelegrafsApi({basePath})
|
||||
export const authorizationsAPI = new AuthorizationsApi({basePath})
|
||||
export const writeAPI = new WriteApi({basePath})
|
||||
export const sourcesAPI = new SourcesApi({basePath})
|
||||
export const queryAPI = new QueryApi({basePath})
|
||||
export const setupAPI = new SetupApi({basePath})
|
||||
|
|
Loading…
Reference in New Issue