mirror of
https://github.com/grafana/grafana.git
synced 2025-02-09 23:16:16 -06:00
rename to char
This commit is contained in:
parent
515fb5903e
commit
39728c885b
@ -23,7 +23,7 @@ import {
|
|||||||
ResultGetter,
|
ResultGetter,
|
||||||
} from 'app/types/explore';
|
} from 'app/types/explore';
|
||||||
import { LogsDedupStrategy } from 'app/core/logs_model';
|
import { LogsDedupStrategy } from 'app/core/logs_model';
|
||||||
import { getNextRefIdLetter } from './query';
|
import { getNextRefIdChar } from './query';
|
||||||
|
|
||||||
export const DEFAULT_RANGE = {
|
export const DEFAULT_RANGE = {
|
||||||
from: 'now-6h',
|
from: 'now-6h',
|
||||||
@ -227,7 +227,7 @@ export function generateKey(index = 0): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function generateEmptyQuery(queries: DataQuery[], index = 0): DataQuery {
|
export function generateEmptyQuery(queries: DataQuery[], index = 0): DataQuery {
|
||||||
return { refId: getNextRefIdLetter(queries), key: generateKey(index) };
|
return { refId: getNextRefIdChar(queries), key: generateKey(index) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { DataQuery } from '@grafana/ui/';
|
import { DataQuery } from '@grafana/ui/';
|
||||||
|
|
||||||
export const getNextRefIdLetter = (queries: DataQuery[]): string => {
|
export const getNextRefIdChar = (queries: DataQuery[]): string => {
|
||||||
const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
|
||||||
return _.find(letters, refId => {
|
return _.find(letters, refId => {
|
||||||
|
@ -3,7 +3,7 @@ import _ from 'lodash';
|
|||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
import { Emitter } from 'app/core/utils/emitter';
|
import { Emitter } from 'app/core/utils/emitter';
|
||||||
import { getNextRefIdLetter } from 'app/core/utils/query';
|
import { getNextRefIdChar } from 'app/core/utils/query';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { DataQuery, TimeSeries, Threshold, ScopedVars, PanelTypeChangedHook } from '@grafana/ui';
|
import { DataQuery, TimeSeries, Threshold, ScopedVars, PanelTypeChangedHook } from '@grafana/ui';
|
||||||
@ -131,7 +131,7 @@ export class PanelModel {
|
|||||||
if (this.targets) {
|
if (this.targets) {
|
||||||
for (const query of this.targets) {
|
for (const query of this.targets) {
|
||||||
if (!query.refId) {
|
if (!query.refId) {
|
||||||
query.refId = getNextRefIdLetter(this.targets);
|
query.refId = getNextRefIdChar(this.targets);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ export class PanelModel {
|
|||||||
|
|
||||||
addQuery(query?: Partial<DataQuery>) {
|
addQuery(query?: Partial<DataQuery>) {
|
||||||
query = query || { refId: 'A' };
|
query = query || { refId: 'A' };
|
||||||
query.refId = getNextRefIdLetter(this.targets);
|
query.refId = getNextRefIdChar(this.targets);
|
||||||
this.targets.push(query as DataQuery);
|
this.targets.push(query as DataQuery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user