mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
@@ -9,7 +9,7 @@ import { OnInit, Component, Input, Inject, ElementRef, ViewChild, Output, EventE
|
|||||||
import { AngularDisposable } from 'sql/base/node/lifecycle';
|
import { AngularDisposable } from 'sql/base/node/lifecycle';
|
||||||
import { QueryTextEditor } from 'sql/workbench/electron-browser/modelComponents/queryTextEditor';
|
import { QueryTextEditor } from 'sql/workbench/electron-browser/modelComponents/queryTextEditor';
|
||||||
import { CellToggleMoreActions } from 'sql/workbench/parts/notebook/cellToggleMoreActions';
|
import { CellToggleMoreActions } from 'sql/workbench/parts/notebook/cellToggleMoreActions';
|
||||||
import { ICellModel, notebookConstants } from 'sql/workbench/parts/notebook/models/modelInterfaces';
|
import { ICellModel, notebookConstants, CellExecutionState } from 'sql/workbench/parts/notebook/models/modelInterfaces';
|
||||||
import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
|
import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
|
||||||
import { RunCellAction, CellContext } from 'sql/workbench/parts/notebook/cellViews/codeActions';
|
import { RunCellAction, CellContext } from 'sql/workbench/parts/notebook/cellViews/codeActions';
|
||||||
import { NotebookModel } from 'sql/workbench/parts/notebook/models/notebookModel';
|
import { NotebookModel } from 'sql/workbench/parts/notebook/models/notebookModel';
|
||||||
@@ -229,6 +229,11 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
this._register(this.model.layoutChanged(() => this._layoutEmitter.fire(), this));
|
this._register(this.model.layoutChanged(() => this._layoutEmitter.fire(), this));
|
||||||
|
this._register(this.cellModel.onExecutionStateChange(event => {
|
||||||
|
if (event === CellExecutionState.Running) {
|
||||||
|
this.setFocusAndScroll();
|
||||||
|
}
|
||||||
|
}));
|
||||||
this.layout();
|
this.layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -249,7 +254,6 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
|
|||||||
this._actionBar.setContent([
|
this._actionBar.setContent([
|
||||||
{ action: runCellAction }
|
{ action: runCellAction }
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this._cellToggleMoreActions.onInit(this.moreActionsElementRef, this.model, this.cellModel);
|
this._cellToggleMoreActions.onInit(this.moreActionsElementRef, this.model, this.cellModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -187,6 +187,14 @@ export class CellModel implements ICellModel {
|
|||||||
|
|
||||||
public async runCell(notificationService?: INotificationService, connectionManagementService?: IConnectionManagementService): Promise<boolean> {
|
public async runCell(notificationService?: INotificationService, connectionManagementService?: IConnectionManagementService): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
|
if (!this.active && this !== this.notebookModel.activeCell) {
|
||||||
|
if (this.notebookModel.activeCell) {
|
||||||
|
this.notebookModel.activeCell.active = false;
|
||||||
|
}
|
||||||
|
this.active = true;
|
||||||
|
this.notebookModel.activeCell = this;
|
||||||
|
}
|
||||||
|
|
||||||
if (connectionManagementService) {
|
if (connectionManagementService) {
|
||||||
this._connectionManagementService = connectionManagementService;
|
this._connectionManagementService = connectionManagementService;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -480,6 +480,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
await this.modelReady;
|
await this.modelReady;
|
||||||
let uriString = cell.cellUri.toString();
|
let uriString = cell.cellUri.toString();
|
||||||
if (this._model.cells.findIndex(c => c.cellUri.toString() === uriString) > -1) {
|
if (this._model.cells.findIndex(c => c.cellUri.toString() === uriString) > -1) {
|
||||||
|
this.selectCell(cell);
|
||||||
return cell.runCell(this.notificationService, this.connectionManagementService);
|
return cell.runCell(this.notificationService, this.connectionManagementService);
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(new Error(localize('cellNotFound', 'cell with URI {0} was not found in this model', uriString)));
|
return Promise.reject(new Error(localize('cellNotFound', 'cell with URI {0} was not found in this model', uriString)));
|
||||||
|
|||||||
Reference in New Issue
Block a user