Chore: avoid using deprecated ArrayVector (#77581)

This commit is contained in:
Ryan McKinley 2023-11-02 09:24:57 -07:00 committed by GitHub
parent 0d1d45ee58
commit 878235248e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -5,7 +5,7 @@ import React from 'react';
import { of } from 'rxjs';
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
import { ArrayVector, CoreApp } from '@grafana/data';
import { CoreApp } from '@grafana/data';
import createMockDatasource from '../../__mocks__/datasource';
import createMockQuery from '../../__mocks__/query';
@ -51,9 +51,6 @@ const addFilter = async (
rerender: (ui: React.ReactElement) => void
) => {
const { property, operation, index } = filter;
const resultVector = new ArrayVector([
`{"${property}":[${filter.filters.map(({ count, value }) => `{"${property}":"${value}", "count":${count}}`)}]}`,
]);
mockDatasource.azureLogAnalyticsDatasource.query = jest.fn().mockReturnValue(
of({
data: [
@ -82,7 +79,11 @@ const addFilter = async (
},
],
},
values: resultVector,
values: [
`{"${property}":[${filter.filters.map(
({ count, value }) => `{"${property}":"${value}", "count":${count}}`
)}]}`,
],
entities: {},
},
],

View File

@ -1,7 +1,7 @@
import { render, screen, fireEvent, act, waitFor } from '@testing-library/react';
import * as React from 'react';
import { ArrayVector, DataFrame, dateTime, EventBus, Field, FieldType, LoadingState } from '@grafana/data';
import { DataFrame, dateTime, EventBus, Field, FieldType, LoadingState } from '@grafana/data';
import { DataGridPanel, DataGridProps } from './DataGridPanel';
import * as utils from './utils';
@ -312,7 +312,7 @@ describe('DataGrid', () => {
expect.objectContaining({
name: 'newColumn',
type: 'string',
values: new ArrayVector(['', '', '', '']),
values: ['', '', '', ''],
}),
]),
}),

View File

@ -1,5 +1,4 @@
import {
ArrayVector,
DataFrame,
Field,
FieldType,
@ -22,7 +21,7 @@ type ScaleKey = string;
// this will re-enumerate all enum fields on the same scale to create one ordinal progression
// e.g. ['a','b'][0,1,0] + ['c','d'][1,0,1] -> ['a','b'][0,1,0] + ['c','d'][3,2,3]
function reEnumFields(frames: DataFrame[]) {
function reEnumFields(frames: DataFrame[]): DataFrame[] {
let allTextsByKey: Map<ScaleKey, string[]> = new Map();
let frames2: DataFrame[] = frames.map((frame) => {
@ -55,7 +54,7 @@ function reEnumFields(frames: DataFrame[]) {
return {
...field,
values: new ArrayVector(idxs),
values: idxs,
};
// TODO: update displayProcessor?