11import { ViewColumn } from "vscode" ;
22
33import {
4+ ALERTS_TABLE_NAME ,
45 FromCompareViewMessage ,
6+ InterpretedQueryCompareResult ,
7+ QueryCompareResult ,
58 RawQueryCompareResult ,
69 ToCompareViewMessage ,
710} from "../common/interface-types" ;
@@ -25,11 +28,12 @@ import { App } from "../common/app";
2528import { bqrsToResultSet } from "../common/bqrs-raw-results-mapper" ;
2629import { RawResultSet } from "../common/raw-result-types" ;
2730import {
31+ CompareQueryInfo ,
2832 findCommonResultSetNames ,
2933 findResultSetNames ,
30- CompareQueryInfo ,
3134 getResultSetNames ,
3235} from "./result-set-names" ;
36+ import { compareInterpretedResults } from "./interpreted-results" ;
3337
3438interface ComparePair {
3539 from : CompletedLocalQueryInfo ;
@@ -146,20 +150,28 @@ export class CompareView extends AbstractWebview<
146150 panel . reveal ( undefined , true ) ;
147151
148152 await this . waitForPanelLoaded ( ) ;
149- const { currentResultSetDisplayName, fromResultSetName, toResultSetName } =
150- await this . findResultSetsToCompare (
151- this . comparePair ,
152- selectedResultSetName ,
153- ) ;
153+ const {
154+ currentResultSetName,
155+ currentResultSetDisplayName,
156+ fromResultSetName,
157+ toResultSetName,
158+ } = await this . findResultSetsToCompare (
159+ this . comparePair ,
160+ selectedResultSetName ,
161+ ) ;
154162 if ( currentResultSetDisplayName ) {
155- let result : RawQueryCompareResult | undefined ;
163+ let result : QueryCompareResult | undefined ;
156164 let message : string | undefined ;
157165 try {
158- result = await this . compareResults (
159- this . comparePair ,
160- fromResultSetName ,
161- toResultSetName ,
162- ) ;
166+ if ( currentResultSetName === ALERTS_TABLE_NAME ) {
167+ result = await this . compareInterpretedResults ( this . comparePair ) ;
168+ } else {
169+ result = await this . compareResults (
170+ this . comparePair ,
171+ fromResultSetName ,
172+ toResultSetName ,
173+ ) ;
174+ }
163175 } catch ( e ) {
164176 message = getErrorMessage ( e ) ;
165177 }
@@ -239,15 +251,21 @@ export class CompareView extends AbstractWebview<
239251 { fromInfo, toInfo, commonResultSetNames } : ComparePair ,
240252 selectedResultSetName : string | undefined ,
241253 ) {
242- const { currentResultSetDisplayName, fromResultSetName, toResultSetName } =
243- await findResultSetNames (
244- fromInfo ,
245- toInfo ,
246- commonResultSetNames ,
247- selectedResultSetName ,
248- ) ;
254+ const {
255+ currentResultSetName,
256+ currentResultSetDisplayName,
257+ fromResultSetName,
258+ toResultSetName,
259+ } = await findResultSetNames (
260+ fromInfo ,
261+ toInfo ,
262+ commonResultSetNames ,
263+ selectedResultSetName ,
264+ ) ;
249265
250266 return {
267+ commonResultSetNames,
268+ currentResultSetName,
251269 currentResultSetDisplayName,
252270 fromResultSetName,
253271 toResultSetName,
@@ -292,6 +310,18 @@ export class CompareView extends AbstractWebview<
292310 return resultsDiff ( fromResultSet , toResultSet ) ;
293311 }
294312
313+ private async compareInterpretedResults ( {
314+ from,
315+ to,
316+ } : ComparePair ) : Promise < InterpretedQueryCompareResult > {
317+ return compareInterpretedResults (
318+ this . databaseManager ,
319+ this . cliServer ,
320+ from ,
321+ to ,
322+ ) ;
323+ }
324+
295325 private async openQuery ( kind : "from" | "to" ) {
296326 const toOpen =
297327 kind === "from" ? this . comparePair ?. from : this . comparePair ?. to ;
0 commit comments