feat(templates): adding new templates, removing calls to create templates (#14631)
* adding new templates; removing calls to create templates * fixing quickstart dashboard creation * Type dashboard template * bump templates repo version * add templateID to template meta in swagger * Add templateID to document meta type in UI * add templateID to telegrafPlugin and telegrafplugin info types * Instantiate templates from static templates * Get tests to pass * Fix type conflicts * Bump templates version * update changelogpull/14658/head
parent
d006d80ee6
commit
8a5d0e6230
|
@ -4,6 +4,9 @@
|
||||||
1. [14495](https://github.com/influxdata/influxdb/pull/14495): optional gzip compression of the query CSV response.
|
1. [14495](https://github.com/influxdata/influxdb/pull/14495): optional gzip compression of the query CSV response.
|
||||||
1. [14567](https://github.com/influxdata/influxdb/pull/14567): Add task types.
|
1. [14567](https://github.com/influxdata/influxdb/pull/14567): Add task types.
|
||||||
1. [14604](https://github.com/influxdata/influxdb/pull/14604): When getting task runs from the API, runs will be returned in order of most recently scheduled first.
|
1. [14604](https://github.com/influxdata/influxdb/pull/14604): When getting task runs from the API, runs will be returned in order of most recently scheduled first.
|
||||||
|
1. [14631](https://github.com/influxdata/influxdb/pull/14631): Added Github and Apache templates
|
||||||
|
1. [14631](https://github.com/influxdata/influxdb/pull/14631): Updated name of Local Metrics template
|
||||||
|
1. [14631](https://github.com/influxdata/influxdb/pull/14631): Dashboards for all Telegraf config bundles now created
|
||||||
|
|
||||||
### UI Improvements
|
### UI Improvements
|
||||||
|
|
||||||
|
|
|
@ -8045,6 +8045,8 @@ components:
|
||||||
type: string
|
type: string
|
||||||
type:
|
type:
|
||||||
type: string
|
type: string
|
||||||
|
templateID:
|
||||||
|
type: string
|
||||||
description:
|
description:
|
||||||
type: string
|
type: string
|
||||||
version:
|
version:
|
||||||
|
|
|
@ -326,36 +326,42 @@ export const telegrafPlugin = {
|
||||||
export const cpuTelegrafPlugin = {
|
export const cpuTelegrafPlugin = {
|
||||||
...telegrafPlugin,
|
...telegrafPlugin,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
|
templateID: '0000000000000009',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const diskTelegrafPlugin = {
|
export const diskTelegrafPlugin = {
|
||||||
...telegrafPlugin,
|
...telegrafPlugin,
|
||||||
name: TelegrafPluginInputDisk.NameEnum.Disk,
|
name: TelegrafPluginInputDisk.NameEnum.Disk,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
|
templateID: '0000000000000009',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const diskioTelegrafPlugin = {
|
export const diskioTelegrafPlugin = {
|
||||||
...telegrafPlugin,
|
...telegrafPlugin,
|
||||||
name: TelegrafPluginInputDiskio.NameEnum.Diskio,
|
name: TelegrafPluginInputDiskio.NameEnum.Diskio,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
|
templateID: '0000000000000009',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const netTelegrafPlugin = {
|
export const netTelegrafPlugin = {
|
||||||
...telegrafPlugin,
|
...telegrafPlugin,
|
||||||
name: TelegrafPluginInputNet.NameEnum.Net,
|
name: TelegrafPluginInputNet.NameEnum.Net,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
|
templateID: '0000000000000009',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const memTelegrafPlugin = {
|
export const memTelegrafPlugin = {
|
||||||
...telegrafPlugin,
|
...telegrafPlugin,
|
||||||
name: TelegrafPluginInputMem.NameEnum.Mem,
|
name: TelegrafPluginInputMem.NameEnum.Mem,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
|
templateID: '0000000000000009',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const processesTelegrafPlugin = {
|
export const processesTelegrafPlugin = {
|
||||||
...telegrafPlugin,
|
...telegrafPlugin,
|
||||||
name: TelegrafPluginInputProcesses.NameEnum.Processes,
|
name: TelegrafPluginInputProcesses.NameEnum.Processes,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
|
templateID: '0000000000000009',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const procstatTelegrafPlugin = {
|
export const procstatTelegrafPlugin = {
|
||||||
|
@ -368,17 +374,20 @@ export const systemTelegrafPlugin = {
|
||||||
...telegrafPlugin,
|
...telegrafPlugin,
|
||||||
name: TelegrafPluginInputSystem.NameEnum.System,
|
name: TelegrafPluginInputSystem.NameEnum.System,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
|
templateID: '0000000000000009',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const redisTelegrafPlugin = {
|
export const redisTelegrafPlugin = {
|
||||||
...telegrafPlugin,
|
...telegrafPlugin,
|
||||||
name: TelegrafPluginInputRedis.NameEnum.Redis,
|
name: TelegrafPluginInputRedis.NameEnum.Redis,
|
||||||
|
templateID: '0000000000000008',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const swapTelegrafPlugin = {
|
export const swapTelegrafPlugin = {
|
||||||
...telegrafPlugin,
|
...telegrafPlugin,
|
||||||
name: TelegrafPluginInputSwap.NameEnum.Swap,
|
name: TelegrafPluginInputSwap.NameEnum.Swap,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
|
templateID: '0000000000000009',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const redisPlugin = {
|
export const redisPlugin = {
|
||||||
|
@ -394,6 +403,7 @@ export const dockerTelegrafPlugin = {
|
||||||
...telegrafPlugin,
|
...telegrafPlugin,
|
||||||
name: TelegrafPluginInputDocker.NameEnum.Docker,
|
name: TelegrafPluginInputDocker.NameEnum.Docker,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
|
templateID: '0000000000000002',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const influxDB2Plugin = {
|
export const influxDB2Plugin = {
|
||||||
|
|
|
@ -161,7 +161,7 @@
|
||||||
"@influxdata/flux-parser": "^0.3.0",
|
"@influxdata/flux-parser": "^0.3.0",
|
||||||
"@influxdata/giraffe": "0.16.2",
|
"@influxdata/giraffe": "0.16.2",
|
||||||
"@influxdata/influx": "0.5.5",
|
"@influxdata/influx": "0.5.5",
|
||||||
"@influxdata/influxdb-templates": "0.5.0",
|
"@influxdata/influxdb-templates": "0.7.0",
|
||||||
"@influxdata/react-custom-scrollbars": "4.3.8",
|
"@influxdata/react-custom-scrollbars": "4.3.8",
|
||||||
"abortcontroller-polyfill": "^1.3.0",
|
"abortcontroller-polyfill": "^1.3.0",
|
||||||
"axios": "^0.19.0",
|
"axios": "^0.19.0",
|
||||||
|
|
|
@ -320,6 +320,7 @@ export const addPluginBundleWithPlugins = (bundle: BundleName) => dispatch => {
|
||||||
name: p,
|
name: p,
|
||||||
active: false,
|
active: false,
|
||||||
configured: isConfigured,
|
configured: isConfigured,
|
||||||
|
templateID: telegrafPluginsInfo[p].templateID,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// Libraries
|
// Libraries
|
||||||
import React, {PureComponent, ChangeEvent} from 'react'
|
import React, {PureComponent, ChangeEvent} from 'react'
|
||||||
import {connect} from 'react-redux'
|
import {connect} from 'react-redux'
|
||||||
import {includes} from 'lodash'
|
import {includes, get} from 'lodash'
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
import {Form, Input} from '@influxdata/clockface'
|
import {Form, Input} from '@influxdata/clockface'
|
||||||
|
@ -33,14 +33,9 @@ import {
|
||||||
} from 'src/shared/copy/notifications'
|
} from 'src/shared/copy/notifications'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import {
|
import {AppState, TelegrafPlugin, ConfigurationState} from 'src/types'
|
||||||
AppState,
|
|
||||||
TelegrafPlugin,
|
|
||||||
ConfigurationState,
|
|
||||||
DashboardTemplate,
|
|
||||||
} from 'src/types'
|
|
||||||
import {InputType, ComponentSize} from '@influxdata/clockface'
|
import {InputType, ComponentSize} from '@influxdata/clockface'
|
||||||
import {client} from 'src/utils/api'
|
import {influxdbTemplateList} from 'src/templates/constants/defaultTemplates'
|
||||||
|
|
||||||
interface DispatchProps {
|
interface DispatchProps {
|
||||||
onSetTelegrafConfigName: typeof setTelegrafConfigName
|
onSetTelegrafConfigName: typeof setTelegrafConfigName
|
||||||
|
@ -143,40 +138,34 @@ export class TelegrafPluginInstructions extends PureComponent<Props> {
|
||||||
|
|
||||||
private async handleCreateDashboardsForPlugins() {
|
private async handleCreateDashboardsForPlugins() {
|
||||||
const {notify, telegrafPlugins, orgID} = this.props
|
const {notify, telegrafPlugins, orgID} = this.props
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const templatesEntries = await client.templates.getAll(orgID)
|
|
||||||
|
|
||||||
const configuredPlugins = telegrafPlugins.filter(
|
const configuredPlugins = telegrafPlugins.filter(
|
||||||
tp => tp.configured === ConfigurationState.Configured
|
tp => tp.configured === ConfigurationState.Configured
|
||||||
)
|
)
|
||||||
|
|
||||||
const configuredPluginNames = configuredPlugins.map(t =>
|
const configuredPluginTemplateIdentifiers = configuredPlugins
|
||||||
`${t.name}-Template`.toLowerCase()
|
.map(t => t.templateID)
|
||||||
)
|
.filter(t => t)
|
||||||
|
|
||||||
const templatesToGet = templatesEntries.filter(t => {
|
const templatesToInstantiate = influxdbTemplateList.filter(t => {
|
||||||
return includes(configuredPluginNames, t.meta.name.toLowerCase())
|
return includes(
|
||||||
|
configuredPluginTemplateIdentifiers,
|
||||||
|
get(t, 'meta.templateID')
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const pluginsWithTemplates = templatesToGet.map(t => {
|
const pendingDashboards = templatesToInstantiate.map(t =>
|
||||||
return t.meta.name.replace('-Template', '')
|
createDashboardFromTemplateAJAX(t, orgID)
|
||||||
})
|
|
||||||
|
|
||||||
const pendingTemplates = templatesToGet.map(t =>
|
|
||||||
client.templates.get(t.id)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const templates = await Promise.all(pendingTemplates)
|
const pendingDashboardNames = templatesToInstantiate.map(t =>
|
||||||
|
t.meta.name.toLowerCase()
|
||||||
const pendingDashboards = templates.map(t =>
|
|
||||||
createDashboardFromTemplateAJAX(t as DashboardTemplate, orgID)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const dashboards = await Promise.all(pendingDashboards)
|
const dashboards = await Promise.all(pendingDashboards)
|
||||||
|
|
||||||
if (dashboards.length) {
|
if (dashboards.length) {
|
||||||
notify(TelegrafDashboardCreated(pluginsWithTemplates))
|
notify(TelegrafDashboardCreated(pendingDashboardNames))
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
notify(TelegrafDashboardFailed())
|
notify(TelegrafDashboardFailed())
|
||||||
|
|
|
@ -60,6 +60,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputCpu.TypeEnum.Input,
|
type: TelegrafPluginInputCpu.TypeEnum.Input,
|
||||||
config: {},
|
config: {},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputDisk.NameEnum.Disk]: {
|
[TelegrafPluginInputDisk.NameEnum.Disk]: {
|
||||||
fields: null,
|
fields: null,
|
||||||
|
@ -68,6 +69,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputDisk.TypeEnum.Input,
|
type: TelegrafPluginInputDisk.TypeEnum.Input,
|
||||||
config: {},
|
config: {},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputDiskio.NameEnum.Diskio]: {
|
[TelegrafPluginInputDiskio.NameEnum.Diskio]: {
|
||||||
fields: null,
|
fields: null,
|
||||||
|
@ -76,6 +78,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputDiskio.TypeEnum.Input,
|
type: TelegrafPluginInputDiskio.TypeEnum.Input,
|
||||||
config: {},
|
config: {},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputDocker.NameEnum.Docker]: {
|
[TelegrafPluginInputDocker.NameEnum.Docker]: {
|
||||||
fields: {
|
fields: {
|
||||||
|
@ -89,6 +92,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputDocker.TypeEnum.Input,
|
type: TelegrafPluginInputDocker.TypeEnum.Input,
|
||||||
config: {endpoint: ''},
|
config: {endpoint: ''},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000002',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputFile.NameEnum.File]: {
|
[TelegrafPluginInputFile.NameEnum.File]: {
|
||||||
fields: {
|
fields: {
|
||||||
|
@ -123,6 +127,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputKubernetes.TypeEnum.Input,
|
type: TelegrafPluginInputKubernetes.TypeEnum.Input,
|
||||||
config: {url: ''},
|
config: {url: ''},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000005',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputLogParser.NameEnum.Logparser]: {
|
[TelegrafPluginInputLogParser.NameEnum.Logparser]: {
|
||||||
fields: {files: {type: ConfigFieldType.StringArray, isRequired: true}},
|
fields: {files: {type: ConfigFieldType.StringArray, isRequired: true}},
|
||||||
|
@ -139,6 +144,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputMem.TypeEnum.Input,
|
type: TelegrafPluginInputMem.TypeEnum.Input,
|
||||||
config: {},
|
config: {},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputNet.NameEnum.Net]: {
|
[TelegrafPluginInputNet.NameEnum.Net]: {
|
||||||
fields: null,
|
fields: null,
|
||||||
|
@ -147,6 +153,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputNet.TypeEnum.Input,
|
type: TelegrafPluginInputNet.TypeEnum.Input,
|
||||||
config: {},
|
config: {},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputNetResponse.NameEnum.NetResponse]: {
|
[TelegrafPluginInputNetResponse.NameEnum.NetResponse]: {
|
||||||
fields: null,
|
fields: null,
|
||||||
|
@ -163,6 +170,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputNginx.TypeEnum.Input,
|
type: TelegrafPluginInputNginx.TypeEnum.Input,
|
||||||
config: {urls: []},
|
config: {urls: []},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000006',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputProcesses.NameEnum.Processes]: {
|
[TelegrafPluginInputProcesses.NameEnum.Processes]: {
|
||||||
fields: null,
|
fields: null,
|
||||||
|
@ -171,6 +179,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputProcesses.TypeEnum.Input,
|
type: TelegrafPluginInputProcesses.TypeEnum.Input,
|
||||||
config: {},
|
config: {},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputProcstat.NameEnum.Procstat]: {
|
[TelegrafPluginInputProcstat.NameEnum.Procstat]: {
|
||||||
fields: {exe: {type: ConfigFieldType.String, isRequired: true}},
|
fields: {exe: {type: ConfigFieldType.String, isRequired: true}},
|
||||||
|
@ -198,6 +207,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputRedis.TypeEnum.Input,
|
type: TelegrafPluginInputRedis.TypeEnum.Input,
|
||||||
config: {servers: [], password: ''},
|
config: {servers: [], password: ''},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000008',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputSyslog.NameEnum.Syslog]: {
|
[TelegrafPluginInputSyslog.NameEnum.Syslog]: {
|
||||||
fields: {server: {type: ConfigFieldType.String, isRequired: true}},
|
fields: {server: {type: ConfigFieldType.String, isRequired: true}},
|
||||||
|
@ -214,6 +224,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputSwap.TypeEnum.Input,
|
type: TelegrafPluginInputSwap.TypeEnum.Input,
|
||||||
config: {},
|
config: {},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputSystem.NameEnum.System]: {
|
[TelegrafPluginInputSystem.NameEnum.System]: {
|
||||||
fields: null,
|
fields: null,
|
||||||
|
@ -222,6 +233,7 @@ export const telegrafPluginsInfo: TelegrafPluginInfo = {
|
||||||
type: TelegrafPluginInputSystem.TypeEnum.Input,
|
type: TelegrafPluginInputSystem.TypeEnum.Input,
|
||||||
config: {},
|
config: {},
|
||||||
},
|
},
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
[TelegrafPluginInputTail.NameEnum.Tail]: {
|
[TelegrafPluginInputTail.NameEnum.Tail]: {
|
||||||
fields: null,
|
fields: null,
|
||||||
|
|
|
@ -86,11 +86,13 @@ describe('dataLoader reducer', () => {
|
||||||
name: TelegrafPluginInputCpu.NameEnum.Cpu,
|
name: TelegrafPluginInputCpu.NameEnum.Cpu,
|
||||||
configured: ConfigurationState.Unconfigured,
|
configured: ConfigurationState.Unconfigured,
|
||||||
active: true,
|
active: true,
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: TelegrafPluginInputDisk.NameEnum.Disk,
|
name: TelegrafPluginInputDisk.NameEnum.Disk,
|
||||||
configured: ConfigurationState.Unconfigured,
|
configured: ConfigurationState.Unconfigured,
|
||||||
active: false,
|
active: false,
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -105,11 +107,13 @@ describe('dataLoader reducer', () => {
|
||||||
name: TelegrafPluginInputCpu.NameEnum.Cpu,
|
name: TelegrafPluginInputCpu.NameEnum.Cpu,
|
||||||
configured: ConfigurationState.Unconfigured,
|
configured: ConfigurationState.Unconfigured,
|
||||||
active: false,
|
active: false,
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: TelegrafPluginInputDisk.NameEnum.Disk,
|
name: TelegrafPluginInputDisk.NameEnum.Disk,
|
||||||
configured: ConfigurationState.Unconfigured,
|
configured: ConfigurationState.Unconfigured,
|
||||||
active: true,
|
active: true,
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
@ -126,11 +130,13 @@ describe('dataLoader reducer', () => {
|
||||||
name: TelegrafPluginInputDisk.NameEnum.Disk,
|
name: TelegrafPluginInputDisk.NameEnum.Disk,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
active: false,
|
active: false,
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: TelegrafPluginInputFile.NameEnum.File,
|
name: TelegrafPluginInputFile.NameEnum.File,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
active: false,
|
active: false,
|
||||||
|
templateID: '0000000000000009',
|
||||||
plugin: {
|
plugin: {
|
||||||
name: TelegrafPluginInputFile.NameEnum.File,
|
name: TelegrafPluginInputFile.NameEnum.File,
|
||||||
type: TelegrafPluginInputFile.TypeEnum.Input,
|
type: TelegrafPluginInputFile.TypeEnum.Input,
|
||||||
|
@ -151,11 +157,13 @@ describe('dataLoader reducer', () => {
|
||||||
name: TelegrafPluginInputDisk.NameEnum.Disk,
|
name: TelegrafPluginInputDisk.NameEnum.Disk,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
active: false,
|
active: false,
|
||||||
|
templateID: '0000000000000009',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: TelegrafPluginInputFile.NameEnum.File,
|
name: TelegrafPluginInputFile.NameEnum.File,
|
||||||
configured: ConfigurationState.InvalidConfiguration,
|
configured: ConfigurationState.InvalidConfiguration,
|
||||||
active: false,
|
active: false,
|
||||||
|
templateID: '0000000000000009',
|
||||||
plugin: {
|
plugin: {
|
||||||
name: TelegrafPluginInputFile.NameEnum.File,
|
name: TelegrafPluginInputFile.NameEnum.File,
|
||||||
type: TelegrafPluginInputFile.TypeEnum.Input,
|
type: TelegrafPluginInputFile.TypeEnum.Input,
|
||||||
|
@ -178,6 +186,7 @@ describe('dataLoader reducer', () => {
|
||||||
{
|
{
|
||||||
name: TelegrafPluginInputKubernetes.NameEnum.Kubernetes,
|
name: TelegrafPluginInputKubernetes.NameEnum.Kubernetes,
|
||||||
configured: ConfigurationState.Unconfigured,
|
configured: ConfigurationState.Unconfigured,
|
||||||
|
templateID: '0000000000000005',
|
||||||
active: false,
|
active: false,
|
||||||
plugin: {
|
plugin: {
|
||||||
name: TelegrafPluginInputKubernetes.NameEnum.Kubernetes,
|
name: TelegrafPluginInputKubernetes.NameEnum.Kubernetes,
|
||||||
|
@ -199,6 +208,7 @@ describe('dataLoader reducer', () => {
|
||||||
name: TelegrafPluginInputKubernetes.NameEnum.Kubernetes,
|
name: TelegrafPluginInputKubernetes.NameEnum.Kubernetes,
|
||||||
configured: ConfigurationState.Configured,
|
configured: ConfigurationState.Configured,
|
||||||
active: false,
|
active: false,
|
||||||
|
templateID: '0000000000000005',
|
||||||
plugin: {
|
plugin: {
|
||||||
name: TelegrafPluginInputKubernetes.NameEnum.Kubernetes,
|
name: TelegrafPluginInputKubernetes.NameEnum.Kubernetes,
|
||||||
type: TelegrafPluginInputKubernetes.TypeEnum.Input,
|
type: TelegrafPluginInputKubernetes.TypeEnum.Input,
|
||||||
|
|
|
@ -4,7 +4,6 @@ import _ from 'lodash'
|
||||||
// Constants
|
// Constants
|
||||||
import {StepStatus} from 'src/clockface/constants/wizard'
|
import {StepStatus} from 'src/clockface/constants/wizard'
|
||||||
import {SetupSuccess, SetupError} from 'src/shared/copy/notifications'
|
import {SetupSuccess, SetupError} from 'src/shared/copy/notifications'
|
||||||
import {defaultTemplates} from 'src/templates/constants/'
|
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
import {notify} from 'src/shared/actions/notifications'
|
import {notify} from 'src/shared/actions/notifications'
|
||||||
|
@ -89,16 +88,6 @@ export const setupAdmin = (params: ISetupParams) => async (
|
||||||
throw new Error(resp.data.message)
|
throw new Error(resp.data.message)
|
||||||
}
|
}
|
||||||
|
|
||||||
await client.templates.create({...defaultTemplates.systemTemplate(), orgID})
|
|
||||||
await client.templates.create({
|
|
||||||
...defaultTemplates.gettingStartedWithFluxTemplate(),
|
|
||||||
orgID,
|
|
||||||
})
|
|
||||||
await client.templates.create({
|
|
||||||
...defaultTemplates.localMetricsTemplate(),
|
|
||||||
orgID,
|
|
||||||
})
|
|
||||||
|
|
||||||
dispatch(notify(SetupSuccess))
|
dispatch(notify(SetupSuccess))
|
||||||
dispatch(setStepStatus(1, StepStatus.Complete))
|
dispatch(setStepStatus(1, StepStatus.Complete))
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
QuickstartDashboardCreationSuccess,
|
QuickstartDashboardCreationSuccess,
|
||||||
QuickstartDashboardCreationError,
|
QuickstartDashboardCreationError,
|
||||||
} from 'src/shared/copy/notifications'
|
} from 'src/shared/copy/notifications'
|
||||||
import {QUICKSTART_DASHBOARD_NAME} from 'src/onboarding/constants'
|
import {ossMetricsTemplate} from 'src/templates/constants/defaultTemplates'
|
||||||
|
|
||||||
// APIs
|
// APIs
|
||||||
import {getDashboards} from 'src/organizations/apis'
|
import {getDashboards} from 'src/organizations/apis'
|
||||||
|
@ -31,7 +31,7 @@ import {
|
||||||
Columns,
|
Columns,
|
||||||
Grid,
|
Grid,
|
||||||
} from '@influxdata/clockface'
|
} from '@influxdata/clockface'
|
||||||
import {DashboardTemplate, Organization} from 'src/types'
|
import {Organization} from 'src/types'
|
||||||
import {Dashboard, ScraperTargetRequest} from '@influxdata/influx'
|
import {Dashboard, ScraperTargetRequest} from '@influxdata/influx'
|
||||||
import {OnboardingStepProps} from 'src/onboarding/containers/OnboardingWizard'
|
import {OnboardingStepProps} from 'src/onboarding/containers/OnboardingWizard'
|
||||||
import {QUICKSTART_SCRAPER_TARGET_URL} from 'src/dataLoaders/constants/pluginConfigs'
|
import {QUICKSTART_SCRAPER_TARGET_URL} from 'src/dataLoaders/constants/pluginConfigs'
|
||||||
|
@ -165,23 +165,10 @@ class CompletionStep extends PureComponent<Props> {
|
||||||
this.props.notify(QuickstartScraperCreationError)
|
this.props.notify(QuickstartScraperCreationError)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const templatesEntries = await client.templates.getAll(this.props.orgID)
|
await createDashboardFromTemplateAJAX(
|
||||||
const templatesToGet = templatesEntries.filter(t => {
|
ossMetricsTemplate(),
|
||||||
return (
|
|
||||||
t.meta.name.toLowerCase() == QUICKSTART_DASHBOARD_NAME.toLowerCase()
|
|
||||||
)
|
|
||||||
})
|
|
||||||
const pendingTemplates = templatesToGet.map(t =>
|
|
||||||
client.templates.get(t.id)
|
|
||||||
)
|
|
||||||
const templates = await Promise.all(pendingTemplates)
|
|
||||||
const pendingDashboards = templates.map(t =>
|
|
||||||
createDashboardFromTemplateAJAX(
|
|
||||||
t as DashboardTemplate,
|
|
||||||
this.props.orgID
|
this.props.orgID
|
||||||
)
|
)
|
||||||
)
|
|
||||||
await Promise.all(pendingDashboards)
|
|
||||||
this.props.notify(QuickstartDashboardCreationSuccess)
|
this.props.notify(QuickstartDashboardCreationSuccess)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.props.notify(QuickstartDashboardCreationError)
|
this.props.notify(QuickstartDashboardCreationError)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
export const QUICKSTART_DASHBOARD_NAME = 'Local Metrics-Template'
|
export const QUICKSTART_DASHBOARD_NAME = 'InfluxDB 2.0 OSS Metrics'
|
||||||
|
|
|
@ -3,14 +3,13 @@ import {Dispatch} from 'redux'
|
||||||
import {push, RouterAction} from 'react-router-redux'
|
import {push, RouterAction} from 'react-router-redux'
|
||||||
|
|
||||||
// APIs
|
// APIs
|
||||||
import {client, getErrorMessage} from 'src/utils/api'
|
import {getErrorMessage} from 'src/utils/api'
|
||||||
import * as api from 'src/client'
|
import * as api from 'src/client'
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
import {notify} from 'src/shared/actions/notifications'
|
import {notify} from 'src/shared/actions/notifications'
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
import {defaultTemplates} from 'src/templates/constants/'
|
|
||||||
import {
|
import {
|
||||||
orgCreateSuccess,
|
orgCreateSuccess,
|
||||||
orgCreateFailed,
|
orgCreateFailed,
|
||||||
|
@ -169,18 +168,6 @@ export const createOrgWithBucket = (
|
||||||
}
|
}
|
||||||
createdOrg = orgResp.data
|
createdOrg = orgResp.data
|
||||||
|
|
||||||
await client.templates.create({
|
|
||||||
...defaultTemplates.systemTemplate(),
|
|
||||||
orgID: createdOrg.id,
|
|
||||||
})
|
|
||||||
await client.templates.create({
|
|
||||||
...defaultTemplates.gettingStartedWithFluxTemplate(),
|
|
||||||
orgID: createdOrg.id,
|
|
||||||
})
|
|
||||||
await client.templates.create({
|
|
||||||
...defaultTemplates.localMetricsTemplate(),
|
|
||||||
orgID: createdOrg.id,
|
|
||||||
})
|
|
||||||
dispatch(notify(orgCreateSuccess()))
|
dispatch(notify(orgCreateSuccess()))
|
||||||
|
|
||||||
dispatch(addOrg(createdOrg))
|
dispatch(addOrg(createdOrg))
|
||||||
|
@ -218,11 +205,6 @@ export const createOrg = (org: Organization) => async (
|
||||||
|
|
||||||
const createdOrg = resp.data
|
const createdOrg = resp.data
|
||||||
|
|
||||||
await client.templates.create({
|
|
||||||
...defaultTemplates.systemTemplate(),
|
|
||||||
orgID: createdOrg.id,
|
|
||||||
})
|
|
||||||
|
|
||||||
dispatch(addOrg(createdOrg))
|
dispatch(addOrg(createdOrg))
|
||||||
dispatch(push(`/orgs/${createdOrg.id}`))
|
dispatch(push(`/orgs/${createdOrg.id}`))
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,13 @@ import {Controlled as ReactCodeMirror} from 'react-codemirror2'
|
||||||
import CopyButton from 'src/shared/components/CopyButton'
|
import CopyButton from 'src/shared/components/CopyButton'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import {DocumentCreate} from '@influxdata/influx'
|
|
||||||
import {ComponentColor} from '@influxdata/clockface'
|
import {ComponentColor} from '@influxdata/clockface'
|
||||||
import {RemoteDataState} from 'src/types'
|
import {RemoteDataState, DashboardTemplate} from 'src/types'
|
||||||
|
import {DocumentCreate} from '@influxdata/influx'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onDismissOverlay: () => void
|
onDismissOverlay: () => void
|
||||||
resource: DocumentCreate
|
resource: DashboardTemplate | DocumentCreate
|
||||||
overlayHeading: string
|
overlayHeading: string
|
||||||
status: RemoteDataState
|
status: RemoteDataState
|
||||||
isVisible: boolean
|
isVisible: boolean
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {NotificationStyle} from 'src/types/notifications'
|
||||||
// Constants
|
// Constants
|
||||||
import {FIVE_SECONDS, TEN_SECONDS, INFINITE} from 'src/shared/constants/index'
|
import {FIVE_SECONDS, TEN_SECONDS, INFINITE} from 'src/shared/constants/index'
|
||||||
import {QUICKSTART_SCRAPER_TARGET_URL} from 'src/dataLoaders/constants/pluginConfigs'
|
import {QUICKSTART_SCRAPER_TARGET_URL} from 'src/dataLoaders/constants/pluginConfigs'
|
||||||
|
import {QUICKSTART_DASHBOARD_NAME} from 'src/onboarding/constants/index'
|
||||||
|
|
||||||
const bytesFormatter = binaryPrefixFormatter({
|
const bytesFormatter = binaryPrefixFormatter({
|
||||||
suffix: 'B',
|
suffix: 'B',
|
||||||
|
@ -102,12 +103,12 @@ export const QuickstartScraperCreationError: Notification = {
|
||||||
|
|
||||||
export const QuickstartDashboardCreationSuccess: Notification = {
|
export const QuickstartDashboardCreationSuccess: Notification = {
|
||||||
...defaultSuccessNotification,
|
...defaultSuccessNotification,
|
||||||
message: `The Local Metrics Dashboard has been created`,
|
message: `The ${QUICKSTART_DASHBOARD_NAME} Dashboard has been created`,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const QuickstartDashboardCreationError: Notification = {
|
export const QuickstartDashboardCreationError: Notification = {
|
||||||
...defaultErrorNotification,
|
...defaultErrorNotification,
|
||||||
message: `Failed to create the Local Metrics Dashboard`,
|
message: `Failed to create ${QUICKSTART_DASHBOARD_NAME} Dashboard`,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TelegrafConfigCreationSuccess: Notification = {
|
export const TelegrafConfigCreationSuccess: Notification = {
|
||||||
|
|
|
@ -8,9 +8,9 @@ import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import {RemoteDataState} from '@influxdata/clockface'
|
import {RemoteDataState} from '@influxdata/clockface'
|
||||||
import {DocumentCreate} from '@influxdata/influx'
|
|
||||||
|
|
||||||
import {staticTemplates} from 'src/templates/constants/defaultTemplates'
|
import {staticTemplates} from 'src/templates/constants/defaultTemplates'
|
||||||
|
import {DashboardTemplate} from 'src/types'
|
||||||
|
|
||||||
interface OwnProps {
|
interface OwnProps {
|
||||||
params: {id: string}
|
params: {id: string}
|
||||||
|
@ -31,7 +31,7 @@ class TemplateExportOverlay extends PureComponent<Props> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
private get template(): DocumentCreate {
|
private get template(): DashboardTemplate {
|
||||||
const {
|
const {
|
||||||
params: {id},
|
params: {id},
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
|
@ -1,41 +1,40 @@
|
||||||
import {
|
import {
|
||||||
system,
|
apache,
|
||||||
localMetrics,
|
|
||||||
gettingStarted,
|
|
||||||
docker,
|
docker,
|
||||||
nginx,
|
gettingStarted,
|
||||||
redis,
|
github,
|
||||||
kubernetes,
|
kubernetes,
|
||||||
|
nginx,
|
||||||
|
ossMetrics,
|
||||||
|
redis,
|
||||||
|
system,
|
||||||
} from '@influxdata/influxdb-templates'
|
} from '@influxdata/influxdb-templates'
|
||||||
|
import {DashboardTemplate} from 'src/types'
|
||||||
|
|
||||||
export const localMetricsTemplate = () => {
|
export const ossMetricsTemplate = (): DashboardTemplate => {
|
||||||
return localMetrics
|
return ossMetrics
|
||||||
}
|
}
|
||||||
|
|
||||||
export const systemTemplate = () => {
|
export const staticTemplates: {[k: string]: DashboardTemplate} = {
|
||||||
return system
|
Apache: apache,
|
||||||
}
|
|
||||||
|
|
||||||
export const gettingStartedWithFluxTemplate = () => {
|
|
||||||
return gettingStarted
|
|
||||||
}
|
|
||||||
|
|
||||||
export const staticTemplates = {
|
|
||||||
'getting-started': gettingStarted,
|
|
||||||
'local-metrics': localMetrics,
|
|
||||||
System: system,
|
|
||||||
Docker: docker,
|
Docker: docker,
|
||||||
Redis: redis,
|
'getting-started': gettingStarted,
|
||||||
Nginx: nginx,
|
Github: github,
|
||||||
Kubernetes: kubernetes,
|
Kubernetes: kubernetes,
|
||||||
|
Nginx: nginx,
|
||||||
|
'oss-metrics': ossMetrics,
|
||||||
|
Redis: redis,
|
||||||
|
System: system,
|
||||||
}
|
}
|
||||||
|
|
||||||
export const influxdbTemplateList = [
|
export const influxdbTemplateList: DashboardTemplate[] = [
|
||||||
system,
|
apache,
|
||||||
localMetrics,
|
|
||||||
gettingStarted,
|
|
||||||
docker,
|
docker,
|
||||||
nginx,
|
gettingStarted,
|
||||||
redis,
|
github,
|
||||||
kubernetes,
|
kubernetes,
|
||||||
|
nginx,
|
||||||
|
ossMetrics,
|
||||||
|
redis,
|
||||||
|
system,
|
||||||
].map((t, i) => ({...t, id: `influxdb-template-${i}`}))
|
].map((t, i) => ({...t, id: `influxdb-template-${i}`}))
|
||||||
|
|
|
@ -129,6 +129,7 @@ export interface TelegrafPlugin {
|
||||||
configured: ConfigurationState
|
configured: ConfigurationState
|
||||||
active: boolean
|
active: boolean
|
||||||
plugin?: Plugin
|
plugin?: Plugin
|
||||||
|
templateID?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum BundleName {
|
export enum BundleName {
|
||||||
|
@ -201,6 +202,7 @@ export interface TelegrafPluginInfo {
|
||||||
[name: string]: {
|
[name: string]: {
|
||||||
fields: ConfigFields
|
fields: ConfigFields
|
||||||
defaults: Plugin
|
defaults: Plugin
|
||||||
|
templateID?: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
IDashboard,
|
IDashboard,
|
||||||
DocumentListEntry,
|
DocumentListEntry,
|
||||||
Document,
|
Document,
|
||||||
|
DocumentMeta,
|
||||||
} from '@influxdata/influx'
|
} from '@influxdata/influx'
|
||||||
import {View, Cell} from './index'
|
import {View, Cell} from './index'
|
||||||
|
|
||||||
|
@ -20,10 +21,15 @@ interface KeyValuePairs {
|
||||||
[key: string]: any
|
[key: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface DocumentMetaWithTemplateID extends DocumentMeta {
|
||||||
|
templateID?: string
|
||||||
|
}
|
||||||
|
|
||||||
// Templates
|
// Templates
|
||||||
export interface TemplateBase extends Document {
|
export interface TemplateBase extends Document {
|
||||||
|
meta: DocumentMetaWithTemplateID
|
||||||
content: {data: TemplateData; included: TemplateIncluded[]}
|
content: {data: TemplateData; included: TemplateIncluded[]}
|
||||||
labels?: ILabel[]
|
labels: ILabel[]
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: be more specific about what attributes can be
|
// TODO: be more specific about what attributes can be
|
||||||
|
|
|
@ -1112,10 +1112,10 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
axios "^0.19.0"
|
axios "^0.19.0"
|
||||||
|
|
||||||
"@influxdata/influxdb-templates@0.5.0":
|
"@influxdata/influxdb-templates@0.6.0":
|
||||||
version "0.5.0"
|
version "0.6.0"
|
||||||
resolved "https://registry.yarnpkg.com/@influxdata/influxdb-templates/-/influxdb-templates-0.5.0.tgz#655cd7e2caa0dd6f5ce7a189542ca14b3ff290a8"
|
resolved "https://registry.yarnpkg.com/@influxdata/influxdb-templates/-/influxdb-templates-0.6.0.tgz#6766fdfbee0c1a670d00ed912250c78e66c04f84"
|
||||||
integrity sha512-LfmUMoRmWb4Gc+pLx0WrfRLbYgednZJhP6Ss1W3CYGUNE6YM+U1EZYHNN3AJnA5rwYamWJOC0MlPSgsyoJ7bBg==
|
integrity sha512-eKqIhlo6QZSoMERW7+bdYyeYAyPejKKDOfsCBQMaiEIcDXnVQGNLOzo/AG4cIVPAafo2ojOOEDDzYCkMVvkJkg==
|
||||||
|
|
||||||
"@influxdata/react-custom-scrollbars@4.3.8":
|
"@influxdata/react-custom-scrollbars@4.3.8":
|
||||||
version "4.3.8"
|
version "4.3.8"
|
||||||
|
|
Loading…
Reference in New Issue