wip……
This commit is contained in:
@@ -31,6 +31,14 @@ ConfigSpec: {
|
||||
transformations?: [...TransformationSpec]
|
||||
}
|
||||
|
||||
/*todo this is incorrect - target needs to be an object with any sort of key/value combination
|
||||
inside of it
|
||||
for external correlations, this is just `target: { url: 'google.com' }` ,
|
||||
but for query correlations, target is the json for populating the query editor, which is different
|
||||
for every datasource
|
||||
|
||||
right now this is resolving to require an object of objects, like item.spec.config.target.url is expecting an object
|
||||
instead of a string. how do i fix this? */
|
||||
TargetSpec: [string]: _
|
||||
|
||||
TransformationSpec: {
|
||||
|
||||
@@ -407,6 +407,12 @@ export type ObjectMeta = {
|
||||
Populated by the system. Read-only. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids */
|
||||
uid?: string;
|
||||
};
|
||||
|
||||
/*
|
||||
this needs to be
|
||||
[key: string]: any;
|
||||
};
|
||||
*/
|
||||
export type CorrelationTargetSpec = {
|
||||
[key: string]: {
|
||||
[key: string]: any;
|
||||
|
||||
@@ -3,6 +3,7 @@ import { lastValueFrom } from 'rxjs';
|
||||
|
||||
import {
|
||||
generatedAPI as correlationAPIv0alpha1,
|
||||
CorrelationCorrelationType,
|
||||
Correlation as CorrelationK8s,
|
||||
CorrelationList,
|
||||
} from '@grafana/api-clients/rtkq/correlations/v0alpha1';
|
||||
@@ -88,17 +89,31 @@ const toEnrichedCorrelationDataK8s = (item: CorrelationK8s): CorrelationData | u
|
||||
label: item.spec.label,
|
||||
description: item.spec.description,
|
||||
provisioned: false, // todo
|
||||
type: item.spec.type,
|
||||
};
|
||||
|
||||
if (item.spec.type === 'external') {
|
||||
const extCorr: CorrelationExternal = {
|
||||
...baseCor,
|
||||
type: 'external',
|
||||
config: {
|
||||
field: item.spec.config.field,
|
||||
target: {
|
||||
url: item.spec.config.target.url.url || '', // todo this is wrong, fix in spec
|
||||
},
|
||||
transformations: [], // todo fix
|
||||
},
|
||||
};
|
||||
return toEnrichedCorrelationData(extCorr);
|
||||
} else {
|
||||
const queryCorr: CorrelationQuery = {
|
||||
...baseCor,
|
||||
type: 'query',
|
||||
targetUID: item.spec.target?.name || '', // todo
|
||||
config: {
|
||||
field: item.spec.config.field,
|
||||
target: item.spec.config.target, // todo
|
||||
transformations: [], // todo fix
|
||||
},
|
||||
};
|
||||
return toEnrichedCorrelationData(queryCorr);
|
||||
}
|
||||
@@ -116,13 +131,6 @@ export const toEnrichedCorrelationsData = (correlationsResponse: CorrelationsRes
|
||||
};
|
||||
};
|
||||
|
||||
export const toEnrichedCorrelationDataK8s = (correlationsResponse: CorrelationList): CorrelationsData => {
|
||||
return {
|
||||
...correlationsResponse,
|
||||
correlations: correlationsResponse.items.map(toEnrichedCorrelationDataK8s).filter(validSourceFilter),
|
||||
};
|
||||
};
|
||||
|
||||
export function getData<T>(response: FetchResponse<T>) {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user