From 11db48e76e569b6e247511f2d312a8d83930c573 Mon Sep 17 00:00:00 2001 From: Johannes Schill Date: Tue, 12 Feb 2019 16:19:23 +0100 Subject: [PATCH] feat: Highlight vizpicker input when there are no panels matching the search query --- .../dashboard/panel_editor/EditorTabBody.tsx | 2 +- .../panel_editor/VisualizationTab.tsx | 21 +++++++++++++++---- .../dashboard/panel_editor/VizTypePicker.tsx | 6 ++++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/public/app/features/dashboard/panel_editor/EditorTabBody.tsx b/public/app/features/dashboard/panel_editor/EditorTabBody.tsx index 0413cae8a7b..3183f7a7b24 100644 --- a/public/app/features/dashboard/panel_editor/EditorTabBody.tsx +++ b/public/app/features/dashboard/panel_editor/EditorTabBody.tsx @@ -36,7 +36,7 @@ export class EditorTabBody extends PureComponent { toolbarItems: [], }; - constructor(props) { + constructor(props: Props) { super(props); this.state = { diff --git a/public/app/features/dashboard/panel_editor/VisualizationTab.tsx b/public/app/features/dashboard/panel_editor/VisualizationTab.tsx index 37f109250a7..efb1caf0cf7 100644 --- a/public/app/features/dashboard/panel_editor/VisualizationTab.tsx +++ b/public/app/features/dashboard/panel_editor/VisualizationTab.tsx @@ -1,5 +1,5 @@ // Libraries -import React, { PureComponent } from 'react'; +import React, { PureComponent, ChangeEvent } from 'react'; // Utils & Services import { AngularComponent, getAngularLoader } from 'app/core/services/AngularLoader'; @@ -31,6 +31,7 @@ interface Props { interface State { isVizPickerOpen: boolean; searchQuery: string; + searchResults: PanelPlugin[]; scrollTop: number; } @@ -39,12 +40,13 @@ export class VisualizationTab extends PureComponent { angularOptions: AngularComponent; searchInput: HTMLElement; - constructor(props) { + constructor(props: Props) { super(props); this.state = { isVizPickerOpen: this.props.urlOpenVizPicker, searchQuery: '', + searchResults: [], scrollTop: 0, }; } @@ -170,7 +172,7 @@ export class VisualizationTab extends PureComponent { this.setState({ isVizPickerOpen: false }); }; - onSearchQueryChange = evt => { + onSearchQueryChange = (evt: ChangeEvent) => { const value = evt.target.value; this.setState({ searchQuery: value, @@ -187,7 +189,7 @@ export class VisualizationTab extends PureComponent {