mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
QueryOptions: update maxDataPoints text and show any value that is configured (#18761)
* update maxDataPoints UI * use maxDataPoints to calculate interval * don't change interval calculation
This commit is contained in:
parent
4c0e5b14f5
commit
7b856ae040
@ -71,7 +71,8 @@ export class QueryOptions extends PureComponent<Props, State> {
|
|||||||
tooltipInfo: (
|
tooltipInfo: (
|
||||||
<>
|
<>
|
||||||
The maximum data points the query should return. For graphs this is automatically set to one data point per
|
The maximum data points the query should return. For graphs this is automatically set to one data point per
|
||||||
pixel. For some data sources this can also be capped in the datasource settings page.
|
pixel. For some data sources this can also be capped in the datasource settings page. With streaming data,
|
||||||
|
this value is used for the rolling buffer.
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -156,27 +157,31 @@ export class QueryOptions extends PureComponent<Props, State> {
|
|||||||
this.setState({ ...this.state, [panelKey]: event.target.value });
|
this.setState({ ...this.state, [panelKey]: event.target.value });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Show options for any value that is set, or values that the
|
||||||
|
* current datasource says it will use
|
||||||
|
*/
|
||||||
renderOptions = () => {
|
renderOptions = () => {
|
||||||
const { datasource } = this.props;
|
const { datasource } = this.props;
|
||||||
const { queryOptions } = datasource.meta;
|
const queryOptions: any = datasource.meta.queryOptions || {};
|
||||||
|
|
||||||
if (!queryOptions) {
|
return Object.keys(this.allOptions).map(key => {
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Object.keys(queryOptions).map(key => {
|
|
||||||
const options = this.allOptions[key];
|
const options = this.allOptions[key];
|
||||||
const panelKey = options.panelKey || key;
|
const panelKey = options.panelKey || key;
|
||||||
return (
|
// @ts-ignore
|
||||||
<DataSourceOption
|
const value = this.state[panelKey];
|
||||||
key={key}
|
if (value || queryOptions[key]) {
|
||||||
{...options}
|
return (
|
||||||
onChange={this.onDataSourceOptionChange(panelKey)}
|
<DataSourceOption
|
||||||
onBlur={this.onDataSourceOptionBlur(panelKey)}
|
key={key}
|
||||||
// @ts-ignore
|
{...options}
|
||||||
value={this.state[panelKey]}
|
onChange={this.onDataSourceOptionChange(panelKey)}
|
||||||
/>
|
onBlur={this.onDataSourceOptionBlur(panelKey)}
|
||||||
);
|
value={value}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null; // nothing to render
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -175,9 +175,9 @@ export class SignalWorker extends StreamWorker {
|
|||||||
};
|
};
|
||||||
|
|
||||||
initBuffer(refId: string) {
|
initBuffer(refId: string) {
|
||||||
const { speed, buffer } = this.query;
|
const { speed } = this.query;
|
||||||
const request = this.stream.request;
|
const request = this.stream.request;
|
||||||
const maxRows = buffer ? buffer : request.maxDataPoints;
|
const maxRows = request.maxDataPoints || 1000;
|
||||||
const times = new CircularVector({ capacity: maxRows });
|
const times = new CircularVector({ capacity: maxRows });
|
||||||
const vals = new CircularVector({ capacity: maxRows });
|
const vals = new CircularVector({ capacity: maxRows });
|
||||||
this.values = [times, vals];
|
this.values = [times, vals];
|
||||||
@ -341,11 +341,11 @@ export class LogsWorker extends StreamWorker {
|
|||||||
};
|
};
|
||||||
|
|
||||||
initBuffer(refId: string) {
|
initBuffer(refId: string) {
|
||||||
const { speed, buffer } = this.query;
|
const { speed } = this.query;
|
||||||
|
|
||||||
const request = this.stream.request;
|
const request = this.stream.request;
|
||||||
|
|
||||||
const maxRows = buffer ? buffer : request.maxDataPoints;
|
const maxRows = request.maxDataPoints || 1000;
|
||||||
|
|
||||||
const times = new CircularVector({ capacity: maxRows });
|
const times = new CircularVector({ capacity: maxRows });
|
||||||
const lines = new CircularVector({ capacity: maxRows });
|
const lines = new CircularVector({ capacity: maxRows });
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
"annotations": true,
|
"annotations": true,
|
||||||
|
|
||||||
"queryOptions": {
|
"queryOptions": {
|
||||||
"minInterval": true
|
"minInterval": true,
|
||||||
|
"maxDataPoints": true
|
||||||
},
|
},
|
||||||
|
|
||||||
"info": {
|
"info": {
|
||||||
|
@ -18,7 +18,6 @@ export interface StreamingQuery {
|
|||||||
speed: number;
|
speed: number;
|
||||||
spread: number;
|
spread: number;
|
||||||
noise: number; // wiggle around the signal for min/max
|
noise: number; // wiggle around the signal for min/max
|
||||||
bands?: number; // number of bands around the middle van
|
bands?: number; // number of bands around the middle band
|
||||||
buffer?: number;
|
|
||||||
url?: string; // the Fetch URL
|
url?: string; // the Fetch URL
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user