From 00f04f4ea0d0eab8ab1cc724b5431675e98d8d91 Mon Sep 17 00:00:00 2001 From: David Kaltschmidt Date: Sat, 4 Aug 2018 11:47:04 +0200 Subject: [PATCH] Add clear button to Explore - Clear All button to clear all queries and results - moved result viewer buttons below query rows to make it more clear that they govern result options --- public/app/containers/Explore/Explore.tsx | 50 +++++++++++++++-------- public/app/containers/Explore/Graph.tsx | 3 +- public/sass/pages/_explore.scss | 8 ++++ 3 files changed, 43 insertions(+), 18 deletions(-) diff --git a/public/app/containers/Explore/Explore.tsx b/public/app/containers/Explore/Explore.tsx index 53c43782ad6..772617dd7c1 100644 --- a/public/app/containers/Explore/Explore.tsx +++ b/public/app/containers/Explore/Explore.tsx @@ -267,6 +267,15 @@ export class Explore extends React.Component { } }; + onClickClear = () => { + this.setState({ + graphResult: null, + logsResult: null, + queries: ensureQueries(), + tableResult: null, + }); + }; + onClickTableCell = (columnKey: string, rowValue: string) => { const { datasource, queries } = this.state; if (datasource && datasource.modifyQuery) { @@ -466,24 +475,12 @@ export class Explore extends React.Component { ) : null} -
- {supportsGraph ? ( - - ) : null} - {supportsTable ? ( - - ) : null} - {supportsLogs ? ( - - ) : null} -
+
+ +
+ ) : null} + {supportsTable ? ( + + ) : null} + {supportsLogs ? ( + + ) : null} +
+
{supportsGraph && showingGraph ? ( { draw() { const { data, options: userOptions } = this.props; + const $el = $(`#${this.props.id}`); if (!data) { + $el.empty(); return; } const series = data.map((ts: TimeSeries) => ({ @@ -93,7 +95,6 @@ class Graph extends Component { data: ts.getFlotPairs('null'), })); - const $el = $(`#${this.props.id}`); const ticks = $el.width() / 100; let { from, to } = userOptions.range; if (!moment.isMoment(from)) { diff --git a/public/sass/pages/_explore.scss b/public/sass/pages/_explore.scss index 59b8b62f349..52ddbc03636 100644 --- a/public/sass/pages/_explore.scss +++ b/public/sass/pages/_explore.scss @@ -47,6 +47,14 @@ background-color: $btn-active-bg; } + .navbar-button--no-icon { + line-height: 18px; + } + + .result-options { + margin-top: 2 * $panel-margin; + } + .elapsed-time { position: absolute; left: 0;