From 08f8aa8718c7733c12aa535b71f6ee53a989a20d Mon Sep 17 00:00:00 2001 From: Delmer Reed Date: Mon, 30 Jul 2018 18:23:17 -0400 Subject: [PATCH 1/6] Fix unused handler method linting error --- ui/src/dashboards/components/InfluxQLEditor.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/ui/src/dashboards/components/InfluxQLEditor.tsx b/ui/src/dashboards/components/InfluxQLEditor.tsx index 92181204f..134bdcdc3 100644 --- a/ui/src/dashboards/components/InfluxQLEditor.tsx +++ b/ui/src/dashboards/components/InfluxQLEditor.tsx @@ -325,10 +325,6 @@ class InfluxQLEditor extends Component { } } - private hideTemplateValues = (): void => { - this.setState({isShowingTemplateValues: false}) - } - private handleHideAndFocus = (): void => { this.setState({isShowingTemplateValues: false, focused: true}) } From 5f37b7d16ae65e7c96a0c1de61a1006d6225247b Mon Sep 17 00:00:00 2001 From: Delmer Reed Date: Mon, 30 Jul 2018 13:56:16 -0400 Subject: [PATCH 2/6] Fix save on editor blur --- .../dashboards/components/InfluxQLEditor.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/ui/src/dashboards/components/InfluxQLEditor.tsx b/ui/src/dashboards/components/InfluxQLEditor.tsx index 134bdcdc3..39cb97e0f 100644 --- a/ui/src/dashboards/components/InfluxQLEditor.tsx +++ b/ui/src/dashboards/components/InfluxQLEditor.tsx @@ -117,7 +117,11 @@ class InfluxQLEditor extends Component { } = this.state return ( -
+
{this.dismissPreviewButton} { focus: focused, 'read-only': isShowingTemplateValues, })} - onClick={this.handleVarmojiFocus} >
@@ -175,7 +178,7 @@ class InfluxQLEditor extends Component { this.setState({focused: false}) this.hideTemplateValues() - this.handleUpdate() + this.handleBlurEditor() } private handleTemplateSelection = ( @@ -193,6 +196,10 @@ class InfluxQLEditor extends Component { this.setState({focused: true}) } + private handleBlurEditor = (): void => { + this.handleUpdate() + } + private handleCloseDrawer = (): void => { this.setState({isTemplating: false}) } @@ -209,8 +216,11 @@ class InfluxQLEditor extends Component { this.closeDrawer() } - private handleVarmojiFocus = (): void => { + private handleVarmojiFocus = (e: MouseEvent): void => { this.setState({focused: true}) + + e.stopPropagation() + e.preventDefault() } private handleUpdateTemplatingQueryText = (value: string): void => { @@ -362,6 +372,7 @@ class InfluxQLEditor extends Component {