@@ -22,13 +22,18 @@ import {
2222import { telemetryListener } from "../common/vscode/telemetry" ;
2323import { redactableError } from "../common/errors" ;
2424import { App } from "../common/app" ;
25- import { findResultSetNames } from "./result-set-names" ;
25+ import {
26+ findCommonResultSetNames ,
27+ findResultSetNames ,
28+ } from "./result-set-names" ;
2629
2730interface ComparePair {
2831 from : CompletedLocalQueryInfo ;
2932 fromSchemas : BQRSInfo ;
3033 to : CompletedLocalQueryInfo ;
3134 toSchemas : BQRSInfo ;
35+
36+ commonResultSetNames : readonly string [ ] ;
3237}
3338
3439export class CompareView extends AbstractWebview <
@@ -62,13 +67,44 @@ export class CompareView extends AbstractWebview<
6267 to . completedQuery . query . resultsPaths . resultsPath ,
6368 ) ;
6469
70+ const commonResultSetNames = await findCommonResultSetNames (
71+ fromSchemas ,
72+ toSchemas ,
73+ ) ;
74+
6575 this . comparePair = {
6676 from,
6777 fromSchemas,
6878 to,
6979 toSchemas,
80+ commonResultSetNames,
7081 } ;
7182
83+ const panel = await this . getPanel ( ) ;
84+ panel . reveal ( undefined , true ) ;
85+ await this . waitForPanelLoaded ( ) ;
86+
87+ await this . postMessage ( {
88+ t : "setComparisonQueryInfo" ,
89+ stats : {
90+ fromQuery : {
91+ // since we split the description into several rows
92+ // only run interpolation if the label is user-defined
93+ // otherwise we will wind up with duplicated rows
94+ name : this . labelProvider . getShortLabel ( from ) ,
95+ status : from . completedQuery . statusString ,
96+ time : from . startTime ,
97+ } ,
98+ toQuery : {
99+ name : this . labelProvider . getShortLabel ( to ) ,
100+ status : to . completedQuery . statusString ,
101+ time : to . startTime ,
102+ } ,
103+ } ,
104+ databaseUri : to . initialInfo . databaseInfo . databaseUri ,
105+ commonResultSetNames,
106+ } ) ;
107+
72108 await this . showResultsInternal ( selectedResultSetName ) ;
73109 }
74110
@@ -77,21 +113,15 @@ export class CompareView extends AbstractWebview<
77113 return ;
78114 }
79115
80- const { from, to } = this . comparePair ;
81-
82116 const panel = await this . getPanel ( ) ;
83117 panel . reveal ( undefined , true ) ;
84118
85119 await this . waitForPanelLoaded ( ) ;
86- const {
87- commonResultSetNames,
88- currentResultSetDisplayName,
89- fromResultSet,
90- toResultSet,
91- } = await this . findResultSetsToCompare (
92- this . comparePair ,
93- selectedResultSetName ,
94- ) ;
120+ const { currentResultSetDisplayName, fromResultSet, toResultSet } =
121+ await this . findResultSetsToCompare (
122+ this . comparePair ,
123+ selectedResultSetName ,
124+ ) ;
95125 if ( currentResultSetDisplayName ) {
96126 let result : RawQueryCompareResult | undefined ;
97127 let message : string | undefined ;
@@ -103,26 +133,9 @@ export class CompareView extends AbstractWebview<
103133
104134 await this . postMessage ( {
105135 t : "setComparisons" ,
106- stats : {
107- fromQuery : {
108- // since we split the description into several rows
109- // only run interpolation if the label is user-defined
110- // otherwise we will wind up with duplicated rows
111- name : this . labelProvider . getShortLabel ( from ) ,
112- status : from . completedQuery . statusString ,
113- time : from . startTime ,
114- } ,
115- toQuery : {
116- name : this . labelProvider . getShortLabel ( to ) ,
117- status : to . completedQuery . statusString ,
118- time : to . startTime ,
119- } ,
120- } ,
121136 result,
122- commonResultSetNames,
123137 currentResultSetName : currentResultSetDisplayName ,
124138 message,
125- databaseUri : to . initialInfo . databaseInfo . databaseUri ,
126139 } ) ;
127140 }
128141 }
@@ -190,15 +203,16 @@ export class CompareView extends AbstractWebview<
190203 }
191204
192205 private async findResultSetsToCompare (
193- { from, fromSchemas, to, toSchemas } : ComparePair ,
206+ { from, fromSchemas, to, toSchemas, commonResultSetNames } : ComparePair ,
194207 selectedResultSetName : string | undefined ,
195208 ) {
196- const {
197- commonResultSetNames,
198- currentResultSetDisplayName,
199- fromResultSetName,
200- toResultSetName,
201- } = await findResultSetNames ( fromSchemas , toSchemas , selectedResultSetName ) ;
209+ const { currentResultSetDisplayName, fromResultSetName, toResultSetName } =
210+ await findResultSetNames (
211+ fromSchemas ,
212+ toSchemas ,
213+ commonResultSetNames ,
214+ selectedResultSetName ,
215+ ) ;
202216
203217 const fromResultSet = await this . getResultSet (
204218 fromSchemas ,
@@ -211,7 +225,6 @@ export class CompareView extends AbstractWebview<
211225 to . completedQuery . query . resultsPaths . resultsPath ,
212226 ) ;
213227 return {
214- commonResultSetNames,
215228 currentResultSetDisplayName,
216229 fromResultSet,
217230 toResultSet,
0 commit comments