@@ -245,7 +245,7 @@ class AdminInfluxDBPage extends Component {
const {arrayOf, func, shape, string} = PropTypes
-AdminInfluxDBPage.propTypes = {
+DisconnectedAdminInfluxDBPage.propTypes = {
source: shape({
id: string.isRequired,
links: shape({
@@ -317,4 +317,6 @@ const mapDispatchToProps = dispatch => ({
notify: bindActionCreators(notifyAction, dispatch),
})
-export default connect(mapStateToProps, mapDispatchToProps)(AdminInfluxDBPage)
+export default connect(mapStateToProps, mapDispatchToProps)(
+ DisconnectedAdminInfluxDBPage
+)
diff --git a/ui/src/admin/containers/chronograf/AdminChronografPage.js b/ui/src/admin/containers/chronograf/AdminChronografPage.js
index b672f1ea8..6511914ce 100644
--- a/ui/src/admin/containers/chronograf/AdminChronografPage.js
+++ b/ui/src/admin/containers/chronograf/AdminChronografPage.js
@@ -50,7 +50,7 @@ const sections = me => [
const AdminChronografPage = ({me, source, params: {tab}}) => (
-
+
{
if (func.name === 'filter') {
isAfterFilter = true
}
-
const isYieldable = isAfterFilter && isAfterRange
const funcNode = (
@@ -111,12 +110,18 @@ class ExpressionNode extends PureComponent {
isYieldable
)
+ let yieldFunc = func
+
+ if (this.isYieldNodeIndex(i + 1)) {
+ yieldFunc = funcs[i + 1]
+ }
+
return (
{funcNode}
{
{this.renderEqualitySwitcher()}
{this.state.isOpen && (
- <>
+
{
{this.isLoading &&
}
{!this.isLoading && (
- <>
-
- >
+
)}
- >
+
)}
)
diff --git a/ui/src/flux/components/FuncNode.tsx b/ui/src/flux/components/FuncNode.tsx
index fc2607577..dd5109b9f 100644
--- a/ui/src/flux/components/FuncNode.tsx
+++ b/ui/src/flux/components/FuncNode.tsx
@@ -2,6 +2,7 @@ import React, {PureComponent, MouseEvent} from 'react'
import classnames from 'classnames'
import _ from 'lodash'
+import {getDeep} from 'src/utils/wrappers'
import BodyDelete from 'src/flux/components/BodyDelete'
import FuncArgs from 'src/flux/components/FuncArgs'
import FuncArgsPreview from 'src/flux/components/FuncArgsPreview'
@@ -13,6 +14,7 @@ import {
Func,
} from 'src/types/flux'
import {ErrorHandling} from 'src/shared/decorators/errors'
+
import {Service} from 'src/types'
interface Props {
@@ -166,9 +168,31 @@ export default class FuncNode extends PureComponent
{
}
private handleDelete = (): void => {
- const {func, bodyID, declarationID} = this.props
+ const {
+ func,
+ funcs,
+ index,
+ bodyID,
+ declarationID,
+ isYielding,
+ isYieldedInScript,
+ onToggleYieldWithLast,
+ } = this.props
- this.props.onDelete({funcID: func.id, bodyID, declarationID})
+ let yieldFuncNodeID: string
+
+ if (isYieldedInScript) {
+ yieldFuncNodeID = getDeep(funcs, `${index + 1}.id`, '')
+ } else if (isYielding) {
+ onToggleYieldWithLast(index)
+ }
+
+ this.props.onDelete({
+ funcID: func.id,
+ yieldNodeID: yieldFuncNodeID,
+ bodyID,
+ declarationID,
+ })
}
private handleToggleEdit = (e: MouseEvent): void => {
diff --git a/ui/src/flux/components/YieldFuncNode.tsx b/ui/src/flux/components/YieldFuncNode.tsx
index b420c04e3..1f35122bf 100644
--- a/ui/src/flux/components/YieldFuncNode.tsx
+++ b/ui/src/flux/components/YieldFuncNode.tsx
@@ -37,6 +37,12 @@ class YieldFuncNode extends PureComponent {
this.getData()
}
+ public componentDidUpdate(prevProps: Props) {
+ if (prevProps.script !== this.props.script) {
+ this.getData()
+ }
+ }
+
public render() {
const {func} = this.props
const {data} = this.state
diff --git a/ui/src/flux/containers/FluxPage.tsx b/ui/src/flux/containers/FluxPage.tsx
index 59b57431a..53e8305a1 100644
--- a/ui/src/flux/containers/FluxPage.tsx
+++ b/ui/src/flux/containers/FluxPage.tsx
@@ -522,7 +522,7 @@ export class FluxPage extends PureComponent {
}
private handleDeleteFuncNode = (ids: DeleteFuncNodeArgs): void => {
- const {funcID, declarationID = '', bodyID} = ids
+ const {funcID, declarationID = '', bodyID, yieldNodeID = ''} = ids
const script = this.state.body
.map((body, bodyIndex) => {
@@ -541,12 +541,17 @@ export class FluxPage extends PureComponent {
return
}
- const functions = declaration.funcs.filter(f => f.id !== funcID)
+ const functions = declaration.funcs.filter(
+ f => f.id !== funcID && f.id !== yieldNodeID
+ )
+
const s = this.funcsToSource(functions)
return `${declaration.name} = ${this.formatLastSource(s, isLast)}`
}
- const funcs = body.funcs.filter(f => f.id !== funcID)
+ const funcs = body.funcs.filter(
+ f => f.id !== funcID && f.id !== yieldNodeID
+ )
const source = this.funcsToSource(funcs)
return this.formatLastSource(source, isLast)
})
diff --git a/ui/src/hosts/containers/HostsPage.js b/ui/src/hosts/containers/HostsPage.js
index 5058be5c0..1dd225119 100644
--- a/ui/src/hosts/containers/HostsPage.js
+++ b/ui/src/hosts/containers/HostsPage.js
@@ -115,7 +115,7 @@ export class HostsPage extends Component {
return (
@@ -137,7 +137,7 @@ export class HostsPage extends Component {
)
}
- optionsComponents = () => {
+ get optionsComponents() {
const {autoRefresh, onChooseAutoRefresh, onManualRefresh} = this.props
return (
diff --git a/ui/src/index.template.html b/ui/src/index.template.html
index 1ebed4a16..7e72a7bd5 100644
--- a/ui/src/index.template.html
+++ b/ui/src/index.template.html
@@ -10,6 +10,4 @@