@grafana/plugin-types 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,723 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
|
+
import { DataQuery as DataQuery$1, DataTopic, HideSeriesConfig } from '@grafana/schema';
|
|
4
|
+
|
|
5
|
+
export interface DateTimeBuiltinFormat {
|
|
6
|
+
__momentBuiltinFormatBrand: any;
|
|
7
|
+
}
|
|
8
|
+
export type DateTimeInput = Date | string | number | Array<string | number> | DateTime | null;
|
|
9
|
+
export type FormatInput = string | DateTimeBuiltinFormat | undefined;
|
|
10
|
+
export type DurationUnit = "year" | "years" | "y" | "month" | "months" | "M" | "week" | "weeks" | "isoWeek" | "w" | "day" | "days" | "d" | "hour" | "hours" | "h" | "minute" | "minutes" | "m" | "second" | "seconds" | "s" | "millisecond" | "milliseconds" | "ms" | "quarter" | "quarters" | "Q";
|
|
11
|
+
export interface DateTime extends Object {
|
|
12
|
+
add: (amount?: DateTimeInput, unit?: DurationUnit) => DateTime;
|
|
13
|
+
set: (unit: DurationUnit | "date", amount: DateTimeInput) => void;
|
|
14
|
+
diff: (amount: DateTimeInput, unit?: DurationUnit, truncate?: boolean) => number;
|
|
15
|
+
endOf: (unitOfTime: DurationUnit) => DateTime;
|
|
16
|
+
format: (formatInput?: FormatInput) => string;
|
|
17
|
+
fromNow: (withoutSuffix?: boolean) => string;
|
|
18
|
+
from: (formaInput: DateTimeInput) => string;
|
|
19
|
+
isSame: (input?: DateTimeInput, granularity?: DurationUnit) => boolean;
|
|
20
|
+
isBefore: (input?: DateTimeInput) => boolean;
|
|
21
|
+
isValid: () => boolean;
|
|
22
|
+
local: () => DateTime;
|
|
23
|
+
locale: (locale: string) => DateTime;
|
|
24
|
+
startOf: (unitOfTime: DurationUnit) => DateTime;
|
|
25
|
+
subtract: (amount?: DateTimeInput, unit?: DurationUnit) => DateTime;
|
|
26
|
+
toDate: () => Date;
|
|
27
|
+
toISOString: (keepOffset?: boolean) => string;
|
|
28
|
+
isoWeekday: (day?: number | string) => number | string;
|
|
29
|
+
valueOf: () => number;
|
|
30
|
+
unix: () => number;
|
|
31
|
+
utc: () => DateTime;
|
|
32
|
+
utcOffset: () => number;
|
|
33
|
+
hour?: () => number;
|
|
34
|
+
minute?: () => number;
|
|
35
|
+
}
|
|
36
|
+
export interface RawTimeRange {
|
|
37
|
+
from: DateTime | string;
|
|
38
|
+
to: DateTime | string;
|
|
39
|
+
}
|
|
40
|
+
export interface TimeRange {
|
|
41
|
+
from: DateTime;
|
|
42
|
+
to: DateTime;
|
|
43
|
+
raw: RawTimeRange;
|
|
44
|
+
}
|
|
45
|
+
export interface FormattedValue {
|
|
46
|
+
text: string;
|
|
47
|
+
prefix?: string;
|
|
48
|
+
suffix?: string;
|
|
49
|
+
}
|
|
50
|
+
export type DisplayProcessor = (value: unknown, decimals?: DecimalCount) => DisplayValue;
|
|
51
|
+
export interface DisplayValue extends FormattedValue {
|
|
52
|
+
/**
|
|
53
|
+
* Use isNaN to check if it is a real number
|
|
54
|
+
*/
|
|
55
|
+
numeric: number;
|
|
56
|
+
/**
|
|
57
|
+
* 0-1 between min & max
|
|
58
|
+
*/
|
|
59
|
+
percent?: number;
|
|
60
|
+
/**
|
|
61
|
+
* 0-1 percent change across range
|
|
62
|
+
*/
|
|
63
|
+
percentChange?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Color based on mappings or threshold
|
|
66
|
+
*/
|
|
67
|
+
color?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Icon based on mappings or threshold
|
|
70
|
+
*/
|
|
71
|
+
icon?: string;
|
|
72
|
+
title?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Used in limited scenarios like legend reducer calculations
|
|
75
|
+
*/
|
|
76
|
+
description?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* These represents the display value with the longest title and text.
|
|
80
|
+
* Used to align widths and heights when displaying multiple DisplayValues
|
|
81
|
+
*/
|
|
82
|
+
export interface DisplayValueAlignmentFactors extends FormattedValue {
|
|
83
|
+
title?: string;
|
|
84
|
+
}
|
|
85
|
+
export type DecimalCount = number | null | undefined;
|
|
86
|
+
export interface ScopedVar<T = any> {
|
|
87
|
+
text?: any;
|
|
88
|
+
value: T;
|
|
89
|
+
}
|
|
90
|
+
export interface ScopedVars {
|
|
91
|
+
__dataContext?: DataContextScopedVar;
|
|
92
|
+
[key: string]: ScopedVar | undefined;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Used by data link macros
|
|
96
|
+
*/
|
|
97
|
+
export interface DataContextScopedVar {
|
|
98
|
+
value: {
|
|
99
|
+
data: DataFrame[];
|
|
100
|
+
frame: DataFrame;
|
|
101
|
+
field: Field;
|
|
102
|
+
rowIndex?: number;
|
|
103
|
+
frameIndex?: number;
|
|
104
|
+
calculatedValue?: DisplayValue;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
declare enum DataFrameType {
|
|
108
|
+
TimeSeriesWide = "timeseries-wide",
|
|
109
|
+
TimeSeriesLong = "timeseries-long",
|
|
110
|
+
/** @deprecated in favor of TimeSeriesMulti */
|
|
111
|
+
TimeSeriesMany = "timeseries-many",
|
|
112
|
+
TimeSeriesMulti = "timeseries-multi",
|
|
113
|
+
/** Numeric types: https://grafana.com/developers/dataplane/numeric */
|
|
114
|
+
NumericWide = "numeric-wide",
|
|
115
|
+
NumericMulti = "numeric-multi",
|
|
116
|
+
NumericLong = "numeric-long",
|
|
117
|
+
/** Logs types: https://grafana.com/developers/dataplane/logs */
|
|
118
|
+
LogLines = "log-lines",
|
|
119
|
+
/** Directory listing */
|
|
120
|
+
DirectoryListing = "directory-listing",
|
|
121
|
+
/**
|
|
122
|
+
* First field is X, the rest are ordinal values used as rows in the heatmap
|
|
123
|
+
*/
|
|
124
|
+
HeatmapRows = "heatmap-rows",
|
|
125
|
+
/**
|
|
126
|
+
* Explicit fields for:
|
|
127
|
+
* xMin, yMin, count, ...
|
|
128
|
+
*
|
|
129
|
+
* All values in the grid exist and have regular spacing
|
|
130
|
+
*
|
|
131
|
+
* If the y value is actually ordinal, use `meta.custom` to specify the bucket lookup values
|
|
132
|
+
*/
|
|
133
|
+
HeatmapCells = "heatmap-cells",
|
|
134
|
+
/**
|
|
135
|
+
* Explicit fields for:
|
|
136
|
+
* xMin, xMax, count
|
|
137
|
+
*/
|
|
138
|
+
Histogram = "histogram"
|
|
139
|
+
}
|
|
140
|
+
export interface ExplorePanelsState extends Partial<Record<PreferredVisualisationType, {}>> {
|
|
141
|
+
trace?: ExploreTracePanelState;
|
|
142
|
+
logs?: ExploreLogsPanelState;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Keep a list of vars the correlations editor / helper in explore will use
|
|
146
|
+
*
|
|
147
|
+
* vars can be modified by transformation variables, origVars is so we can rebuild the original list
|
|
148
|
+
*/
|
|
149
|
+
/** @internal */
|
|
150
|
+
export interface ExploreCorrelationHelperData {
|
|
151
|
+
resultField: string;
|
|
152
|
+
origVars: Record<string, string>;
|
|
153
|
+
vars: Record<string, string>;
|
|
154
|
+
}
|
|
155
|
+
export interface ExploreTracePanelState {
|
|
156
|
+
spanId?: string;
|
|
157
|
+
}
|
|
158
|
+
export interface ExploreLogsPanelState {
|
|
159
|
+
id?: string;
|
|
160
|
+
columns?: Record<number, string>;
|
|
161
|
+
visualisationType?: "table" | "logs";
|
|
162
|
+
labelFieldName?: string;
|
|
163
|
+
refId?: string;
|
|
164
|
+
}
|
|
165
|
+
export interface Threshold {
|
|
166
|
+
value: number;
|
|
167
|
+
color: string;
|
|
168
|
+
/**
|
|
169
|
+
* Warning, Error, LowLow, Low, OK, High, HighHigh etc
|
|
170
|
+
*/
|
|
171
|
+
state?: string;
|
|
172
|
+
}
|
|
173
|
+
declare enum ThresholdsMode {
|
|
174
|
+
Absolute = "absolute",
|
|
175
|
+
/**
|
|
176
|
+
* between 0 and 1 (based on min/max)
|
|
177
|
+
*/
|
|
178
|
+
Percentage = "percentage"
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Config that is passed to the ThresholdsEditor
|
|
182
|
+
*/
|
|
183
|
+
export interface ThresholdsConfig {
|
|
184
|
+
mode: ThresholdsMode;
|
|
185
|
+
/**
|
|
186
|
+
* Must be sorted by 'value', first value is always -Infinity
|
|
187
|
+
*/
|
|
188
|
+
steps: Threshold[];
|
|
189
|
+
}
|
|
190
|
+
declare enum MappingType {
|
|
191
|
+
ValueToText = "value",// was 1
|
|
192
|
+
RangeToText = "range",// was 2
|
|
193
|
+
RegexToText = "regex",
|
|
194
|
+
SpecialValue = "special"
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* @alpha
|
|
198
|
+
*/
|
|
199
|
+
export interface ValueMappingResult {
|
|
200
|
+
text?: string;
|
|
201
|
+
color?: string;
|
|
202
|
+
icon?: string;
|
|
203
|
+
index?: number;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* @alpha
|
|
207
|
+
*/
|
|
208
|
+
export interface BaseValueMap<T> {
|
|
209
|
+
type: MappingType;
|
|
210
|
+
options: T;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* @alpha
|
|
214
|
+
*/
|
|
215
|
+
export interface ValueMap extends BaseValueMap<Record<string, ValueMappingResult>> {
|
|
216
|
+
type: MappingType.ValueToText;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* @alpha
|
|
220
|
+
*/
|
|
221
|
+
export interface RangeMapOptions {
|
|
222
|
+
from: number | null;
|
|
223
|
+
to: number | null;
|
|
224
|
+
result: ValueMappingResult;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* @alpha
|
|
228
|
+
*/
|
|
229
|
+
export interface RangeMap extends BaseValueMap<RangeMapOptions> {
|
|
230
|
+
type: MappingType.RangeToText;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* @alpha
|
|
234
|
+
*/
|
|
235
|
+
export interface RegexMapOptions {
|
|
236
|
+
pattern: string;
|
|
237
|
+
result: ValueMappingResult;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* @alpha
|
|
241
|
+
*/
|
|
242
|
+
export interface RegexMap extends BaseValueMap<RegexMapOptions> {
|
|
243
|
+
type: MappingType.RegexToText;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* @alpha
|
|
247
|
+
*/
|
|
248
|
+
export interface SpecialValueOptions {
|
|
249
|
+
match: SpecialValueMatch;
|
|
250
|
+
result: ValueMappingResult;
|
|
251
|
+
}
|
|
252
|
+
declare enum SpecialValueMatch {
|
|
253
|
+
True = "true",
|
|
254
|
+
False = "false",
|
|
255
|
+
Null = "null",
|
|
256
|
+
NaN = "nan",
|
|
257
|
+
NullAndNaN = "null+nan",
|
|
258
|
+
Empty = "empty"
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* @alpha
|
|
262
|
+
*/
|
|
263
|
+
export interface SpecialValueMap extends BaseValueMap<SpecialValueOptions> {
|
|
264
|
+
type: MappingType.SpecialValue;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* @alpha
|
|
268
|
+
*/
|
|
269
|
+
export type ValueMapping = ValueMap | RangeMap | RegexMap | SpecialValueMap;
|
|
270
|
+
/**
|
|
271
|
+
* @deprecated use the type from @grafana/schema
|
|
272
|
+
*/
|
|
273
|
+
export interface DataQuery extends DataQuery$1 {
|
|
274
|
+
}
|
|
275
|
+
export type InterpolateFunction = (value: string, scopedVars?: ScopedVars, format?: string | Function) => string;
|
|
276
|
+
/**
|
|
277
|
+
* Callback info for DataLink click events
|
|
278
|
+
*/
|
|
279
|
+
export interface DataLinkClickEvent<T = any> {
|
|
280
|
+
origin: T;
|
|
281
|
+
replaceVariables: InterpolateFunction | undefined;
|
|
282
|
+
e?: any;
|
|
283
|
+
}
|
|
284
|
+
declare enum DataLinkConfigOrigin {
|
|
285
|
+
Datasource = "Datasource",
|
|
286
|
+
Correlations = "Correlations",
|
|
287
|
+
ExploreCorrelationsEditor = "CorrelationsEditor"
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Link configuration. The values may contain variables that need to be
|
|
291
|
+
* processed before showing the link to user.
|
|
292
|
+
*
|
|
293
|
+
* TODO: <T extends DataQuery> is not strictly true for internal links as we do not need refId for example but all
|
|
294
|
+
* data source defined queries extend this so this is more for documentation.
|
|
295
|
+
*/
|
|
296
|
+
export interface DataLink<T extends DataQuery = any> {
|
|
297
|
+
title: string;
|
|
298
|
+
targetBlank?: boolean;
|
|
299
|
+
url: string;
|
|
300
|
+
onBuildUrl?: (event: DataLinkClickEvent) => string;
|
|
301
|
+
onClick?: (event: DataLinkClickEvent) => void;
|
|
302
|
+
internal?: InternalDataLink<T>;
|
|
303
|
+
origin?: DataLinkConfigOrigin;
|
|
304
|
+
sortIndex?: number;
|
|
305
|
+
}
|
|
306
|
+
declare enum SupportedTransformationType {
|
|
307
|
+
Regex = "regex",
|
|
308
|
+
Logfmt = "logfmt"
|
|
309
|
+
}
|
|
310
|
+
/** @internal */
|
|
311
|
+
export interface DataLinkTransformationConfig {
|
|
312
|
+
type: SupportedTransformationType;
|
|
313
|
+
field?: string;
|
|
314
|
+
expression?: string;
|
|
315
|
+
mapValue?: string;
|
|
316
|
+
}
|
|
317
|
+
/** @internal */
|
|
318
|
+
export interface InternalDataLink<T extends DataQuery = any> {
|
|
319
|
+
query: T;
|
|
320
|
+
datasourceUid: string;
|
|
321
|
+
datasourceName: string;
|
|
322
|
+
panelsState?: ExplorePanelsState;
|
|
323
|
+
meta?: {
|
|
324
|
+
correlationData?: ExploreCorrelationHelperData;
|
|
325
|
+
};
|
|
326
|
+
transformations?: DataLinkTransformationConfig[];
|
|
327
|
+
range?: TimeRange;
|
|
328
|
+
}
|
|
329
|
+
export type LinkTarget = "_blank" | "_self" | undefined;
|
|
330
|
+
/**
|
|
331
|
+
* Processed Link Model. The values are ready to use
|
|
332
|
+
*/
|
|
333
|
+
export interface LinkModel<T = any> {
|
|
334
|
+
href: string;
|
|
335
|
+
title: string;
|
|
336
|
+
target: LinkTarget;
|
|
337
|
+
origin: T;
|
|
338
|
+
onClick?: (e: any, origin?: any) => void;
|
|
339
|
+
}
|
|
340
|
+
declare const preferredVisualizationTypes: readonly [
|
|
341
|
+
"graph",
|
|
342
|
+
"table",
|
|
343
|
+
"logs",
|
|
344
|
+
"trace",
|
|
345
|
+
"nodeGraph",
|
|
346
|
+
"flamegraph",
|
|
347
|
+
"rawPrometheus"
|
|
348
|
+
];
|
|
349
|
+
export type PreferredVisualisationType = (typeof preferredVisualizationTypes)[number];
|
|
350
|
+
/**
|
|
351
|
+
* Should be kept in sync with https://github.com/grafana/grafana-plugin-sdk-go/blob/main/data/frame_meta.go
|
|
352
|
+
* @public
|
|
353
|
+
*/
|
|
354
|
+
export interface QueryResultMeta {
|
|
355
|
+
type?: DataFrameType;
|
|
356
|
+
/**
|
|
357
|
+
* TypeVersion is the version of the Type property. Versions greater than 0.0 correspond to the dataplane
|
|
358
|
+
* contract documentation https://github.com/grafana/grafana-plugin-sdk-go/tree/main/data/contract_docs.
|
|
359
|
+
*/
|
|
360
|
+
typeVersion?: [
|
|
361
|
+
number,
|
|
362
|
+
number
|
|
363
|
+
];
|
|
364
|
+
/** DatasSource Specific Values */
|
|
365
|
+
custom?: Record<string, any>;
|
|
366
|
+
/** Stats */
|
|
367
|
+
stats?: QueryResultMetaStat[];
|
|
368
|
+
/** Meta Notices */
|
|
369
|
+
notices?: QueryResultMetaNotice[];
|
|
370
|
+
/** Currently used to show results in Explore only in preferred visualisation option */
|
|
371
|
+
preferredVisualisationType?: PreferredVisualisationType;
|
|
372
|
+
/** Set the panel plugin id to use to render the data when using Explore. If the plugin cannot be found
|
|
373
|
+
* will fall back to {@link preferredVisualisationType}.
|
|
374
|
+
*
|
|
375
|
+
* @alpha
|
|
376
|
+
*/
|
|
377
|
+
preferredVisualisationPluginId?: string;
|
|
378
|
+
/** The path for live stream updates for this frame */
|
|
379
|
+
channel?: string;
|
|
380
|
+
/** Did the query response come from the cache */
|
|
381
|
+
isCachedResponse?: boolean;
|
|
382
|
+
/**
|
|
383
|
+
* Optionally identify which topic the frame should be assigned to.
|
|
384
|
+
* A value specified in the response will override what the request asked for.
|
|
385
|
+
*/
|
|
386
|
+
dataTopic?: DataTopic;
|
|
387
|
+
/**
|
|
388
|
+
* This is the raw query sent to the underlying system. All macros and templating
|
|
389
|
+
* as been applied. When metadata contains this value, it will be shown in the query inspector
|
|
390
|
+
*/
|
|
391
|
+
executedQueryString?: string;
|
|
392
|
+
/**
|
|
393
|
+
* A browsable path on the datasource
|
|
394
|
+
*/
|
|
395
|
+
path?: string;
|
|
396
|
+
/**
|
|
397
|
+
* defaults to '/'
|
|
398
|
+
*/
|
|
399
|
+
pathSeparator?: string;
|
|
400
|
+
/** A time shift metadata indicating a result of comparison */
|
|
401
|
+
timeCompare?: {
|
|
402
|
+
diffMs: number;
|
|
403
|
+
isTimeShiftQuery: boolean;
|
|
404
|
+
};
|
|
405
|
+
/**
|
|
406
|
+
* Legacy data source specific, should be moved to custom
|
|
407
|
+
* */
|
|
408
|
+
searchWords?: string[];
|
|
409
|
+
limit?: number;
|
|
410
|
+
json?: boolean;
|
|
411
|
+
instant?: boolean;
|
|
412
|
+
/**
|
|
413
|
+
* Array of field indices which values create a unique id for each row. Ideally this should be globally unique ID
|
|
414
|
+
* but that isn't guarantied. Should help with keeping track and deduplicating rows in visualizations, especially
|
|
415
|
+
* with streaming data with frequent updates.
|
|
416
|
+
* Example: TraceID in Tempo, table name + primary key in SQL
|
|
417
|
+
*/
|
|
418
|
+
uniqueRowIdFields?: number[];
|
|
419
|
+
}
|
|
420
|
+
export interface QueryResultMetaStat extends FieldConfig {
|
|
421
|
+
displayName: string;
|
|
422
|
+
value: number;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* QueryResultMetaNotice is a structure that provides user notices for query result data
|
|
426
|
+
* @public
|
|
427
|
+
*/
|
|
428
|
+
export interface QueryResultMetaNotice {
|
|
429
|
+
/**
|
|
430
|
+
* Specify the notice severity
|
|
431
|
+
*/
|
|
432
|
+
severity: "info" | "warning" | "error";
|
|
433
|
+
/**
|
|
434
|
+
* Notice descriptive text
|
|
435
|
+
*/
|
|
436
|
+
text: string;
|
|
437
|
+
/**
|
|
438
|
+
* An optional link that may be displayed in the UI.
|
|
439
|
+
* This value may be an absolute URL or relative to grafana root
|
|
440
|
+
*/
|
|
441
|
+
link?: string;
|
|
442
|
+
/**
|
|
443
|
+
* Optionally suggest an appropriate tab for the panel inspector
|
|
444
|
+
*/
|
|
445
|
+
inspect?: "meta" | "error" | "data" | "stats";
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* @public
|
|
449
|
+
*/
|
|
450
|
+
export interface QueryResultBase {
|
|
451
|
+
/**
|
|
452
|
+
* Matches the query target refId
|
|
453
|
+
*/
|
|
454
|
+
refId?: string;
|
|
455
|
+
/**
|
|
456
|
+
* Used by some backend data sources to communicate back info about the execution (generated sql, timing)
|
|
457
|
+
*/
|
|
458
|
+
meta?: QueryResultMeta;
|
|
459
|
+
}
|
|
460
|
+
export interface Labels {
|
|
461
|
+
[key: string]: string;
|
|
462
|
+
}
|
|
463
|
+
declare enum NullValueMode {
|
|
464
|
+
Null = "null",
|
|
465
|
+
Ignore = "connected",
|
|
466
|
+
AsZero = "null as zero"
|
|
467
|
+
}
|
|
468
|
+
declare enum FieldColorModeId {
|
|
469
|
+
Thresholds = "thresholds",
|
|
470
|
+
PaletteClassic = "palette-classic",
|
|
471
|
+
PaletteClassicByName = "palette-classic-by-name",
|
|
472
|
+
PaletteSaturated = "palette-saturated",
|
|
473
|
+
ContinuousGrYlRd = "continuous-GrYlRd",
|
|
474
|
+
ContinuousRdYlGr = "continuous-RdYlGr",
|
|
475
|
+
ContinuousBlYlRd = "continuous-BlYlRd",
|
|
476
|
+
ContinuousYlRd = "continuous-YlRd",
|
|
477
|
+
ContinuousBlPu = "continuous-BlPu",
|
|
478
|
+
ContinuousYlBl = "continuous-YlBl",
|
|
479
|
+
ContinuousBlues = "continuous-blues",
|
|
480
|
+
ContinuousReds = "continuous-reds",
|
|
481
|
+
ContinuousGreens = "continuous-greens",
|
|
482
|
+
ContinuousPurples = "continuous-purples",
|
|
483
|
+
Fixed = "fixed",
|
|
484
|
+
Shades = "shades"
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* @public
|
|
488
|
+
*/
|
|
489
|
+
export interface FieldColor {
|
|
490
|
+
/** The main color scheme mode */
|
|
491
|
+
mode: FieldColorModeId | string;
|
|
492
|
+
/** Stores the fixed color value if mode is fixed */
|
|
493
|
+
fixedColor?: string;
|
|
494
|
+
/** Some visualizations need to know how to assign a series color from by value color schemes */
|
|
495
|
+
seriesBy?: FieldColorSeriesByMode;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* @beta
|
|
499
|
+
*/
|
|
500
|
+
export type FieldColorSeriesByMode = "min" | "max" | "last";
|
|
501
|
+
declare enum FieldType {
|
|
502
|
+
time = "time",// or date
|
|
503
|
+
number = "number",
|
|
504
|
+
string = "string",
|
|
505
|
+
boolean = "boolean",
|
|
506
|
+
trace = "trace",
|
|
507
|
+
geo = "geo",
|
|
508
|
+
enum = "enum",
|
|
509
|
+
other = "other",// Object, Array, etc
|
|
510
|
+
frame = "frame",// DataFrame
|
|
511
|
+
nestedFrames = "nestedFrames"
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* @public
|
|
515
|
+
* Every property is optional
|
|
516
|
+
*
|
|
517
|
+
* Plugins may extend this with additional properties. Something like series overrides
|
|
518
|
+
*/
|
|
519
|
+
export interface FieldConfig<TOptions = any> {
|
|
520
|
+
/**
|
|
521
|
+
* The display value for this field. This supports template variables blank is auto.
|
|
522
|
+
* If you are a datasource plugin, do not set this. Use `field.value` and if that
|
|
523
|
+
* is not enough, use `field.config.displayNameFromDS`.
|
|
524
|
+
*/
|
|
525
|
+
displayName?: string;
|
|
526
|
+
/**
|
|
527
|
+
* This can be used by data sources that need to customize how values are named.
|
|
528
|
+
* When this property is configured, this value is used rather than the default naming strategy.
|
|
529
|
+
*/
|
|
530
|
+
displayNameFromDS?: string;
|
|
531
|
+
/**
|
|
532
|
+
* Human readable field metadata
|
|
533
|
+
*/
|
|
534
|
+
description?: string;
|
|
535
|
+
/**
|
|
536
|
+
* An explict path to the field in the datasource. When the frame meta includes a path,
|
|
537
|
+
* This will default to `${frame.meta.path}/${field.name}
|
|
538
|
+
*
|
|
539
|
+
* When defined, this value can be used as an identifier within the datasource scope, and
|
|
540
|
+
* may be used to update the results
|
|
541
|
+
*/
|
|
542
|
+
path?: string;
|
|
543
|
+
/**
|
|
544
|
+
* True if data source can write a value to the path. Auth/authz are supported separately
|
|
545
|
+
*/
|
|
546
|
+
writeable?: boolean;
|
|
547
|
+
/**
|
|
548
|
+
* True if data source field supports ad-hoc filters
|
|
549
|
+
*/
|
|
550
|
+
filterable?: boolean;
|
|
551
|
+
unit?: string;
|
|
552
|
+
decimals?: DecimalCount;
|
|
553
|
+
min?: number | null;
|
|
554
|
+
max?: number | null;
|
|
555
|
+
interval?: number | null;
|
|
556
|
+
mappings?: ValueMapping[];
|
|
557
|
+
thresholds?: ThresholdsConfig;
|
|
558
|
+
color?: FieldColor;
|
|
559
|
+
nullValueMode?: NullValueMode;
|
|
560
|
+
links?: DataLink[];
|
|
561
|
+
noValue?: string;
|
|
562
|
+
type?: FieldTypeConfig;
|
|
563
|
+
custom?: TOptions;
|
|
564
|
+
fieldMinMax?: boolean;
|
|
565
|
+
}
|
|
566
|
+
export interface FieldTypeConfig {
|
|
567
|
+
enum?: EnumFieldConfig;
|
|
568
|
+
}
|
|
569
|
+
export interface EnumFieldConfig {
|
|
570
|
+
text?: string[];
|
|
571
|
+
color?: string[];
|
|
572
|
+
icon?: string[];
|
|
573
|
+
description?: string[];
|
|
574
|
+
}
|
|
575
|
+
/** @public */
|
|
576
|
+
export interface ValueLinkConfig {
|
|
577
|
+
/**
|
|
578
|
+
* Result of field reduction
|
|
579
|
+
*/
|
|
580
|
+
calculatedValue?: DisplayValue;
|
|
581
|
+
/**
|
|
582
|
+
* Index of the value row within Field. Should be provided only when value is not a result of a reduction
|
|
583
|
+
*/
|
|
584
|
+
valueRowIndex?: number;
|
|
585
|
+
}
|
|
586
|
+
export interface Field<T = any> {
|
|
587
|
+
/**
|
|
588
|
+
* Name of the field (column)
|
|
589
|
+
*/
|
|
590
|
+
name: string;
|
|
591
|
+
/**
|
|
592
|
+
* Field value type (string, number, etc)
|
|
593
|
+
*/
|
|
594
|
+
type: FieldType;
|
|
595
|
+
/**
|
|
596
|
+
* Meta info about how field and how to display it
|
|
597
|
+
*/
|
|
598
|
+
config: FieldConfig;
|
|
599
|
+
/**
|
|
600
|
+
* The raw field values
|
|
601
|
+
*/
|
|
602
|
+
values: T[];
|
|
603
|
+
/**
|
|
604
|
+
* When type === FieldType.Time, this can optionally store
|
|
605
|
+
* the nanosecond-precison fractions as integers between
|
|
606
|
+
* 0 and 999999.
|
|
607
|
+
*/
|
|
608
|
+
nanos?: number[];
|
|
609
|
+
labels?: Labels;
|
|
610
|
+
/**
|
|
611
|
+
* Cached values with appropriate display and id values
|
|
612
|
+
*/
|
|
613
|
+
state?: FieldState | null;
|
|
614
|
+
/**
|
|
615
|
+
* Convert a value for display
|
|
616
|
+
*/
|
|
617
|
+
display?: DisplayProcessor;
|
|
618
|
+
/**
|
|
619
|
+
* Get value data links with variables interpolated
|
|
620
|
+
*/
|
|
621
|
+
getLinks?: (config: ValueLinkConfig) => Array<LinkModel<Field>>;
|
|
622
|
+
}
|
|
623
|
+
/** @alpha */
|
|
624
|
+
export interface FieldState {
|
|
625
|
+
/**
|
|
626
|
+
* An appropriate name for the field (does not include frame info)
|
|
627
|
+
*/
|
|
628
|
+
displayName?: string | null;
|
|
629
|
+
/**
|
|
630
|
+
* Cache of reduced values
|
|
631
|
+
*/
|
|
632
|
+
calcs?: FieldCalcs;
|
|
633
|
+
/**
|
|
634
|
+
* The numeric range for values in this field. This value will respect the min/max
|
|
635
|
+
* set in field config, or when set to `auto` this will have the min/max for all data
|
|
636
|
+
* in the response
|
|
637
|
+
*/
|
|
638
|
+
range?: NumericRange;
|
|
639
|
+
/**
|
|
640
|
+
* Appropriate values for templating
|
|
641
|
+
*/
|
|
642
|
+
scopedVars?: ScopedVars;
|
|
643
|
+
/**
|
|
644
|
+
* Series index is index for this field in a larger data set that can span multiple DataFrames
|
|
645
|
+
* Useful for assigning color to series by looking up a color in a palette using this index
|
|
646
|
+
*/
|
|
647
|
+
seriesIndex?: number;
|
|
648
|
+
/**
|
|
649
|
+
* Location of this field within the context frames results
|
|
650
|
+
*
|
|
651
|
+
* @internal -- we will try to make this unnecessary
|
|
652
|
+
*/
|
|
653
|
+
origin?: DataFrameFieldIndex;
|
|
654
|
+
/**
|
|
655
|
+
* Boolean value is true if field is in a larger data set with multiple frames.
|
|
656
|
+
* This is only related to the cached displayName property above.
|
|
657
|
+
*/
|
|
658
|
+
multipleFrames?: boolean;
|
|
659
|
+
/**
|
|
660
|
+
* Boolean value is true if a null filling threshold has been applied
|
|
661
|
+
* against the frame of the field. This is used to avoid cases in which
|
|
662
|
+
* this would applied more than one time.
|
|
663
|
+
*/
|
|
664
|
+
nullThresholdApplied?: boolean;
|
|
665
|
+
/**
|
|
666
|
+
* Can be used by visualizations to cache max display value lengths to aid alignment.
|
|
667
|
+
* It's up to each visualization to calculate and set this.
|
|
668
|
+
*/
|
|
669
|
+
alignmentFactors?: DisplayValueAlignmentFactors;
|
|
670
|
+
/**
|
|
671
|
+
* This is the current ad-hoc state of whether this series is hidden in viz, tooltip, and legend.
|
|
672
|
+
*
|
|
673
|
+
* Currently this will match field.config.custom.hideFrom because fieldOverrides applies the special __system
|
|
674
|
+
* override to the actual config during toggle via legend. This should go away once we have a unified system
|
|
675
|
+
* for layering ad hoc field overrides and options but still being able to get the stateless fieldConfig and panel options
|
|
676
|
+
*/
|
|
677
|
+
hideFrom?: HideSeriesConfig;
|
|
678
|
+
}
|
|
679
|
+
/** @public */
|
|
680
|
+
export interface NumericRange {
|
|
681
|
+
min?: number | null;
|
|
682
|
+
max?: number | null;
|
|
683
|
+
delta: number;
|
|
684
|
+
}
|
|
685
|
+
export interface DataFrame extends QueryResultBase {
|
|
686
|
+
name?: string;
|
|
687
|
+
fields: Field[];
|
|
688
|
+
length: number;
|
|
689
|
+
}
|
|
690
|
+
export interface FieldCalcs extends Record<string, any> {
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Describes where a specific data frame field is located within a
|
|
694
|
+
* dataset of type DataFrame[]
|
|
695
|
+
*
|
|
696
|
+
* @internal -- we will try to make this unnecessary
|
|
697
|
+
*/
|
|
698
|
+
export interface DataFrameFieldIndex {
|
|
699
|
+
frameIndex: number;
|
|
700
|
+
fieldIndex: number;
|
|
701
|
+
}
|
|
3
702
|
export type ComponentSize = "xs" | "sm" | "md" | "lg";
|
|
703
|
+
export interface EntityAssertionsWidgetProps {
|
|
704
|
+
query: UseEntityParams;
|
|
705
|
+
size?: ComponentSize;
|
|
706
|
+
}
|
|
4
707
|
export interface Scope {
|
|
5
708
|
env?: string;
|
|
6
709
|
site?: string;
|
|
7
710
|
namespace?: string;
|
|
8
|
-
|
|
711
|
+
}
|
|
712
|
+
export interface UseEntityParams {
|
|
713
|
+
entityName?: string;
|
|
714
|
+
entityType?: string;
|
|
715
|
+
start: number;
|
|
716
|
+
end: number;
|
|
717
|
+
scope?: Scope;
|
|
718
|
+
}
|
|
719
|
+
export interface Entity {
|
|
720
|
+
name: string;
|
|
721
|
+
type: string;
|
|
722
|
+
frame: DataFrame;
|
|
9
723
|
}
|