Enable status bar for notebooks (#14817)

* enable status bar for notebooks

* add onCellExecutionStart event to notebook service

* fix test, change var name
This commit is contained in:
Lucy Zhang
2021-03-22 14:54:13 -07:00
committed by GitHub
parent 8fb54710fb
commit 780ca84f9a
5 changed files with 33 additions and 3 deletions

View File

@@ -5,6 +5,7 @@
import { parseNumAsTimeString } from 'sql/platform/connection/common/utils';
import { QueryEditorInput } from 'sql/workbench/common/editor/query/queryEditorInput';
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
import { IQueryModelService } from 'sql/workbench/services/query/common/queryModel';
import QueryRunner from 'sql/workbench/services/query/common/queryRunner';
import { IntervalTimer } from 'vs/base/common/async';
@@ -259,8 +260,9 @@ export class QueryResultSelectionSummaryStatusBarContribution extends Disposable
constructor(
@IStatusbarService private readonly statusbarService: IStatusbarService,
@IEditorService private editorService: IEditorService,
@IQueryModelService queryModelService: IQueryModelService
@IEditorService editorService: IEditorService,
@IQueryModelService queryModelService: IQueryModelService,
@INotebookService notebookService: INotebookService
) {
super();
this.statusItem = this._register(
@@ -274,6 +276,7 @@ export class QueryResultSelectionSummaryStatusBarContribution extends Disposable
);
this._register(editorService.onDidActiveEditorChange(() => { this.hide(); }, this));
this._register(queryModelService.onRunQueryStart(() => { this.hide(); }));
this._register(notebookService.onCodeCellExecutionStart(() => { this.hide(); }));
this._register(queryModelService.onCellSelectionChanged((data: string[]) => {
this.onCellSelectionChanged(data);
}));
@@ -289,7 +292,7 @@ export class QueryResultSelectionSummaryStatusBarContribution extends Disposable
private onCellSelectionChanged(data: string[]): void {
const numericValues = data?.filter(value => !Number.isNaN(Number(value))).map(value => Number(value));
if (numericValues?.length < 2 || !(this.editorService.activeEditor instanceof QueryEditorInput)) {
if (numericValues?.length < 2) {
this.hide();
return;
}