mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
ArrayVector: Add vector field value warning (#73692)
This commit is contained in:
parent
a307582212
commit
384a6ad54d
@ -3,6 +3,7 @@ import { ArrayVector } from './ArrayVector';
|
||||
|
||||
describe('Check Appending Vector', () => {
|
||||
it('should transparently join them', () => {
|
||||
jest.spyOn(console, 'warn').mockImplementation();
|
||||
const appended = new AppendedVectors();
|
||||
appended.append(new ArrayVector([1, 2, 3]));
|
||||
appended.append(new ArrayVector([4, 5, 6]));
|
||||
|
@ -3,6 +3,10 @@ import { Field, FieldType } from '../types';
|
||||
import { ArrayVector } from './ArrayVector';
|
||||
|
||||
describe('ArrayVector', () => {
|
||||
beforeEach(() => {
|
||||
jest.spyOn(console, 'warn').mockImplementation();
|
||||
});
|
||||
|
||||
it('should init 150k with 65k Array.push() chonking', () => {
|
||||
const arr = Array.from({ length: 150e3 }, (v, i) => i);
|
||||
const av = new ArrayVector(arr);
|
||||
|
@ -1,3 +1,6 @@
|
||||
const notice = 'ArrayVector is deprecated and will be removed in Grafana 11. Please use plain arrays for field.values.';
|
||||
let notified = false;
|
||||
|
||||
/**
|
||||
* @public
|
||||
*
|
||||
@ -30,6 +33,11 @@ export class ArrayVector<T = any> extends Array<T> {
|
||||
constructor(buffer?: any[]) {
|
||||
super();
|
||||
this.buffer = buffer ?? [];
|
||||
|
||||
if (!notified) {
|
||||
console.warn(notice);
|
||||
notified = true;
|
||||
}
|
||||
}
|
||||
|
||||
toJSON(): T[] {
|
||||
|
@ -6,6 +6,7 @@ import { ConstantVector } from './ConstantVector';
|
||||
|
||||
describe('ScaledVector', () => {
|
||||
it('should support multiply operations', () => {
|
||||
jest.spyOn(console, 'warn').mockImplementation();
|
||||
const source = new ArrayVector([1, 2, 3, 4]);
|
||||
const scale = 2.456;
|
||||
const operation = binaryOperators.get(BinaryOperationID.Multiply).operation;
|
||||
|
@ -3,6 +3,7 @@ import { SortedVector } from './SortedVector';
|
||||
|
||||
describe('SortedVector', () => {
|
||||
it('Should support sorting', () => {
|
||||
jest.spyOn(console, 'warn').mockImplementation();
|
||||
const values = new ArrayVector([1, 5, 2, 4]);
|
||||
const sorted = new SortedVector(values, [0, 2, 3, 1]);
|
||||
expect(sorted.toArray()).toEqual([1, 2, 4, 5]);
|
||||
|
@ -201,6 +201,7 @@ describe(`Traces Filters`, () => {
|
||||
});
|
||||
|
||||
it('should add a trace filter', async () => {
|
||||
jest.spyOn(console, 'warn').mockImplementation();
|
||||
let mockQuery = createMockQuery({ azureTraces: { traceTypes: ['customEvents'] } });
|
||||
mockQuery.azureTraces = {
|
||||
...mockQuery.azureTraces,
|
||||
|
@ -286,6 +286,7 @@ describe('DataGrid', () => {
|
||||
});
|
||||
});
|
||||
it('should add a new column', async () => {
|
||||
jest.spyOn(console, 'warn').mockImplementation();
|
||||
const spy = jest.spyOn(utils, 'updateSnapshot');
|
||||
jest.useFakeTimers();
|
||||
render(<DataGridPanel {...props} />, {
|
||||
|
@ -6,6 +6,7 @@ describe('when deleting rows', () => {
|
||||
let df: DataFrame;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.spyOn(console, 'warn').mockImplementation();
|
||||
df = {
|
||||
name: 'test',
|
||||
length: 5,
|
||||
|
Loading…
Reference in New Issue
Block a user