/
types.ts
55 lines (43 loc) · 1.43 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { DataLinkTransformationConfig } from '@grafana/data';
export interface AddCorrelationResponse {
correlation: Correlation;
}
export type GetCorrelationsResponse = Correlation[];
export interface CorrelationsApiResponse {
message: string;
}
export interface CorrelationsErrorResponse extends CorrelationsApiResponse {
error: string;
}
export interface CreateCorrelationResponse extends CorrelationsApiResponse {
result: Correlation;
}
export interface UpdateCorrelationResponse extends CorrelationsApiResponse {
result: Correlation;
}
export interface RemoveCorrelationResponse {
message: string;
}
type CorrelationConfigType = 'query';
export interface CorrelationConfig {
field: string;
target: object; // this contains anything that would go in the query editor, so any extension off DataQuery a datasource would have, and needs to be generic
type: CorrelationConfigType;
transformations?: DataLinkTransformationConfig[];
}
export interface Correlation {
uid: string;
sourceUID: string;
targetUID: string;
label?: string;
description?: string;
provisioned: boolean;
orgId?: number;
config: CorrelationConfig;
}
export type GetCorrelationsParams = {
page: number;
};
export type RemoveCorrelationParams = Pick<Correlation, 'sourceUID' | 'uid'>;
export type CreateCorrelationParams = Omit<Correlation, 'uid' | 'provisioned'>;
export type UpdateCorrelationParams = Omit<Correlation, 'targetUID' | 'provisioned'>;