Commit 00f04f4e by David Kaltschmidt

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
parent f43735ac
......@@ -267,6 +267,15 @@ export class Explore extends React.Component<any, IExploreState> {
}
};
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<any, IExploreState> {
</button>
</div>
) : null}
<TimePicker range={range} onChangeTime={this.handleChangeTime} />
<div className="navbar-buttons">
{supportsGraph ? (
<button className={`btn navbar-button ${graphButtonActive}`} onClick={this.handleClickGraphButton}>
Graph
</button>
) : null}
{supportsTable ? (
<button className={`btn navbar-button ${tableButtonActive}`} onClick={this.handleClickTableButton}>
Table
</button>
) : null}
{supportsLogs ? (
<button className={`btn navbar-button ${logsButtonActive}`} onClick={this.handleClickLogsButton}>
Logs
</button>
) : null}
<button className="btn navbar-button navbar-button--no-icon" onClick={this.onClickClear}>
Clear All
</button>
</div>
<TimePicker range={range} onChangeTime={this.handleChangeTime} />
<div className="navbar-buttons relative">
<button className="btn navbar-button--primary" onClick={this.handleSubmit}>
Run Query <i className="fa fa-level-down run-icon" />
......@@ -514,6 +511,25 @@ export class Explore extends React.Component<any, IExploreState> {
onRemoveQueryRow={this.handleRemoveQueryRow}
/>
{queryError && !loading ? <div className="text-warning m-a-2">{queryError}</div> : null}
<div className="result-options">
{supportsGraph ? (
<button className={`btn navbar-button ${graphButtonActive}`} onClick={this.handleClickGraphButton}>
Graph
</button>
) : null}
{supportsTable ? (
<button className={`btn navbar-button ${tableButtonActive}`} onClick={this.handleClickTableButton}>
Table
</button>
) : null}
{supportsLogs ? (
<button className={`btn navbar-button ${logsButtonActive}`} onClick={this.handleClickLogsButton}>
Logs
</button>
) : null}
</div>
<main className="m-t-2">
{supportsGraph && showingGraph ? (
<Graph
......
......@@ -84,7 +84,9 @@ class Graph extends Component<any, any> {
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<any, any> {
data: ts.getFlotPairs('null'),
}));
const $el = $(`#${this.props.id}`);
const ticks = $el.width() / 100;
let { from, to } = userOptions.range;
if (!moment.isMoment(from)) {
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment