diff --git a/ui/src/ifql/components/BodyBuilder.tsx b/ui/src/ifql/components/BodyBuilder.tsx index b1602438e7..0acd7e308c 100644 --- a/ui/src/ifql/components/BodyBuilder.tsx +++ b/ui/src/ifql/components/BodyBuilder.tsx @@ -22,8 +22,8 @@ class BodyBuilder extends PureComponent { if (d.funcs) { return ( @@ -36,10 +36,10 @@ class BodyBuilder extends PureComponent { return ( ) }) diff --git a/ui/src/ifql/components/ExpressionNode.tsx b/ui/src/ifql/components/ExpressionNode.tsx index 16f559f1df..a76f0c7e38 100644 --- a/ui/src/ifql/components/ExpressionNode.tsx +++ b/ui/src/ifql/components/ExpressionNode.tsx @@ -8,14 +8,14 @@ import {Func} from 'src/types/ifql' interface Props { funcNames: any[] - id: string + bodyID: string funcs: Func[] } // an Expression is a group of one or more functions class ExpressionNode extends PureComponent { public render() { - const {id, funcNames, funcs} = this.props + const {bodyID, funcNames, funcs} = this.props return ( {({onDeleteFuncNode, onAddNode, onChangeArg, onGenerateScript}) => { @@ -23,7 +23,7 @@ class ExpressionNode extends PureComponent {

@@ -32,7 +32,7 @@ class ExpressionNode extends PureComponent { { type={type} argKey={key} value={value} + bodyID={bodyID} funcID={func.id} funcName={func.name} onChangeArg={onChangeArg} - bodyID={bodyID} onGenerateScript={onGenerateScript} /> ) diff --git a/ui/src/ifql/components/FuncNode.tsx b/ui/src/ifql/components/FuncNode.tsx index 6bb8bbfcd2..47f049f6e6 100644 --- a/ui/src/ifql/components/FuncNode.tsx +++ b/ui/src/ifql/components/FuncNode.tsx @@ -36,8 +36,8 @@ export default class FuncNode extends PureComponent { {isOpen && ( )} diff --git a/ui/src/ifql/containers/IFQLPage.tsx b/ui/src/ifql/containers/IFQLPage.tsx index 49ed8e3a23..662e48d7d7 100644 --- a/ui/src/ifql/containers/IFQLPage.tsx +++ b/ui/src/ifql/containers/IFQLPage.tsx @@ -199,12 +199,12 @@ export class IFQLPage extends PureComponent { private handleDeleteFuncNode = (funcID: string, bodyID: string): void => { // TODO: export this and test functionality const script = this.state.body - .map((expression, expressionIndex) => { - if (expression.id !== bodyID) { - return expression.source + .map((body, bodyIndex) => { + if (body.id !== bodyID) { + return body.source } - const funcs = expression.funcs.filter(f => f.id !== funcID) + const funcs = body.funcs.filter(f => f.id !== funcID) const source = funcs.reduce((acc, f, i) => { if (i === 0) { return `${f.source}` @@ -213,7 +213,7 @@ export class IFQLPage extends PureComponent { return `${acc}\n\t${f.source}` }, '') - const isLast = expressionIndex === this.state.body.length - 1 + const isLast = bodyIndex === this.state.body.length - 1 if (isLast) { return `${source}` }