mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Graphite: Add from and until params to tag handling methods (#41319)
This commit is contained in:
parent
07d3bde4eb
commit
9f205cf1d7
@ -210,6 +210,20 @@ describe('Graphite actions', async () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('current time range is passed when getting list of tags when editing', async () => {
|
||||||
|
const currentRange = { from: 0, to: 1 };
|
||||||
|
ctx.state.range = currentRange;
|
||||||
|
await getTagsSelectables(ctx.state, 0, 'any');
|
||||||
|
expect(ctx.state.datasource.getTagsAutoComplete).toBeCalledWith([], 'any', { range: currentRange });
|
||||||
|
});
|
||||||
|
|
||||||
|
it('current time range is passed when getting list of tags for adding', async () => {
|
||||||
|
const currentRange = { from: 0, to: 1 };
|
||||||
|
ctx.state.range = currentRange;
|
||||||
|
await getTagsAsSegmentsSelectables(ctx.state, 'any');
|
||||||
|
expect(ctx.state.datasource.getTagsAutoComplete).toBeCalledWith([], 'any', { range: currentRange });
|
||||||
|
});
|
||||||
|
|
||||||
describe('when autocomplete for metric names is not available', () => {
|
describe('when autocomplete for metric names is not available', () => {
|
||||||
silenceConsoleOutput();
|
silenceConsoleOutput();
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -106,7 +106,7 @@ export function getTagOperatorsSelectables(): Array<SelectableValue<GraphiteTagO
|
|||||||
async function getTags(state: GraphiteQueryEditorState, index: number, tagPrefix: string): Promise<string[]> {
|
async function getTags(state: GraphiteQueryEditorState, index: number, tagPrefix: string): Promise<string[]> {
|
||||||
try {
|
try {
|
||||||
const tagExpressions = state.queryModel.renderTagExpressions(index);
|
const tagExpressions = state.queryModel.renderTagExpressions(index);
|
||||||
const values = await state.datasource.getTagsAutoComplete(tagExpressions, tagPrefix);
|
const values = await state.datasource.getTagsAutoComplete(tagExpressions, tagPrefix, { range: state.range });
|
||||||
|
|
||||||
const altTags = map(values, 'text');
|
const altTags = map(values, 'text');
|
||||||
altTags.splice(0, 0, state.removeTagValue);
|
altTags.splice(0, 0, state.removeTagValue);
|
||||||
@ -134,7 +134,7 @@ async function getTagsAsSegments(state: GraphiteQueryEditorState, tagPrefix: str
|
|||||||
let tagsAsSegments: GraphiteSegment[];
|
let tagsAsSegments: GraphiteSegment[];
|
||||||
try {
|
try {
|
||||||
const tagExpressions = state.queryModel.renderTagExpressions();
|
const tagExpressions = state.queryModel.renderTagExpressions();
|
||||||
const values = await state.datasource.getTagsAutoComplete(tagExpressions, tagPrefix);
|
const values = await state.datasource.getTagsAutoComplete(tagExpressions, tagPrefix, { range: state.range });
|
||||||
tagsAsSegments = map(values, (val) => {
|
tagsAsSegments = map(values, (val) => {
|
||||||
return {
|
return {
|
||||||
value: val.text,
|
value: val.text,
|
||||||
|
Loading…
Reference in New Issue
Block a user