From 88f1d7cd854492813ffc0bb8ea370674efaf8f25 Mon Sep 17 00:00:00 2001 From: Andrew Watkins Date: Mon, 23 Apr 2018 15:32:06 -0700 Subject: [PATCH] WIP clear up errors and warnings --- ui/src/ifql/containers/IFQLPage.tsx | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ui/src/ifql/containers/IFQLPage.tsx b/ui/src/ifql/containers/IFQLPage.tsx index b212cf42d..87c7de377 100644 --- a/ui/src/ifql/containers/IFQLPage.tsx +++ b/ui/src/ifql/containers/IFQLPage.tsx @@ -1,13 +1,10 @@ import React, {PureComponent} from 'react' import {connect} from 'react-redux' -import uuid from 'uuid' -import _ from 'lodash' import TimeMachine from 'src/ifql/components/TimeMachine' import KeyboardShortcuts from 'src/shared/components/KeyboardShortcuts' -import Walker from 'src/ifql/ast/walker' -import {Func, Suggestion, FlatBody} from 'src/types/ifql' +import {Suggestion, FlatBody} from 'src/types/ifql' import {InputArg} from 'src/types/ifql' import {bodyNodes} from 'src/ifql/helpers' @@ -110,7 +107,7 @@ export class IFQLPage extends PureComponent { funcID, expressionID, }: InputArg): void => { - const expressions = this.state.expressions.map(expression => { + const body = this.state.body.map(expression => { if (expression.id !== expressionID) { return expression } @@ -134,7 +131,7 @@ export class IFQLPage extends PureComponent { return {...expression, funcs} }) - this.setState({expressions}, () => { + this.setState({body}, () => { if (generate) { this.handleGenerateScript() } @@ -142,7 +139,7 @@ export class IFQLPage extends PureComponent { } private get expressionsToScript(): string { - return this.state.expressions.reduce((acc, expression) => { + return this.state.body.reduce((acc, expression) => { return `${acc + this.funcsToScript(expression.funcs)}\n\n` }, '') } @@ -176,7 +173,7 @@ export class IFQLPage extends PureComponent { } private handleAddNode = (name: string, expressionID: string): void => { - const script = this.state.expressions.reduce((acc, expression) => { + const script = this.state.body.reduce((acc, expression) => { if (expression.id === expressionID) { const {funcs} = expression return `${acc}${this.funcsToScript(funcs)}\n\t|> ${name}()\n\n` @@ -193,7 +190,7 @@ export class IFQLPage extends PureComponent { expressionID: string ): void => { // TODO: export this and test functionality - const script = this.state.expressions + const script = this.state.body .map((expression, expressionIndex) => { if (expression.id !== expressionID) { return expression.source @@ -208,7 +205,7 @@ export class IFQLPage extends PureComponent { return `${acc}\n\t${f.source}` }, '') - const isLast = expressionIndex === this.state.expressions.length - 1 + const isLast = expressionIndex === this.state.body.length - 1 if (isLast) { return `${source}` }