|
@@ -17,13 +17,14 @@ import IndicatorsContainer from 'app/core/components/Picker/IndicatorsContainer'
|
|
|
import NoOptionsMessage from 'app/core/components/Picker/NoOptionsMessage';
|
|
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 DefaultQueryRows from './QueryRows';
|
|
|
|
|
-import DefaultGraph from './Graph';
|
|
|
|
|
-import DefaultLogs from './Logs';
|
|
|
|
|
-import DefaultTable from './Table';
|
|
|
|
|
|
|
+import QueryRows from './QueryRows';
|
|
|
|
|
+import Graph from './Graph';
|
|
|
|
|
+import Logs from './Logs';
|
|
|
|
|
+import Table from './Table';
|
|
|
import ErrorBoundary from './ErrorBoundary';
|
|
import ErrorBoundary from './ErrorBoundary';
|
|
|
import TimePicker from './TimePicker';
|
|
import TimePicker from './TimePicker';
|
|
|
import { ensureQueries, generateQueryKey, hasQuery } from './utils/query';
|
|
import { ensureQueries, generateQueryKey, hasQuery } from './utils/query';
|
|
|
|
|
+import { DataSource } from 'app/types/datasources';
|
|
|
|
|
|
|
|
const MAX_HISTORY_ITEMS = 100;
|
|
const MAX_HISTORY_ITEMS = 100;
|
|
|
|
|
|
|
@@ -96,7 +97,6 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
initialQueries = ensureQueries(queries);
|
|
initialQueries = ensureQueries(queries);
|
|
|
const initialRange = range || { ...DEFAULT_RANGE };
|
|
const initialRange = range || { ...DEFAULT_RANGE };
|
|
|
this.state = {
|
|
this.state = {
|
|
|
- customComponents: {},
|
|
|
|
|
datasource: null,
|
|
datasource: null,
|
|
|
datasourceError: null,
|
|
datasourceError: null,
|
|
|
datasourceLoading: null,
|
|
datasourceLoading: null,
|
|
@@ -149,7 +149,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- async setDatasource(datasource) {
|
|
|
|
|
|
|
+ async setDatasource(datasource: DataSource) {
|
|
|
const supportsGraph = datasource.meta.metrics;
|
|
const supportsGraph = datasource.meta.metrics;
|
|
|
const supportsLogs = datasource.meta.logs;
|
|
const supportsLogs = datasource.meta.logs;
|
|
|
const supportsTable = datasource.meta.metrics;
|
|
const supportsTable = datasource.meta.metrics;
|
|
@@ -177,13 +177,12 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
query: this.queryExpressions[i],
|
|
query: this.queryExpressions[i],
|
|
|
}));
|
|
}));
|
|
|
|
|
|
|
|
- const customComponents = {
|
|
|
|
|
- ...datasource.exploreComponents,
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ // Custom components
|
|
|
|
|
+ const StartPage = datasource.pluginExports.ExploreStartPage;
|
|
|
|
|
|
|
|
this.setState(
|
|
this.setState(
|
|
|
{
|
|
{
|
|
|
- customComponents,
|
|
|
|
|
|
|
+ StartPage,
|
|
|
datasource,
|
|
datasource,
|
|
|
datasourceError,
|
|
datasourceError,
|
|
|
history,
|
|
history,
|
|
@@ -398,9 +397,9 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
q.query = this.queryExpressions[i];
|
|
q.query = this.queryExpressions[i];
|
|
|
return i === index
|
|
return i === index
|
|
|
? {
|
|
? {
|
|
|
- key: generateQueryKey(index),
|
|
|
|
|
- query: datasource.modifyQuery(q.query, action),
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ key: generateQueryKey(index),
|
|
|
|
|
+ query: datasource.modifyQuery(q.query, action),
|
|
|
|
|
+ }
|
|
|
: q;
|
|
: q;
|
|
|
});
|
|
});
|
|
|
nextQueryTransactions = queryTransactions
|
|
nextQueryTransactions = queryTransactions
|
|
@@ -734,7 +733,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
render() {
|
|
render() {
|
|
|
const { position, split } = this.props;
|
|
const { position, split } = this.props;
|
|
|
const {
|
|
const {
|
|
|
- customComponents,
|
|
|
|
|
|
|
+ StartPage,
|
|
|
datasource,
|
|
datasource,
|
|
|
datasourceError,
|
|
datasourceError,
|
|
|
datasourceLoading,
|
|
datasourceLoading,
|
|
@@ -774,14 +773,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
queryTransactions.filter(qt => qt.resultType === 'Logs' && qt.done && qt.result).map(qt => qt.result)
|
|
queryTransactions.filter(qt => qt.resultType === 'Logs' && qt.done && qt.result).map(qt => qt.result)
|
|
|
);
|
|
);
|
|
|
const loading = queryTransactions.some(qt => !qt.done);
|
|
const loading = queryTransactions.some(qt => !qt.done);
|
|
|
- const showStartPages = queryTransactions.length === 0 && customComponents.StartPage;
|
|
|
|
|
-
|
|
|
|
|
- // Custom components
|
|
|
|
|
- const Graph = customComponents.Graph || DefaultGraph;
|
|
|
|
|
- const Logs = customComponents.Logs || DefaultLogs;
|
|
|
|
|
- const QueryRows = customComponents.QueryRows || DefaultQueryRows;
|
|
|
|
|
- const StartPage = customComponents.StartPage;
|
|
|
|
|
- const Table = customComponents.Table || DefaultTable;
|
|
|
|
|
|
|
+ const showStartPages = StartPage && queryTransactions.length === 0;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div className={exploreClass} ref={this.getRef}>
|
|
<div className={exploreClass} ref={this.getRef}>
|
|
@@ -794,12 +786,12 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
</a>
|
|
</a>
|
|
|
</div>
|
|
</div>
|
|
|
) : (
|
|
) : (
|
|
|
- <div className="navbar-buttons explore-first-button">
|
|
|
|
|
- <button className="btn navbar-button" onClick={this.onClickCloseSplit}>
|
|
|
|
|
- Close Split
|
|
|
|
|
|
|
+ <div className="navbar-buttons explore-first-button">
|
|
|
|
|
+ <button className="btn navbar-button" onClick={this.onClickCloseSplit}>
|
|
|
|
|
+ Close Split
|
|
|
</button>
|
|
</button>
|
|
|
- </div>
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ </div>
|
|
|
|
|
+ )}
|
|
|
{!datasourceMissing ? (
|
|
{!datasourceMissing ? (
|
|
|
<div className="navbar-buttons">
|
|
<div className="navbar-buttons">
|
|
|
<Select
|
|
<Select
|
|
@@ -858,7 +850,6 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
{datasource && !datasourceError ? (
|
|
{datasource && !datasourceError ? (
|
|
|
<div className="explore-container">
|
|
<div className="explore-container">
|
|
|
<QueryRows
|
|
<QueryRows
|
|
|
- customComponents={customComponents}
|
|
|
|
|
datasource={datasource}
|
|
datasource={datasource}
|
|
|
history={history}
|
|
history={history}
|
|
|
queries={queries}
|
|
queries={queries}
|
|
@@ -879,17 +870,17 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|
|
{supportsGraph ? (
|
|
{supportsGraph ? (
|
|
|
<button className={`btn toggle-btn ${graphButtonActive}`} onClick={this.onClickGraphButton}>
|
|
<button className={`btn toggle-btn ${graphButtonActive}`} onClick={this.onClickGraphButton}>
|
|
|
Graph
|
|
Graph
|
|
|
- </button>
|
|
|
|
|
|
|
+ </button>
|
|
|
) : null}
|
|
) : null}
|
|
|
{supportsTable ? (
|
|
{supportsTable ? (
|
|
|
<button className={`btn toggle-btn ${tableButtonActive}`} onClick={this.onClickTableButton}>
|
|
<button className={`btn toggle-btn ${tableButtonActive}`} onClick={this.onClickTableButton}>
|
|
|
Table
|
|
Table
|
|
|
- </button>
|
|
|
|
|
|
|
+ </button>
|
|
|
) : null}
|
|
) : null}
|
|
|
{supportsLogs ? (
|
|
{supportsLogs ? (
|
|
|
<button className={`btn toggle-btn ${logsButtonActive}`} onClick={this.onClickLogsButton}>
|
|
<button className={`btn toggle-btn ${logsButtonActive}`} onClick={this.onClickLogsButton}>
|
|
|
Logs
|
|
Logs
|
|
|
- </button>
|
|
|
|
|
|
|
+ </button>
|
|
|
) : null}
|
|
) : null}
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|