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" ;
@@ -23,6 +26,7 @@ import { telemetryListener } from "../common/vscode/telemetry";
2326import { redactableError } from "../common/errors" ;
2427import { App } from "../common/app" ;
2528import { findResultSetNames , CompareQueryInfo } from "./result-set-names" ;
29+ import { compareInterpretedResults } from "./interpreted-results" ;
2630
2731interface ComparePair {
2832 from : CompletedLocalQueryInfo ;
@@ -95,6 +99,7 @@ export class CompareView extends AbstractWebview<
9599 await this . waitForPanelLoaded ( ) ;
96100 const {
97101 commonResultSetNames,
102+ currentResultSetName,
98103 currentResultSetDisplayName,
99104 fromResultSetName,
100105 toResultSetName,
@@ -103,14 +108,18 @@ export class CompareView extends AbstractWebview<
103108 selectedResultSetName ,
104109 ) ;
105110 if ( currentResultSetDisplayName ) {
106- let result : RawQueryCompareResult | undefined ;
111+ let result : QueryCompareResult | undefined ;
107112 let message : string | undefined ;
108113 try {
109- result = await this . compareResults (
110- this . comparePair ,
111- fromResultSetName ,
112- toResultSetName ,
113- ) ;
114+ if ( currentResultSetName === ALERTS_TABLE_NAME ) {
115+ result = await this . compareInterpretedResults ( this . comparePair ) ;
116+ } else {
117+ result = await this . compareResults (
118+ this . comparePair ,
119+ fromResultSetName ,
120+ toResultSetName ,
121+ ) ;
122+ }
114123 } catch ( e ) {
115124 message = getErrorMessage ( e ) ;
116125 }
@@ -209,13 +218,15 @@ export class CompareView extends AbstractWebview<
209218 ) {
210219 const {
211220 commonResultSetNames,
221+ currentResultSetName,
212222 currentResultSetDisplayName,
213223 fromResultSetName,
214224 toResultSetName,
215225 } = await findResultSetNames ( fromInfo , toInfo , selectedResultSetName ) ;
216226
217227 return {
218228 commonResultSetNames,
229+ currentResultSetName,
219230 currentResultSetDisplayName,
220231 fromResultSetName,
221232 toResultSetName,
@@ -260,6 +271,18 @@ export class CompareView extends AbstractWebview<
260271 return resultsDiff ( fromResultSet , toResultSet ) ;
261272 }
262273
274+ private async compareInterpretedResults ( {
275+ from,
276+ to,
277+ } : ComparePair ) : Promise < InterpretedQueryCompareResult > {
278+ return compareInterpretedResults (
279+ this . databaseManager ,
280+ this . cliServer ,
281+ from ,
282+ to ,
283+ ) ;
284+ }
285+
263286 private async openQuery ( kind : "from" | "to" ) {
264287 const toOpen =
265288 kind === "from" ? this . comparePair ?. from : this . comparePair ?. to ;
0 commit comments