mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: fix typo and remove deprecation (#23073)
This commit is contained in:
parent
e5d7c6e280
commit
27913289d3
@ -80,19 +80,6 @@ describe('toDataFrame', () => {
|
||||
).toThrowError('Expected table rows to be array, got object.');
|
||||
});
|
||||
|
||||
it('migrate from 6.3 style rows', () => {
|
||||
const oldDataFrame = {
|
||||
fields: [{ name: 'A' }, { name: 'B' }, { name: 'C' }],
|
||||
rows: [
|
||||
[100, 'A', 1],
|
||||
[200, 'B', 2],
|
||||
[300, 'C', 3],
|
||||
],
|
||||
};
|
||||
const data = toDataFrame(oldDataFrame);
|
||||
expect(data.length).toBe(oldDataFrame.rows.length);
|
||||
});
|
||||
|
||||
it('Guess Colum Types from value', () => {
|
||||
expect(guessFieldTypeFromValue(1)).toBe(FieldType.number);
|
||||
expect(guessFieldTypeFromValue(1.234)).toBe(FieldType.number);
|
||||
|
@ -16,7 +16,6 @@ import {
|
||||
DataFrameDTO,
|
||||
} from '../types/index';
|
||||
import { isDateTime } from '../datetime/moment_wrapper';
|
||||
import { deprecationWarning } from '../utils/deprecationWarning';
|
||||
import { ArrayVector } from '../vector/ArrayVector';
|
||||
import { MutableDataFrame } from './MutableDataFrame';
|
||||
import { SortedVector } from '../vector/SortedVector';
|
||||
@ -224,7 +223,7 @@ export function guessFieldTypeForField(field: Field): FieldType | undefined {
|
||||
export const guessFieldTypes = (series: DataFrame): DataFrame => {
|
||||
for (let i = 0; i < series.fields.length; i++) {
|
||||
if (!series.fields[i].type) {
|
||||
// Somethign is missing a type return a modified copy
|
||||
// Something is missing a type, return a modified copy
|
||||
return {
|
||||
...series,
|
||||
fields: series.fields.map(field => {
|
||||
@ -250,17 +249,6 @@ export const isDataFrame = (data: any): data is DataFrame => data && data.hasOwn
|
||||
|
||||
export const toDataFrame = (data: any): DataFrame => {
|
||||
if (data.hasOwnProperty('fields')) {
|
||||
// @deprecated -- remove in 6.5
|
||||
if (data.hasOwnProperty('rows')) {
|
||||
const v = new MutableDataFrame(data as DataFrameDTO);
|
||||
const rows = data.rows as any[][];
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
v.appendRow(rows[i]);
|
||||
}
|
||||
deprecationWarning('DataFrame', '.rows', 'columnar format');
|
||||
return v;
|
||||
}
|
||||
|
||||
// DataFrameDTO does not have length
|
||||
if (data.hasOwnProperty('length')) {
|
||||
return data as DataFrame;
|
||||
|
@ -700,7 +700,7 @@ function getColorForValue(data: any, value: number) {
|
||||
|
||||
//------------------------------------------------
|
||||
// Private utility functions
|
||||
// Somethign like this should be avaliable in a
|
||||
// Something like this should be avaliable in a
|
||||
// DataFrame[] abstraction helper
|
||||
//------------------------------------------------
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user