From 36c8945f1e57a4d3e81ed2e794745d17ecc3a3c2 Mon Sep 17 00:00:00 2001 From: Alan Ren Date: Thu, 25 May 2023 13:30:44 -0700 Subject: [PATCH] fix link cell not working issue (#23223) --- .../browser/outputs/gridOutput.component.ts | 1 + .../contrib/query/browser/gridPanel.ts | 33 ++++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/sql/workbench/contrib/notebook/browser/outputs/gridOutput.component.ts b/src/sql/workbench/contrib/notebook/browser/outputs/gridOutput.component.ts index d4df07ae79..d99a978073 100644 --- a/src/sql/workbench/contrib/notebook/browser/outputs/gridOutput.component.ts +++ b/src/sql/workbench/contrib/notebook/browser/outputs/gridOutput.component.ts @@ -267,6 +267,7 @@ class DataResourceTable extends GridTableBase { this._chart.onOptionsChange(options => { this.setChartOptions(options); }); + this.providerId = cellModel.notebookModel.context?.providerName; } public get gridDataProvider(): IGridDataProvider { diff --git a/src/sql/workbench/contrib/query/browser/gridPanel.ts b/src/sql/workbench/contrib/query/browser/gridPanel.ts index f03790965a..1fc69feaf7 100644 --- a/src/sql/workbench/contrib/query/browser/gridPanel.ts +++ b/src/sql/workbench/contrib/query/browser/gridPanel.ts @@ -798,24 +798,25 @@ export abstract class GridTableBase extends Disposable implements IView, IQue const subset = await this.getRowData(event.cell.row, 1); const value = subset[0][event.cell.cell - 1]; if (column.isXml || (this.gridConfig.showJsonAsLink && isJsonCell(value))) { - const result = await this.executionPlanService.isExecutionPlan(this.providerId, value.displayValue); - if (result.isExecutionPlan) { - const executionPlanGraphInfo = { - graphFileContent: value.displayValue, - graphFileType: result.queryExecutionPlanFileExtension - }; + if (column.isXml && this.providerId) { + const result = await this.executionPlanService.isExecutionPlan(this.providerId, value.displayValue); + if (result.isExecutionPlan) { + const executionPlanGraphInfo = { + graphFileContent: value.displayValue, + graphFileType: result.queryExecutionPlanFileExtension + }; - const executionPlanInput = this.instantiationService.createInstance(ExecutionPlanInput, undefined, executionPlanGraphInfo); - await this.editorService.openEditor(executionPlanInput); - } - else { - const content = value.displayValue; - const input = this.untitledEditorService.create({ languageId: column.isXml ? 'xml' : 'json', initialValue: content }); - await input.resolve(); - await this.instantiationService.invokeFunction(formatDocumentWithSelectedProvider, input.textEditorModel, FormattingMode.Explicit, Progress.None, CancellationToken.None); - input.setDirty(false); - await this.editorService.openEditor(input); + const executionPlanInput = this.instantiationService.createInstance(ExecutionPlanInput, undefined, executionPlanGraphInfo); + await this.editorService.openEditor(executionPlanInput); + return; + } } + const content = value.displayValue; + const input = this.untitledEditorService.create({ languageId: column.isXml ? 'xml' : 'json', initialValue: content }); + await input.resolve(); + await this.instantiationService.invokeFunction(formatDocumentWithSelectedProvider, input.textEditorModel, FormattingMode.Explicit, Progress.None, CancellationToken.None); + input.setDirty(false); + await this.editorService.openEditor(input); } } }