Transformations: Allow queries without dataframe results to be selectable as filters (#107152)

* Add mention of external type to correlations docs

* 🆗

* Merge request targets in with results

* Ensure we do not mutate result set
This commit is contained in:
Kristina
2025-07-10 18:47:18 -05:00
committed by GitHub
parent a1e4280603
commit a01b4c31a1
2 changed files with 13 additions and 1 deletions
@@ -138,7 +138,17 @@ export const TransformationOperationRow = ({
.subscribe(setOutput);
const prevOutputSubscription = transformDataFrame(prevInputTransforms, data.series, ctx)
.pipe(mergeMap((before) => transformDataFrame(prevOutputTransforms, before, ctx)))
.subscribe(setPrevOutput);
.subscribe((result) => {
let mergedResult = [...result];
// add refIds that were requested even if they did not return a result
data.request?.targets.forEach((series) => {
const refIdInResult = mergedResult.some((frame) => frame.refId === series.refId);
if (!refIdInResult) {
mergedResult.push({ refId: series.refId, fields: [], length: 0 });
}
});
setPrevOutput(mergedResult);
});
return function unsubscribe() {
inputSubscription.unsubscribe();
@@ -5,6 +5,7 @@ import { Unsubscribable } from 'rxjs';
import {
DataFrame,
DataQueryRequest,
DataTransformerConfig,
PanelData,
SelectableValue,
@@ -44,6 +45,7 @@ export type viewAllType = 'viewAll';
export type FilterCategory = TransformerCategory | viewAllType;
export interface TransformationData {
request?: DataQueryRequest;
series: DataFrame[];
annotations?: DataFrame[];
}