Import updateScript
parent
3b400952d9
commit
7e30baf3da
|
@ -1,24 +1,35 @@
|
||||||
|
// Libraries
|
||||||
import React, {PureComponent} from 'react'
|
import React, {PureComponent} from 'react'
|
||||||
import {connect} from 'react-redux'
|
import {connect} from 'react-redux'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
|
||||||
|
/// Components
|
||||||
import TimeMachine from 'src/flux/components/TimeMachine'
|
import TimeMachine from 'src/flux/components/TimeMachine'
|
||||||
import {ErrorHandling} from 'src/shared/decorators/errors'
|
|
||||||
import KeyboardShortcuts from 'src/shared/components/KeyboardShortcuts'
|
import KeyboardShortcuts from 'src/shared/components/KeyboardShortcuts'
|
||||||
import PageHeader from 'src/reusable_ui/components/page_layout/PageHeader'
|
import PageHeader from 'src/reusable_ui/components/page_layout/PageHeader'
|
||||||
|
|
||||||
|
// APIs
|
||||||
|
import {getSuggestions, getAST, getTimeSeries} from 'src/flux/apis'
|
||||||
|
|
||||||
|
// Constants
|
||||||
import {
|
import {
|
||||||
validateSuccess,
|
validateSuccess,
|
||||||
fluxTimeSeriesError,
|
fluxTimeSeriesError,
|
||||||
fluxResponseTruncatedError,
|
fluxResponseTruncatedError,
|
||||||
} from 'src/shared/copy/notifications'
|
} from 'src/shared/copy/notifications'
|
||||||
import {UpdateScript} from 'src/flux/actions'
|
|
||||||
|
|
||||||
import {bodyNodes} from 'src/flux/helpers'
|
|
||||||
import {getSuggestions, getAST, getTimeSeries} from 'src/flux/apis'
|
|
||||||
import {builder, argTypes, emptyAST} from 'src/flux/constants'
|
import {builder, argTypes, emptyAST} from 'src/flux/constants'
|
||||||
import {getDeep} from 'src/utils/wrappers'
|
|
||||||
|
|
||||||
|
// Actions
|
||||||
|
import {
|
||||||
|
UpdateScript,
|
||||||
|
updateScript as updateScriptAction,
|
||||||
|
} from 'src/flux/actions'
|
||||||
|
import {notify as notifyAction} from 'src/shared/actions/notifications'
|
||||||
|
|
||||||
|
// Utils
|
||||||
|
import {bodyNodes} from 'src/flux/helpers'
|
||||||
|
|
||||||
|
// Types
|
||||||
import {Source, Notification, FluxTable} from 'src/types'
|
import {Source, Notification, FluxTable} from 'src/types'
|
||||||
import {
|
import {
|
||||||
Suggestion,
|
Suggestion,
|
||||||
|
@ -31,6 +42,8 @@ import {
|
||||||
ScriptStatus,
|
ScriptStatus,
|
||||||
} from 'src/types/flux'
|
} from 'src/types/flux'
|
||||||
|
|
||||||
|
import {ErrorHandling} from 'src/shared/decorators/errors'
|
||||||
|
|
||||||
interface Status {
|
interface Status {
|
||||||
type: string
|
type: string
|
||||||
text: string
|
text: string
|
||||||
|
@ -124,33 +137,6 @@ export class FluxPage extends PureComponent<Props, State> {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
private get header(): JSX.Element {
|
|
||||||
const {services, onGoToEditFlux} = this.props
|
|
||||||
|
|
||||||
if (!services.length) {
|
|
||||||
return null
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<FluxHeader
|
|
||||||
service={this.service}
|
|
||||||
services={services}
|
|
||||||
onGoToEditFlux={onGoToEditFlux}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
private get service(): Service {
|
|
||||||
const {services} = this.props
|
|
||||||
const activeService = services.find(s => {
|
|
||||||
return getDeep<boolean>(s, 'metadata.active', false)
|
|
||||||
})
|
|
||||||
return activeService || services[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> feature(chronograf): use sources instead of services for flux builder
|
|
||||||
private get getContext(): Context {
|
private get getContext(): Context {
|
||||||
return {
|
return {
|
||||||
onAddNode: this.handleAddNode,
|
onAddNode: this.handleAddNode,
|
||||||
|
@ -691,6 +677,11 @@ export class FluxPage extends PureComponent<Props, State> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mdtp = {
|
||||||
|
updateScript: updateScriptAction,
|
||||||
|
notify: notifyAction,
|
||||||
|
}
|
||||||
|
|
||||||
const mstp = ({links, script}) => {
|
const mstp = ({links, script}) => {
|
||||||
return {
|
return {
|
||||||
links: links.flux,
|
links: links.flux,
|
||||||
|
@ -698,4 +689,4 @@ const mstp = ({links, script}) => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(mstp, null)(FluxPage)
|
export default connect(mstp, mdtp)(FluxPage)
|
||||||
|
|
|
@ -116,7 +116,7 @@ const tagsetFilter = (filter: SchemaFilter[]): string => {
|
||||||
|
|
||||||
const metaQuery = async (source: Source, query: string) => {
|
const metaQuery = async (source: Source, query: string) => {
|
||||||
const url = source.links.query
|
const url = source.links.query
|
||||||
const type = "flux"
|
const type = 'flux'
|
||||||
try {
|
try {
|
||||||
const response = await AJAX({
|
const response = await AJAX({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|
Loading…
Reference in New Issue