Convert ITemplate types to documentcreate types
parent
28fd243fa2
commit
bc106c269a
|
@ -11,10 +11,10 @@ import {dashboardToTemplate} from 'src/shared/utils/resourceToTemplate'
|
||||||
import {getDashboard, getView} from 'src/dashboards/apis'
|
import {getDashboard, getView} from 'src/dashboards/apis'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import {ITemplate} from '@influxdata/influx'
|
import {DocumentCreate} from '@influxdata/influx'
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
dashboardTemplate: ITemplate
|
dashboardTemplate: DocumentCreate
|
||||||
orgID: string
|
orgID: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,10 @@ import {taskToTemplate} from 'src/shared/utils/resourceToTemplate'
|
||||||
|
|
||||||
// APIs
|
// APIs
|
||||||
import {client} from 'src/utils/api'
|
import {client} from 'src/utils/api'
|
||||||
import {ITemplate} from '@influxdata/influx'
|
import {DocumentCreate} from '@influxdata/influx'
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
taskTemplate: ITemplate
|
taskTemplate: DocumentCreate
|
||||||
orgID: string
|
orgID: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,11 @@ import {addOrgIDToTemplate} from 'src/shared/utils/resourceToTemplate'
|
||||||
import 'src/shared/components/ExportOverlay.scss'
|
import 'src/shared/components/ExportOverlay.scss'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import {ITemplate} from '@influxdata/influx'
|
import {DocumentCreate} from '@influxdata/influx'
|
||||||
|
|
||||||
interface OwnProps extends DefaultProps {
|
interface OwnProps extends DefaultProps {
|
||||||
onDismissOverlay: () => void
|
onDismissOverlay: () => void
|
||||||
resource: ITemplate
|
resource: DocumentCreate
|
||||||
resourceName: string
|
resourceName: string
|
||||||
orgID: string
|
orgID: string
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import {getDeep} from 'src/utils/wrappers'
|
import {getDeep} from 'src/utils/wrappers'
|
||||||
import {Task, Label, Dashboard, Cell, View} from 'src/types/v2'
|
import {Task, Label, Dashboard, Cell, View} from 'src/types/v2'
|
||||||
import {ITemplate, TemplateType, DocumentCreate} from '@influxdata/influx'
|
import {TemplateType, DocumentCreate} from '@influxdata/influx'
|
||||||
|
|
||||||
const CURRENT_TEMPLATE_VERSION = '1'
|
const CURRENT_TEMPLATE_VERSION = '1'
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ export const labelToIncluded = (l: Label) => {
|
||||||
export const taskToTemplate = (
|
export const taskToTemplate = (
|
||||||
task: Task,
|
task: Task,
|
||||||
baseTemplate = blankTaskTemplate()
|
baseTemplate = blankTaskTemplate()
|
||||||
): ITemplate => {
|
): DocumentCreate => {
|
||||||
const taskName = _.get(task, 'name', '')
|
const taskName = _.get(task, 'name', '')
|
||||||
const templateName = `${taskName}-Template`
|
const templateName = `${taskName}-Template`
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ export const dashboardToTemplate = (
|
||||||
dashboard: Dashboard,
|
dashboard: Dashboard,
|
||||||
views: View[],
|
views: View[],
|
||||||
baseTemplate = blankDashboardTemplate()
|
baseTemplate = blankDashboardTemplate()
|
||||||
): ITemplate => {
|
): DocumentCreate => {
|
||||||
const dashboardName = _.get(dashboard, 'name', '')
|
const dashboardName = _.get(dashboard, 'name', '')
|
||||||
const templateName = `${dashboardName}-Template`
|
const templateName = `${dashboardName}-Template`
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ export const dashboardToTemplate = (
|
||||||
}
|
}
|
||||||
|
|
||||||
export const addOrgIDToTemplate = (
|
export const addOrgIDToTemplate = (
|
||||||
template: ITemplate,
|
template: DocumentCreate,
|
||||||
orgID: string
|
orgID: string
|
||||||
): DocumentCreate => {
|
): DocumentCreate => {
|
||||||
return {...template, orgID}
|
return {...template, orgID}
|
||||||
|
|
Loading…
Reference in New Issue