mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Search: Implement basic improved UI (#46758)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { DataFrame } from '../types/dataFrame';
|
||||
import { DataFrame, Field } from '../types/dataFrame';
|
||||
import { DisplayProcessor } from '../types';
|
||||
import { FunctionalVector } from '../vector/FunctionalVector';
|
||||
|
||||
@@ -16,13 +16,22 @@ import { FunctionalVector } from '../vector/FunctionalVector';
|
||||
export class DataFrameView<T = any> extends FunctionalVector<T> {
|
||||
private index = 0;
|
||||
private obj: T;
|
||||
readonly fields: {
|
||||
readonly [Property in keyof T]: Field<T[Property]>;
|
||||
};
|
||||
|
||||
constructor(private data: DataFrame) {
|
||||
super();
|
||||
const obj = {} as unknown as T;
|
||||
const fields = {} as any;
|
||||
|
||||
for (let i = 0; i < data.fields.length; i++) {
|
||||
const field = data.fields[i];
|
||||
if (!field.name) {
|
||||
continue; // unsupported
|
||||
}
|
||||
|
||||
fields[field.name] = field;
|
||||
const getter = () => field.values.get(this.index);
|
||||
|
||||
if (!(obj as any).hasOwnProperty(field.name)) {
|
||||
@@ -41,6 +50,7 @@ export class DataFrameView<T = any> extends FunctionalVector<T> {
|
||||
}
|
||||
|
||||
this.obj = obj;
|
||||
this.fields = fields;
|
||||
}
|
||||
|
||||
get dataFrame() {
|
||||
|
||||
@@ -21,4 +21,7 @@ export enum DataFrameType {
|
||||
* All values in the grid exist and have regular spacing
|
||||
*/
|
||||
HeatmapScanlines = 'heatmap-scanlines',
|
||||
|
||||
/** Directory listing */
|
||||
DirectoryListing = 'directory-listing',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user