Explore: adds table result dataframes sorting to get response columns order based on queries order (#25131)

* Chore: updates Explore result processor to sort dataframes based on their refId so results are displayed in a correct order

* Chore: adds types to Explore ResultProcessor getTableResult DataFrames
This commit is contained in:
Lukas Siatka 2020-05-27 16:45:53 +02:00 committed by GitHub
parent da027bb49f
commit 9d04dfe41a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -50,7 +50,20 @@ export class ResultProcessor {
return null; return null;
} }
const onlyTables = this.dataFrames.filter(frame => shouldShowInVisualisationType(frame, 'table')); const onlyTables = this.dataFrames
.filter((frame: DataFrame) => shouldShowInVisualisationType(frame, 'table'))
.sort((frameA: DataFrame, frameB: DataFrame) => {
const frameARefId = frameA.refId!;
const frameBRefId = frameB.refId!;
if (frameARefId > frameBRefId) {
return 1;
}
if (frameARefId < frameBRefId) {
return -1;
}
return 0;
});
if (onlyTables.length === 0) { if (onlyTables.length === 0) {
return null; return null;