Skip to content

Commit 28819df

Browse files
Convert handleShowEvalLogViewer to use createSingleSelectionCommand
1 parent 43c0d15 commit 28819df

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

extensions/ql-vscode/src/query-history/query-history-manager.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,10 @@ export class QueryHistoryManager extends DisposableObject {
260260
this.handleShowEvalLogSummary.bind(this),
261261
"query",
262262
),
263-
"codeQLQueryHistory.showEvalLogViewer":
263+
"codeQLQueryHistory.showEvalLogViewer": createSingleSelectionCommand(
264264
this.handleShowEvalLogViewer.bind(this),
265+
"query",
266+
),
265267
"codeQLQueryHistory.showQueryLog": createSingleSelectionCommand(
266268
this.handleShowQueryLog.bind(this),
267269
"query",
@@ -761,34 +763,30 @@ export class QueryHistoryManager extends DisposableObject {
761763
}
762764
}
763765

764-
async handleShowEvalLogViewer(
765-
singleItem: QueryHistoryInfo,
766-
multiSelect: QueryHistoryInfo[] | undefined,
767-
) {
768-
// Only applicable to an individual local query
769-
if (!this.assertSingleQuery(multiSelect) || singleItem.t !== "local") {
766+
async handleShowEvalLogViewer(item: QueryHistoryInfo) {
767+
if (item.t !== "local") {
770768
return;
771769
}
772770

773771
// If the JSON summary file location wasn't saved, display error
774-
if (singleItem.jsonEvalLogSummaryLocation === undefined) {
772+
if (item.jsonEvalLogSummaryLocation === undefined) {
775773
this.warnInProgressEvalLogViewer();
776774
return;
777775
}
778776

779777
// TODO(angelapwen): Stream the file in.
780778
try {
781779
const evalLogData: EvalLogData[] = await parseViewerData(
782-
singleItem.jsonEvalLogSummaryLocation,
780+
item.jsonEvalLogSummaryLocation,
783781
);
784782
const evalLogTreeBuilder = new EvalLogTreeBuilder(
785-
singleItem.getQueryName(),
783+
item.getQueryName(),
786784
evalLogData,
787785
);
788786
this.evalLogViewer.updateRoots(await evalLogTreeBuilder.getRoots());
789787
} catch (e) {
790788
throw new Error(
791-
`Could not read evaluator log summary JSON file to generate viewer data at ${singleItem.jsonEvalLogSummaryLocation}.`,
789+
`Could not read evaluator log summary JSON file to generate viewer data at ${item.jsonEvalLogSummaryLocation}.`,
792790
);
793791
}
794792
}

0 commit comments

Comments
 (0)