|
@@ -19,6 +19,7 @@ import NoOptionsMessage from 'app/core/components/Picker/NoOptionsMessage';
|
|
|
import TableModel, { mergeTablesIntoModel } from 'app/core/table_model';
|
|
import TableModel, { mergeTablesIntoModel } from 'app/core/table_model';
|
|
|
import { DatasourceSrv } from 'app/features/plugins/datasource_srv';
|
|
import { DatasourceSrv } from 'app/features/plugins/datasource_srv';
|
|
|
|
|
|
|
|
|
|
+import Panel from './Panel';
|
|
|
import QueryRows from './QueryRows';
|
|
import QueryRows from './QueryRows';
|
|
|
import Graph from './Graph';
|
|
import Graph from './Graph';
|
|
|
import Logs from './Logs';
|
|
import Logs from './Logs';
|
|
@@ -127,6 +128,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
range: initialRange,
|
|
range: initialRange,
|
|
|
showingGraph: true,
|
|
showingGraph: true,
|
|
|
showingLogs: true,
|
|
showingLogs: true,
|
|
|
|
|
+ showingStartPage: false,
|
|
|
showingTable: true,
|
|
showingTable: true,
|
|
|
supportsGraph: null,
|
|
supportsGraph: null,
|
|
|
supportsLogs: null,
|
|
supportsLogs: null,
|
|
@@ -238,6 +240,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
datasourceLoading: false,
|
|
datasourceLoading: false,
|
|
|
datasourceName: datasource.name,
|
|
datasourceName: datasource.name,
|
|
|
queries: nextQueries,
|
|
queries: nextQueries,
|
|
|
|
|
+ showingStartPage: Boolean(StartPage),
|
|
|
},
|
|
},
|
|
|
() => {
|
|
() => {
|
|
|
if (datasourceError === null) {
|
|
if (datasourceError === null) {
|
|
@@ -329,10 +332,11 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
onClickClear = () => {
|
|
onClickClear = () => {
|
|
|
this.queryExpressions = [''];
|
|
this.queryExpressions = [''];
|
|
|
this.setState(
|
|
this.setState(
|
|
|
- {
|
|
|
|
|
|
|
+ prevState => ({
|
|
|
queries: ensureQueries(),
|
|
queries: ensureQueries(),
|
|
|
queryTransactions: [],
|
|
queryTransactions: [],
|
|
|
- },
|
|
|
|
|
|
|
+ showingStartPage: Boolean(prevState.StartPage),
|
|
|
|
|
+ }),
|
|
|
this.saveState
|
|
this.saveState
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
@@ -563,6 +567,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
queryTransactions: nextQueryTransactions,
|
|
queryTransactions: nextQueryTransactions,
|
|
|
|
|
+ showingStartPage: false,
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
|
|
|
|
@@ -789,16 +794,13 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
range,
|
|
range,
|
|
|
showingGraph,
|
|
showingGraph,
|
|
|
showingLogs,
|
|
showingLogs,
|
|
|
|
|
+ showingStartPage,
|
|
|
showingTable,
|
|
showingTable,
|
|
|
supportsGraph,
|
|
supportsGraph,
|
|
|
supportsLogs,
|
|
supportsLogs,
|
|
|
supportsTable,
|
|
supportsTable,
|
|
|
} = this.state;
|
|
} = this.state;
|
|
|
- const showingBoth = showingGraph && showingTable;
|
|
|
|
|
- const graphHeight = showingBoth ? '200px' : '400px';
|
|
|
|
|
- const graphButtonActive = showingBoth || showingGraph ? 'active' : '';
|
|
|
|
|
- const logsButtonActive = showingLogs ? 'active' : '';
|
|
|
|
|
- const tableButtonActive = showingBoth || showingTable ? 'active' : '';
|
|
|
|
|
|
|
+ const graphHeight = showingGraph && showingTable ? '200px' : '400px';
|
|
|
const exploreClass = split ? 'explore explore-split' : 'explore';
|
|
const exploreClass = split ? 'explore explore-split' : 'explore';
|
|
|
const selectedDatasource = datasource ? exploreDatasources.find(d => d.label === datasource.name) : undefined;
|
|
const selectedDatasource = datasource ? exploreDatasources.find(d => d.label === datasource.name) : undefined;
|
|
|
const graphRangeIntervals = getIntervals(graphRange, datasource, this.el ? this.el.offsetWidth : 0);
|
|
const graphRangeIntervals = getIntervals(graphRange, datasource, this.el ? this.el.offsetWidth : 0);
|
|
@@ -823,8 +825,6 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
)
|
|
)
|
|
|
: undefined;
|
|
: undefined;
|
|
|
const loading = queryTransactions.some(qt => !qt.done);
|
|
const loading = queryTransactions.some(qt => !qt.done);
|
|
|
- const showStartPages = StartPage && queryTransactions.length === 0;
|
|
|
|
|
- const viewModeCount = [supportsGraph, supportsLogs, supportsTable].filter(m => m).length;
|
|
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div className={exploreClass} ref={this.getRef}>
|
|
<div className={exploreClass} ref={this.getRef}>
|
|
@@ -913,55 +913,47 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
/>
|
|
/>
|
|
|
<main className="m-t-2">
|
|
<main className="m-t-2">
|
|
|
<ErrorBoundary>
|
|
<ErrorBoundary>
|
|
|
- {showStartPages && <StartPage onClickQuery={this.onClickQuery} />}
|
|
|
|
|
- {!showStartPages && (
|
|
|
|
|
|
|
+ {showingStartPage && <StartPage onClickQuery={this.onClickQuery} />}
|
|
|
|
|
+ {!showingStartPage && (
|
|
|
<>
|
|
<>
|
|
|
- {viewModeCount > 1 && (
|
|
|
|
|
- <div className="result-options">
|
|
|
|
|
- {supportsGraph ? (
|
|
|
|
|
- <button className={`btn toggle-btn ${graphButtonActive}`} onClick={this.onClickGraphButton}>
|
|
|
|
|
- Graph
|
|
|
|
|
- </button>
|
|
|
|
|
- ) : null}
|
|
|
|
|
- {supportsTable ? (
|
|
|
|
|
- <button className={`btn toggle-btn ${tableButtonActive}`} onClick={this.onClickTableButton}>
|
|
|
|
|
- Table
|
|
|
|
|
- </button>
|
|
|
|
|
- ) : null}
|
|
|
|
|
- {supportsLogs ? (
|
|
|
|
|
- <button className={`btn toggle-btn ${logsButtonActive}`} onClick={this.onClickLogsButton}>
|
|
|
|
|
- Logs
|
|
|
|
|
- </button>
|
|
|
|
|
- ) : null}
|
|
|
|
|
- </div>
|
|
|
|
|
- )}
|
|
|
|
|
-
|
|
|
|
|
- {supportsGraph &&
|
|
|
|
|
- showingGraph && (
|
|
|
|
|
|
|
+ {supportsGraph && (
|
|
|
|
|
+ <Panel
|
|
|
|
|
+ label="Graph"
|
|
|
|
|
+ isOpen={showingGraph}
|
|
|
|
|
+ loading={graphLoading}
|
|
|
|
|
+ onToggle={this.onClickGraphButton}
|
|
|
|
|
+ >
|
|
|
<Graph
|
|
<Graph
|
|
|
data={graphResult}
|
|
data={graphResult}
|
|
|
height={graphHeight}
|
|
height={graphHeight}
|
|
|
- loading={graphLoading}
|
|
|
|
|
id={`explore-graph-${position}`}
|
|
id={`explore-graph-${position}`}
|
|
|
onChangeTime={this.onChangeTime}
|
|
onChangeTime={this.onChangeTime}
|
|
|
range={graphRange}
|
|
range={graphRange}
|
|
|
split={split}
|
|
split={split}
|
|
|
/>
|
|
/>
|
|
|
- )}
|
|
|
|
|
- {supportsTable && showingTable ? (
|
|
|
|
|
- <div className="panel-container m-t-2">
|
|
|
|
|
|
|
+ </Panel>
|
|
|
|
|
+ )}
|
|
|
|
|
+ {supportsTable && (
|
|
|
|
|
+ <Panel
|
|
|
|
|
+ label="Table"
|
|
|
|
|
+ loading={tableLoading}
|
|
|
|
|
+ isOpen={showingTable}
|
|
|
|
|
+ onToggle={this.onClickTableButton}
|
|
|
|
|
+ >
|
|
|
<Table data={tableResult} loading={tableLoading} onClickCell={this.onClickTableCell} />
|
|
<Table data={tableResult} loading={tableLoading} onClickCell={this.onClickTableCell} />
|
|
|
- </div>
|
|
|
|
|
- ) : null}
|
|
|
|
|
- {supportsLogs && showingLogs ? (
|
|
|
|
|
- <Logs
|
|
|
|
|
- data={logsResult}
|
|
|
|
|
- loading={logsLoading}
|
|
|
|
|
- position={position}
|
|
|
|
|
- onChangeTime={this.onChangeTime}
|
|
|
|
|
- range={range}
|
|
|
|
|
- />
|
|
|
|
|
- ) : null}
|
|
|
|
|
|
|
+ </Panel>
|
|
|
|
|
+ )}
|
|
|
|
|
+ {supportsLogs && (
|
|
|
|
|
+ <Panel label="Logs" loading={logsLoading} isOpen={showingLogs} onToggle={this.onClickLogsButton}>
|
|
|
|
|
+ <Logs
|
|
|
|
|
+ data={logsResult}
|
|
|
|
|
+ loading={logsLoading}
|
|
|
|
|
+ position={position}
|
|
|
|
|
+ onChangeTime={this.onChangeTime}
|
|
|
|
|
+ range={range}
|
|
|
|
|
+ />
|
|
|
|
|
+ </Panel>
|
|
|
|
|
+ )}
|
|
|
</>
|
|
</>
|
|
|
)}
|
|
)}
|
|
|
</ErrorBoundary>
|
|
</ErrorBoundary>
|