diff --git a/ui/src/ifql/components/TimeMachine.tsx b/ui/src/ifql/components/TimeMachine.tsx index bd4ebfa6fb..abcec66856 100644 --- a/ui/src/ifql/components/TimeMachine.tsx +++ b/ui/src/ifql/components/TimeMachine.tsx @@ -4,7 +4,12 @@ import BodyBuilder from 'src/ifql/components/BodyBuilder' import TimeMachineEditor from 'src/ifql/components/TimeMachineEditor' import TimeMachineVis from 'src/ifql/components/TimeMachineVis' import Threesizer from 'src/shared/components/threesizer/Threesizer' -import {Suggestion, OnChangeScript, FlatBody} from 'src/types/ifql' +import { + Suggestion, + OnChangeScript, + OnSubmitScript, + FlatBody, +} from 'src/types/ifql' import {ErrorHandling} from 'src/shared/decorators/errors' import {HANDLE_VERTICAL, HANDLE_HORIZONTAL} from 'src/shared/constants' @@ -14,6 +19,7 @@ interface Props { body: Body[] suggestions: Suggestion[] onChangeScript: OnChangeScript + onSubmitScript: OnSubmitScript } interface Body extends FlatBody { @@ -37,6 +43,7 @@ class TimeMachine extends PureComponent { return [ { handleDisplay: 'none', + menuOptions: [], render: () => ( { }, { handlePixels: 8, + menuOptions: [], render: () => , }, ] } private get divisions() { - const {body, suggestions, script, onChangeScript} = this.props + const { + body, + script, + suggestions, + onChangeScript, + onSubmitScript, + } = this.props return [ { name: 'Explore', + menuOptions: [], render: () => , }, { name: 'Script', + menuOptions: [{action: onSubmitScript, text: 'Analyze'}], render: visibility => ( { }, { name: 'Build', + menuOptions: [], render: () => , }, ] diff --git a/ui/src/ifql/containers/IFQLPage.tsx b/ui/src/ifql/containers/IFQLPage.tsx index 132f74925a..20d1792277 100644 --- a/ui/src/ifql/containers/IFQLPage.tsx +++ b/ui/src/ifql/containers/IFQLPage.tsx @@ -71,12 +71,6 @@ export class IFQLPage extends PureComponent {

Time Machine

-
@@ -345,15 +340,18 @@ export class IFQLPage extends PureComponent { } private getTimeSeries = async () => { + const {script} = this.state this.setState({data: 'fetching data...'}) try { - const {data} = await getTimeSeries(this.state.script) + const {data} = await getTimeSeries(script) this.setState({data}) } catch (error) { this.setState({data: 'Error fetching data'}) console.error('Could not get timeSeries', error) } + + this.getASTResponse(script) } } diff --git a/ui/src/shared/components/Threesizer/Division.tsx b/ui/src/shared/components/Threesizer/Division.tsx index 5be0e538e9..def9f6d96f 100644 --- a/ui/src/shared/components/Threesizer/Division.tsx +++ b/ui/src/shared/components/Threesizer/Division.tsx @@ -4,6 +4,7 @@ import calculateSize from 'calculate-size' import DivisionHeader from 'src/shared/components/threesizer/DivisionHeader' import {HANDLE_VERTICAL, HANDLE_HORIZONTAL} from 'src/shared/constants/index' +import {MenuItem} from 'src/shared/components/threesizer/DivisionMenu' const NOOP = () => {} @@ -22,6 +23,7 @@ interface Props { onDoubleClick: (id: string) => void onMaximize: (id: string) => void onMinimize: (id: string) => void + menuOptions?: MenuItem[] } interface Style { @@ -62,7 +64,7 @@ class Division extends PureComponent { } public render() { - const {name, render, draggable} = this.props + const {name, render, draggable, menuOptions} = this.props return (
{
{name && ( diff --git a/ui/src/shared/components/Threesizer/DivisionHeader.tsx b/ui/src/shared/components/Threesizer/DivisionHeader.tsx index 281245453a..726cbc673c 100644 --- a/ui/src/shared/components/Threesizer/DivisionHeader.tsx +++ b/ui/src/shared/components/Threesizer/DivisionHeader.tsx @@ -1,11 +1,12 @@ import React, {PureComponent} from 'react' import DivisionMenu, { MenuItem, -} from 'src/shared/components/Threesizer/DivisionMenu' +} from 'src/shared/components/threesizer/DivisionMenu' interface Props { onMinimize: () => void onMaximize: () => void + menuOptions?: MenuItem[] } class DivisionHeader extends PureComponent { @@ -18,8 +19,9 @@ class DivisionHeader extends PureComponent { } private get menuItems(): MenuItem[] { - const {onMaximize, onMinimize} = this.props + const {onMaximize, onMinimize, menuOptions} = this.props return [ + ...menuOptions, { action: onMaximize, text: 'Maximize', diff --git a/ui/src/shared/components/Threesizer/Threesizer.tsx b/ui/src/shared/components/Threesizer/Threesizer.tsx index 298ccc26b1..657498af16 100644 --- a/ui/src/shared/components/Threesizer/Threesizer.tsx +++ b/ui/src/shared/components/Threesizer/Threesizer.tsx @@ -5,6 +5,8 @@ import _ from 'lodash' import Division from 'src/shared/components/threesizer/Division' import {ErrorHandling} from 'src/shared/decorators/errors' +import {MenuItem} from 'src/shared/components/threesizer/DivisionMenu' + import { HANDLE_NONE, HANDLE_PIXELS, @@ -32,6 +34,7 @@ interface DivisionProps { name?: string handleDisplay?: string handlePixels?: number + menuOptions: MenuItem[] render: (visibility?: string) => ReactElement } @@ -143,8 +146,9 @@ class Threesizer extends Component { onMaximize={this.handleMaximize} onMinimize={this.handleMinimize} onDoubleClick={this.handleDoubleClick} - onHandleStartDrag={this.handleStartDrag} render={this.props.divisions[i].render} + onHandleStartDrag={this.handleStartDrag} + menuOptions={this.props.divisions[i].menuOptions} /> ))}
diff --git a/ui/webpack/dev.config.js b/ui/webpack/dev.config.js index f691c76529..b67bc31edc 100644 --- a/ui/webpack/dev.config.js +++ b/ui/webpack/dev.config.js @@ -45,7 +45,7 @@ module.exports = { }, watch: true, cache: true, - devtool: 'source-map', + devtool: 'cheap-eval-source-map', entry: { app: path.resolve(__dirname, '..', 'src', 'index.tsx'), },