From 7e30baf3da0e5b5718f72a360fde033510a0fb16 Mon Sep 17 00:00:00 2001 From: Andrew Watkins <watts@influxdb.com> Date: Thu, 2 Aug 2018 14:23:38 -0700 Subject: [PATCH] Import updateScript --- .../ui/src/flux/containers/FluxPage.tsx | 59 ++++++++----------- .../ui/src/shared/apis/flux/metaQueries.ts | 2 +- 2 files changed, 26 insertions(+), 35 deletions(-) diff --git a/chronograf/ui/src/flux/containers/FluxPage.tsx b/chronograf/ui/src/flux/containers/FluxPage.tsx index dacfd5949e..1594e39ef0 100644 --- a/chronograf/ui/src/flux/containers/FluxPage.tsx +++ b/chronograf/ui/src/flux/containers/FluxPage.tsx @@ -1,24 +1,35 @@ +// Libraries import React, {PureComponent} from 'react' import {connect} from 'react-redux' import _ from 'lodash' +/// Components import TimeMachine from 'src/flux/components/TimeMachine' -import {ErrorHandling} from 'src/shared/decorators/errors' import KeyboardShortcuts from 'src/shared/components/KeyboardShortcuts' import PageHeader from 'src/reusable_ui/components/page_layout/PageHeader' +// APIs +import {getSuggestions, getAST, getTimeSeries} from 'src/flux/apis' + +// Constants import { validateSuccess, fluxTimeSeriesError, fluxResponseTruncatedError, } 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 {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 { Suggestion, @@ -31,6 +42,8 @@ import { ScriptStatus, } from 'src/types/flux' +import {ErrorHandling} from 'src/shared/decorators/errors' + interface Status { type: 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 { return { onAddNode: this.handleAddNode, @@ -691,6 +677,11 @@ export class FluxPage extends PureComponent<Props, State> { } } +const mdtp = { + updateScript: updateScriptAction, + notify: notifyAction, +} + const mstp = ({links, script}) => { return { links: links.flux, @@ -698,4 +689,4 @@ const mstp = ({links, script}) => { } } -export default connect(mstp, null)(FluxPage) +export default connect(mstp, mdtp)(FluxPage) diff --git a/chronograf/ui/src/shared/apis/flux/metaQueries.ts b/chronograf/ui/src/shared/apis/flux/metaQueries.ts index 51c05b4eb6..92d338d50f 100644 --- a/chronograf/ui/src/shared/apis/flux/metaQueries.ts +++ b/chronograf/ui/src/shared/apis/flux/metaQueries.ts @@ -116,7 +116,7 @@ const tagsetFilter = (filter: SchemaFilter[]): string => { const metaQuery = async (source: Source, query: string) => { const url = source.links.query - const type = "flux" + const type = 'flux' try { const response = await AJAX({ method: 'POST',