diff --git a/CHANGELOG.md b/CHANGELOG.md index e8b3a6d1b..94131b4ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ 1. [#3697](https://github.com/influxdata/chronograf/pull/3697): Fix allowing hyphens in basepath 1. [#3698](https://github.com/influxdata/chronograf/pull/3698): Fix error in cell when tempVar returns no values 1. [#3733](https://github.com/influxdata/chronograf/pull/3733): Change arrows in table columns so that ascending sort points up and descending points down +1. [#3751](https://github.com/influxdata/chronograf/pull/3751): Fix crosshairs moving passed the edges of graphs ## v1.5.0.0 [2018-05-15-RC] diff --git a/ui/src/admin/containers/AdminInfluxDBPage.js b/ui/src/admin/containers/AdminInfluxDBPage.js index e61754671..80c5f9395 100644 --- a/ui/src/admin/containers/AdminInfluxDBPage.js +++ b/ui/src/admin/containers/AdminInfluxDBPage.js @@ -52,7 +52,7 @@ const isValidRole = role => { } @ErrorHandling -class AdminInfluxDBPage extends Component { +export class DisconnectedAdminInfluxDBPage extends Component { constructor(props) { super(props) } @@ -223,7 +223,7 @@ class AdminInfluxDBPage extends Component { return (
- + {users ? (
@@ -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 @@
- - - \ No newline at end of file + diff --git a/ui/src/shared/components/Crosshair.tsx b/ui/src/shared/components/Crosshair.tsx index 79b63af28..279955414 100644 --- a/ui/src/shared/components/Crosshair.tsx +++ b/ui/src/shared/components/Crosshair.tsx @@ -34,9 +34,17 @@ class Crosshair extends PureComponent { } private get isVisible() { - const {hoverTime} = this.props + const {dygraph, hoverTime} = this.props + const timeRanges = dygraph.xAxisRange() - return hoverTime !== 0 && _.isFinite(hoverTime) + const minTimeRange = _.get(timeRanges, '0', 0) + const isBeforeMinTimeRange = hoverTime < minTimeRange + + const maxTimeRange = _.get(timeRanges, '1', Infinity) + const isPastMaxTimeRange = hoverTime > maxTimeRange + + const isValidHoverTime = !isBeforeMinTimeRange && !isPastMaxTimeRange + return isValidHoverTime && hoverTime !== 0 && _.isFinite(hoverTime) } private get crosshairLeft(): number { diff --git a/ui/src/shared/components/PageHeader.tsx b/ui/src/shared/components/PageHeader.tsx index e7ab4c61c..c919f557a 100644 --- a/ui/src/shared/components/PageHeader.tsx +++ b/ui/src/shared/components/PageHeader.tsx @@ -48,7 +48,7 @@ class PageHeader extends Component { const {titleText, titleComponents} = this.props if (!titleText && !titleComponents) { - console.error( + throw new Error( 'PageHeader requires either titleText or titleComponents prop' ) } diff --git a/ui/src/style/components/edit-template-variable.scss b/ui/src/style/components/edit-template-variable.scss index f10be42fe..18a75a297 100644 --- a/ui/src/style/components/edit-template-variable.scss +++ b/ui/src/style/components/edit-template-variable.scss @@ -13,6 +13,13 @@ $padding: 20px 30px; justify-content: space-between; } +.edit-temp-var--header > h1 { + color: #eeeff2; + letter-spacing: 0; + font-size: 19px; + font-weight: 400; +} + .edit-temp-var--header-controls > button { display: inline-block; margin: 0 5px; diff --git a/ui/src/tempVars/components/TemplateControlBar.tsx b/ui/src/tempVars/components/TemplateControlBar.tsx index b89f12582..ffa068ac3 100644 --- a/ui/src/tempVars/components/TemplateControlBar.tsx +++ b/ui/src/tempVars/components/TemplateControlBar.tsx @@ -77,6 +77,7 @@ class TemplateControlBar extends Component {