diff --git a/src/sql/workbench/parts/notebook/notebook.component.ts b/src/sql/workbench/parts/notebook/notebook.component.ts index 83604510b1..f64e1faf0e 100644 --- a/src/sql/workbench/parts/notebook/notebook.component.ts +++ b/src/sql/workbench/parts/notebook/notebook.component.ts @@ -55,7 +55,6 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { Button } from 'sql/base/browser/ui/button/button'; import { attachButtonStyler } from 'sql/platform/theme/common/styler'; import { isUndefinedOrNull } from 'vs/base/common/types'; -import { Color } from 'vs/base/common/color'; export const NOTEBOOK_SELECTOR: string = 'notebook-component'; @@ -445,13 +444,12 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe if (this.contextKeyService.getContextKeyValue('isDevelopment') && this.contextKeyService.getContextKeyValue('bookOpened') && this._navProvider) { - this.addButton(localize('previousButtonLabel', "< Previous"), - () => this.previousPage()); - this.addButton(localize('nextButtonLabel', "Next >"), - () => this.nextPage()); - this._navProvider.getNavigation(this._notebookParams.notebookUri).then(result => { this.navigationResult = result; + this.addButton(localize('previousButtonLabel', "< Previous"), + () => this.previousPage(), this.navigationResult.previous ? true : false); + this.addButton(localize('nextButtonLabel', "Next >"), + () => this.nextPage(), this.navigationResult.next ? true : false); this.detectChanges(); }, err => { console.log(err); @@ -466,7 +464,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe return 'hidden'; } - private addButton(label: string, onDidClick?: () => void): void { + private addButton(label: string, onDidClick?: () => void, enabled?: boolean): void { const container = DOM.append(this.bookNav.nativeElement, DOM.$('.dialog-message-button')); let button = new Button(container); button.icon = ''; @@ -474,6 +472,9 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe if (onDidClick) { this._register(button.onDidClick(onDidClick)); } + if (!enabled) { + button.enabled = false; + } } private actionItemProvider(action: Action): IActionViewItem {