mirror of
https://github.com/grafana/grafana.git
synced 2025-12-21 12:04:45 +08:00
Compare commits
1 Commits
docs/updat
...
query-reso
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03773a0cb0 |
@@ -5265,7 +5265,7 @@ exports[`better eslint`] = {
|
|||||||
[496, 25, 293, "Do not use any type assertions.", "3989849883"],
|
[496, 25, 293, "Do not use any type assertions.", "3989849883"],
|
||||||
[498, 21, 213, "Do not use any type assertions.", "2695721884"]
|
[498, 21, 213, "Do not use any type assertions.", "2695721884"]
|
||||||
],
|
],
|
||||||
"public/app/features/dashboard/state/PanelModel.ts:2979822970": [
|
"public/app/features/dashboard/state/PanelModel.ts:3874897162": [
|
||||||
[112, 16, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[112, 16, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[131, 10, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[131, 10, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[145, 15, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[145, 15, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
@@ -5273,28 +5273,28 @@ exports[`better eslint`] = {
|
|||||||
[150, 14, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[150, 14, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[151, 21, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[151, 21, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[153, 19, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[153, 19, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[191, 21, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[192, 21, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[199, 22, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[200, 22, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[210, 18, 11, "Do not use any type assertions.", "3816020039"],
|
[211, 18, 11, "Do not use any type assertions.", "3816020039"],
|
||||||
[210, 26, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[211, 26, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[214, 18, 11, "Do not use any type assertions.", "3816020039"],
|
[215, 18, 11, "Do not use any type assertions.", "3816020039"],
|
||||||
[214, 26, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[215, 26, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[218, 14, 11, "Do not use any type assertions.", "3816020039"],
|
[219, 14, 11, "Do not use any type assertions.", "3816020039"],
|
||||||
[218, 22, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[219, 22, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[223, 7, 11, "Do not use any type assertions.", "3816020039"],
|
[224, 7, 11, "Do not use any type assertions.", "3816020039"],
|
||||||
[223, 15, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[224, 15, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[285, 17, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[286, 17, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[369, 21, 11, "Do not use any type assertions.", "3816020039"],
|
[373, 21, 11, "Do not use any type assertions.", "3816020039"],
|
||||||
[369, 29, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[373, 29, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[382, 7, 11, "Do not use any type assertions.", "3816020039"],
|
[386, 7, 11, "Do not use any type assertions.", "3816020039"],
|
||||||
[382, 15, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[386, 15, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[433, 14, 11, "Do not use any type assertions.", "3816020039"],
|
[437, 14, 11, "Do not use any type assertions.", "3816020039"],
|
||||||
[433, 22, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[437, 22, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[453, 16, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[457, 16, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[464, 22, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[468, 22, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[512, 22, 18, "Do not use any type assertions.", "1060162663"],
|
[517, 22, 18, "Do not use any type assertions.", "1060162663"],
|
||||||
[595, 38, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[600, 38, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
[654, 14, 3, "Unexpected any. Specify a different type.", "193409811"]
|
[659, 14, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||||
],
|
],
|
||||||
"public/app/features/dashboard/state/TimeModel.ts:2763994651": [
|
"public/app/features/dashboard/state/TimeModel.ts:2763994651": [
|
||||||
[3, 8, 3, "Unexpected any. Specify a different type.", "193409811"],
|
[3, 8, 3, "Unexpected any. Specify a different type.", "193409811"],
|
||||||
@@ -6572,7 +6572,7 @@ exports[`better eslint`] = {
|
|||||||
"public/app/features/query/components/QueryGroup.tsx:775269015": [
|
"public/app/features/query/components/QueryGroup.tsx:775269015": [
|
||||||
[248, 33, 3, "Unexpected any. Specify a different type.", "193409811"]
|
[248, 33, 3, "Unexpected any. Specify a different type.", "193409811"]
|
||||||
],
|
],
|
||||||
"public/app/features/query/components/QueryGroupOptions.tsx:1642191191": [
|
"public/app/features/query/components/QueryGroupOptions.tsx:183861686": [
|
||||||
[116, 48, 28, "Do not use any type assertions.", "2379647796"]
|
[116, 48, 28, "Do not use any type assertions.", "2379647796"]
|
||||||
],
|
],
|
||||||
"public/app/features/query/state/DashboardQueryRunner/AlertStatesWorker.test.ts:2602787036": [
|
"public/app/features/query/state/DashboardQueryRunner/AlertStatesWorker.test.ts:2602787036": [
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ export class PanelEditorQueries extends PureComponent<Props> {
|
|||||||
},
|
},
|
||||||
queries: panel.targets,
|
queries: panel.targets,
|
||||||
maxDataPoints: panel.maxDataPoints,
|
maxDataPoints: panel.maxDataPoints,
|
||||||
|
resolution: panel.resolution,
|
||||||
minInterval: panel.interval,
|
minInterval: panel.interval,
|
||||||
timeRange: {
|
timeRange: {
|
||||||
from: panel.timeFrom,
|
from: panel.timeFrom,
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ export class PanelModel implements DataConfigSource, IPanelModel {
|
|||||||
declare fieldConfig: FieldConfigSource;
|
declare fieldConfig: FieldConfigSource;
|
||||||
|
|
||||||
maxDataPoints?: number | null;
|
maxDataPoints?: number | null;
|
||||||
|
resolution?: number | null;
|
||||||
interval?: string | null;
|
interval?: string | null;
|
||||||
description?: string;
|
description?: string;
|
||||||
links?: DataLink[];
|
links?: DataLink[];
|
||||||
@@ -330,6 +331,8 @@ export class PanelModel implements DataConfigSource, IPanelModel {
|
|||||||
width: number,
|
width: number,
|
||||||
publicDashboardAccessToken?: string
|
publicDashboardAccessToken?: string
|
||||||
) {
|
) {
|
||||||
|
const maxDataPoints = Math.floor((this.maxDataPoints ?? width) * (this.resolution ?? 1));
|
||||||
|
|
||||||
this.getQueryRunner().run({
|
this.getQueryRunner().run({
|
||||||
datasource: this.datasource,
|
datasource: this.datasource,
|
||||||
queries: this.targets,
|
queries: this.targets,
|
||||||
@@ -339,7 +342,7 @@ export class PanelModel implements DataConfigSource, IPanelModel {
|
|||||||
timezone: dashboardTimezone,
|
timezone: dashboardTimezone,
|
||||||
timeRange: timeData.timeRange,
|
timeRange: timeData.timeRange,
|
||||||
timeInfo: timeData.timeInfo,
|
timeInfo: timeData.timeInfo,
|
||||||
maxDataPoints: this.maxDataPoints || Math.floor(width),
|
maxDataPoints: maxDataPoints,
|
||||||
minInterval: this.interval,
|
minInterval: this.interval,
|
||||||
scopedVars: this.scopedVars,
|
scopedVars: this.scopedVars,
|
||||||
cacheTimeout: this.cacheTimeout,
|
cacheTimeout: this.cacheTimeout,
|
||||||
@@ -501,6 +504,7 @@ export class PanelModel implements DataConfigSource, IPanelModel {
|
|||||||
this.hideTimeOverride = options.timeRange?.hide;
|
this.hideTimeOverride = options.timeRange?.hide;
|
||||||
this.interval = options.minInterval;
|
this.interval = options.minInterval;
|
||||||
this.maxDataPoints = options.maxDataPoints;
|
this.maxDataPoints = options.maxDataPoints;
|
||||||
|
this.resolution = options.resolution;
|
||||||
this.targets = options.queries;
|
this.targets = options.queries;
|
||||||
this.configRev++;
|
this.configRev++;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import React, { PureComponent, ChangeEvent, FocusEvent } from 'react';
|
import React, { PureComponent, ChangeEvent, FocusEvent } from 'react';
|
||||||
|
|
||||||
import { rangeUtil, PanelData, DataSourceApi } from '@grafana/data';
|
import { rangeUtil, PanelData, DataSourceApi, SelectableValue } from '@grafana/data';
|
||||||
import { Switch, Input, InlineField, InlineFormLabel, stylesFactory } from '@grafana/ui';
|
import { Switch, Input, InlineField, InlineFormLabel, stylesFactory, Select } from '@grafana/ui';
|
||||||
import { QueryOperationRow } from 'app/core/components/QueryOperationRow/QueryOperationRow';
|
import { QueryOperationRow } from 'app/core/components/QueryOperationRow/QueryOperationRow';
|
||||||
import { config } from 'app/core/config';
|
import { config } from 'app/core/config';
|
||||||
import { QueryGroupOptions } from 'app/types';
|
import { QueryGroupOptions } from 'app/types';
|
||||||
@@ -168,11 +168,29 @@ export class QueryGroupOptionsEditor extends PureComponent<Props, State> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onResolutionChange = (resolution: SelectableValue<number | undefined>) => {
|
||||||
|
this.props.onChange({
|
||||||
|
...this.props.options,
|
||||||
|
resolution: resolution.value,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
renderMaxDataPointsOption() {
|
renderMaxDataPointsOption() {
|
||||||
const { data, options } = this.props;
|
const { data, options } = this.props;
|
||||||
const realMd = data.request?.maxDataPoints;
|
let realMd = data.request?.maxDataPoints;
|
||||||
|
if (realMd && options.resolution) {
|
||||||
|
realMd = Math.floor(realMd * options.resolution);
|
||||||
|
}
|
||||||
|
|
||||||
const value = options.maxDataPoints ?? '';
|
const value = options.maxDataPoints ?? '';
|
||||||
const isAuto = value === '';
|
const isAuto = value === '';
|
||||||
|
const resolutionOptions = [
|
||||||
|
{ label: '100%', value: undefined },
|
||||||
|
{ label: '80%', value: 0.9 },
|
||||||
|
{ label: '50%', value: 0.8 },
|
||||||
|
{ label: '30%', value: 0.3 },
|
||||||
|
{ label: '10%', value: 0.1 },
|
||||||
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="gf-form-inline">
|
<div className="gf-form-inline">
|
||||||
@@ -200,6 +218,14 @@ export class QueryGroupOptionsEditor extends PureComponent<Props, State> {
|
|||||||
<>
|
<>
|
||||||
<div className="gf-form-label query-segment-operator">=</div>
|
<div className="gf-form-label query-segment-operator">=</div>
|
||||||
<div className="gf-form-label">Width of panel</div>
|
<div className="gf-form-label">Width of panel</div>
|
||||||
|
<div className="gf-form-label query-segment-operator">*</div>
|
||||||
|
<Select
|
||||||
|
width={10}
|
||||||
|
value={options.resolution}
|
||||||
|
options={resolutionOptions}
|
||||||
|
placeholder="1"
|
||||||
|
onChange={this.onResolutionChange}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ export interface QueryGroupOptions {
|
|||||||
dataSource: QueryGroupDataSource;
|
dataSource: QueryGroupDataSource;
|
||||||
maxDataPoints?: number | null;
|
maxDataPoints?: number | null;
|
||||||
minInterval?: string | null;
|
minInterval?: string | null;
|
||||||
|
resolution?: number | null;
|
||||||
cacheTimeout?: string | null;
|
cacheTimeout?: string | null;
|
||||||
timeRange?: {
|
timeRange?: {
|
||||||
from?: string | null;
|
from?: string | null;
|
||||||
|
|||||||
Reference in New Issue
Block a user