Commit 52dcb9bf by Peter Holmberg

renaming function

parent cf55d688
...@@ -23,7 +23,7 @@ import { ...@@ -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 { getNextQueryLetter } from './query'; import { getNextRefIdLetter } 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 { ...@@ -227,7 +227,7 @@ export function generateKey(index = 0): string {
} }
export function generateEmptyQuery(queries: DataQuery[], index = 0): { refId: string; key: string } { export function generateEmptyQuery(queries: DataQuery[], index = 0): { refId: string; key: string } {
return { refId: getNextQueryLetter(queries), key: generateKey(index) }; return { refId: getNextRefIdLetter(queries), key: generateKey(index) };
} }
/** /**
......
import _ from 'lodash'; import _ from 'lodash';
import { DataQuery } from '@grafana/ui/'; import { DataQuery } from '@grafana/ui/';
export const getNextQueryLetter = (queries: DataQuery[]): string => { export const getNextRefIdLetter = (queries: DataQuery[]): string => {
const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; const letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
return _.find(letters, refId => { return _.find(letters, refId => {
......
...@@ -5,7 +5,7 @@ import _ from 'lodash'; ...@@ -5,7 +5,7 @@ import _ from 'lodash';
import { Emitter } from 'app/core/utils/emitter'; import { Emitter } from 'app/core/utils/emitter';
import { DataQuery, TimeSeries, Threshold, ScopedVars, PanelTypeChangedHook } from '@grafana/ui'; import { DataQuery, TimeSeries, Threshold, ScopedVars, PanelTypeChangedHook } from '@grafana/ui';
import { TableData } from '@grafana/ui/src'; import { TableData } from '@grafana/ui/src';
import { getNextQueryLetter } from '../../../core/utils/query'; import { getNextRefIdLetter } from '../../../core/utils/query';
export interface GridPos { export interface GridPos {
x: number; x: number;
...@@ -129,7 +129,7 @@ export class PanelModel { ...@@ -129,7 +129,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 = getNextQueryLetter(this.targets); query.refId = getNextRefIdLetter(this.targets);
} }
} }
} }
...@@ -267,7 +267,7 @@ export class PanelModel { ...@@ -267,7 +267,7 @@ export class PanelModel {
addQuery(query?: Partial<DataQuery>) { addQuery(query?: Partial<DataQuery>) {
query = query || { refId: 'A' }; query = query || { refId: 'A' };
query.refId = getNextQueryLetter(this.targets); query.refId = getNextRefIdLetter(this.targets);
this.targets.push(query as DataQuery); this.targets.push(query as DataQuery);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment