From cca84e645523e04d60fa350cbaf8f4845ce793e5 Mon Sep 17 00:00:00 2001 From: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com> Date: Wed, 13 Mar 2019 18:32:31 -0700 Subject: [PATCH] Fix disappearing notebook table (#4466) --- src/sql/parts/notebook/cellViews/output.component.ts | 5 +++++ src/sql/parts/notebook/cellViews/outputArea.component.html | 2 +- src/sql/parts/notebook/models/cell.ts | 4 ++++ src/sql/parts/notebook/models/modelInterfaces.ts | 4 +++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/sql/parts/notebook/cellViews/output.component.ts b/src/sql/parts/notebook/cellViews/output.component.ts index 5e534b7d0d..d7366cb1f8 100644 --- a/src/sql/parts/notebook/cellViews/output.component.ts +++ b/src/sql/parts/notebook/cellViews/output.component.ts @@ -7,6 +7,7 @@ import 'vs/css!./code'; import { OnInit, Component, Input, Inject, ElementRef, ViewChild } from '@angular/core'; import { AngularDisposable } from 'sql/base/node/lifecycle'; import { nb } from 'azdata'; +import { ICellModel } from 'sql/parts/notebook/models/modelInterfaces'; import { INotebookService } from 'sql/workbench/services/notebook/common/notebookService'; import { MimeModel } from 'sql/parts/notebook/outputs/common/mimemodel'; import * as outputProcessor from 'sql/parts/notebook/outputs/common/outputProcessor'; @@ -22,6 +23,7 @@ export const OUTPUT_SELECTOR: string = 'output-component'; export class OutputComponent extends AngularDisposable implements OnInit { @ViewChild('output', { read: ElementRef }) private outputElement: ElementRef; @Input() cellOutput: nb.ICellOutput; + @Input() cellModel: ICellModel; private _trusted: boolean; private _initialized: boolean = false; private readonly _minimumHeight = 30; @@ -38,6 +40,9 @@ export class OutputComponent extends AngularDisposable implements OnInit { ngOnInit() { this.renderOutput(); this._initialized = true; + this.cellModel.notebookModel.layoutChanged(() => { + this.renderOutput(); + }); } private renderOutput() { diff --git a/src/sql/parts/notebook/cellViews/outputArea.component.html b/src/sql/parts/notebook/cellViews/outputArea.component.html index 8669d54d75..fddff39107 100644 --- a/src/sql/parts/notebook/cellViews/outputArea.component.html +++ b/src/sql/parts/notebook/cellViews/outputArea.component.html @@ -6,7 +6,7 @@ -->
- +
\ No newline at end of file diff --git a/src/sql/parts/notebook/models/cell.ts b/src/sql/parts/notebook/models/cell.ts index a1f3563d34..b0a3da64dd 100644 --- a/src/sql/parts/notebook/models/cell.ts +++ b/src/sql/parts/notebook/models/cell.ts @@ -129,6 +129,10 @@ export class CellModel implements ICellModel { return this._cellUri; } + public get notebookModel(): NotebookModel { + return this.options.notebook; + } + public set cellUri(value: URI) { this._cellUri = value; } diff --git a/src/sql/parts/notebook/models/modelInterfaces.ts b/src/sql/parts/notebook/models/modelInterfaces.ts index 0148b75f39..d1f7679ae0 100644 --- a/src/sql/parts/notebook/models/modelInterfaces.ts +++ b/src/sql/parts/notebook/models/modelInterfaces.ts @@ -23,6 +23,7 @@ import { IStandardKernelWithProvider } from 'sql/parts/notebook/notebookUtils'; import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile'; import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService'; import { localize } from 'vs/nls'; +import { NotebookModel } from 'sql/parts/notebook/models/notebookModel'; export interface IClientSessionOptions { notebookUri: URI; @@ -449,8 +450,9 @@ export interface ICellModel { readonly outputs: ReadonlyArray; readonly onOutputsChanged: Event>; readonly onExecutionStateChange: Event; - setFuture(future: FutureInternal): void; readonly executionState: CellExecutionState; + readonly notebookModel: NotebookModel; + setFuture(future: FutureInternal): void; runCell(notificationService?: INotificationService, connectionManagementService?: IConnectionManagementService): Promise; setOverrideLanguage(language: string); equals(cellModel: ICellModel): boolean;