mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 01:25:36 -05:00
Initial Code Layering (#3788)
* working on formatting * fixed basic lint errors; starting moving things to their appropriate location * formatting * update tslint to match the version of vscode we have * remove unused code * work in progress fixing layering * formatting * moved connection management service to platform * formatting * add missing file * moving more servies * formatting * moving more services * formatting * wip * moving more services * formatting * revert back tslint rules * move css file * add missing svgs
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import './notebookStyles';
|
||||
import 'sql/parts/notebook/notebookStyles';
|
||||
|
||||
import { OnInit, Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild, OnDestroy } from '@angular/core';
|
||||
|
||||
@@ -30,17 +30,17 @@ import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
|
||||
import { VIEWLET_ID, IExtensionsViewlet } from 'vs/workbench/parts/extensions/common/extensions';
|
||||
|
||||
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
|
||||
import { AngularDisposable } from 'sql/base/common/lifecycle';
|
||||
import { AngularDisposable } from 'sql/base/node/lifecycle';
|
||||
import { CellTypes, CellType } from 'sql/parts/notebook/models/contracts';
|
||||
import { ICellModel, IModelFactory, notebookConstants, INotebookModel, NotebookContentChange } from 'sql/parts/notebook/models/modelInterfaces';
|
||||
import { IConnectionManagementService, IConnectionDialogService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { INotebookService, INotebookParams, INotebookManager, INotebookEditor, DEFAULT_NOTEBOOK_FILETYPE, DEFAULT_NOTEBOOK_PROVIDER, SQL_NOTEBOOK_PROVIDER } from 'sql/services/notebook/notebookService';
|
||||
import { IConnectionManagementService, IConnectionDialogService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { INotebookService, INotebookParams, INotebookManager, INotebookEditor, DEFAULT_NOTEBOOK_FILETYPE, DEFAULT_NOTEBOOK_PROVIDER, SQL_NOTEBOOK_PROVIDER } from 'sql/workbench/services/notebook/common/notebookService';
|
||||
import { IBootstrapParams } from 'sql/services/bootstrap/bootstrapService';
|
||||
import { NotebookModel } from 'sql/parts/notebook/models/notebookModel';
|
||||
import { ModelFactory } from 'sql/parts/notebook/models/modelFactory';
|
||||
import * as notebookUtils from 'sql/parts/notebook/notebookUtils';
|
||||
import { Deferred } from 'sql/base/common/promise';
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
|
||||
import { KernelsDropdown, AttachToDropdown, AddCellAction, TrustedAction, SaveNotebookAction } from 'sql/parts/notebook/notebookActions';
|
||||
import { IObjectExplorerService } from 'sql/parts/objectExplorer/common/objectExplorerService';
|
||||
@@ -137,7 +137,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
}
|
||||
|
||||
public get activeCellId(): string {
|
||||
return this._model && this._model.activeCell ? this._model.activeCell.id : '';
|
||||
return this._model && this._model.activeCell ? this._model.activeCell.id : '';
|
||||
}
|
||||
|
||||
public get modelRegistered(): Promise<NotebookModel> {
|
||||
@@ -175,15 +175,13 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
}
|
||||
|
||||
// Add cell based on cell type
|
||||
public addCell(cellType: CellType)
|
||||
{
|
||||
public addCell(cellType: CellType) {
|
||||
let newCell = this._model.addCell(cellType);
|
||||
this.selectCell(newCell);
|
||||
}
|
||||
|
||||
// Updates Notebook model's trust details
|
||||
public updateModelTrustDetails(isTrusted: boolean)
|
||||
{
|
||||
public updateModelTrustDetails(isTrusted: boolean) {
|
||||
this._model.trustedMode = isTrusted;
|
||||
this._model.cells.forEach(cell => {
|
||||
cell.trustedMode = isTrusted;
|
||||
@@ -258,7 +256,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
await this.notebookService.registrationComplete;
|
||||
// Refresh the provider if we had been using default
|
||||
if (DEFAULT_NOTEBOOK_PROVIDER === this._notebookParams.providerId) {
|
||||
let providers= notebookUtils.getProvidersForFileName(this._notebookParams.notebookUri.fsPath, this.notebookService);
|
||||
let providers = notebookUtils.getProvidersForFileName(this._notebookParams.notebookUri.fsPath, this.notebookService);
|
||||
let tsqlProvider = providers.find(provider => provider === SQL_NOTEBOOK_PROVIDER);
|
||||
this._notebookParams.providerId = tsqlProvider ? SQL_NOTEBOOK_PROVIDER : providers[0];
|
||||
}
|
||||
@@ -284,10 +282,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
}
|
||||
|
||||
// Updates toolbar components
|
||||
private updateToolbarComponents(isTrusted: boolean)
|
||||
{
|
||||
if(this._trustedAction)
|
||||
{
|
||||
private updateToolbarComponents(isTrusted: boolean) {
|
||||
if (this._trustedAction) {
|
||||
this._trustedAction.enabled = true;
|
||||
this._trustedAction.trusted = isTrusted;
|
||||
}
|
||||
@@ -336,7 +332,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
let addCodeCellButton = new AddCellAction('notebook.AddCodeCell', localize('code', 'Code'), 'notebook-button icon-add');
|
||||
addCodeCellButton.cellType = CellTypes.Code;
|
||||
|
||||
let addTextCellButton = new AddCellAction('notebook.AddTextCell',localize('text', 'Text'), 'notebook-button icon-add');
|
||||
let addTextCellButton = new AddCellAction('notebook.AddTextCell', localize('text', 'Text'), 'notebook-button icon-add');
|
||||
addTextCellButton.cellType = CellTypes.Markdown;
|
||||
|
||||
this._trustedAction = this.instantiationService.createInstance(TrustedAction, 'notebook.Trusted');
|
||||
@@ -353,10 +349,10 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
let groups = notebookBarMenu.getActions({ arg: null, shouldForwardArgs: true });
|
||||
let primary: IAction[] = [];
|
||||
let secondary: IAction[] = [];
|
||||
fillInActions(groups, {primary, secondary}, false, (group: string) => group === undefined);
|
||||
fillInActions(groups, { primary, secondary }, false, (group: string) => group === undefined);
|
||||
|
||||
let taskbar = <HTMLElement>this.toolbar.nativeElement;
|
||||
this._actionBar = new Taskbar(taskbar, this.contextMenuService, { actionItemProvider: action => this.actionItemProvider(action as Action)});
|
||||
this._actionBar = new Taskbar(taskbar, this.contextMenuService, { actionItemProvider: action => this.actionItemProvider(action as Action) });
|
||||
this._actionBar.context = this;
|
||||
this._actionBar.setContent([
|
||||
{ element: kernelContainer },
|
||||
@@ -393,8 +389,8 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
promptForPath(defaultPath: string): TPromise<string> {
|
||||
return this.windowService.showSaveDialog({
|
||||
defaultPath: defaultPath,
|
||||
filters: [{ name: localize('notebookFile', 'Notebook'), extensions: ['ipynb']}]
|
||||
});
|
||||
filters: [{ name: localize('notebookFile', 'Notebook'), extensions: ['ipynb'] }]
|
||||
});
|
||||
}
|
||||
|
||||
// Entry point to save notebook
|
||||
@@ -409,12 +405,11 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
let resource = self._model.notebookUri;
|
||||
self._model.notebookUri = target;
|
||||
this.saveNotebook().then(result => {
|
||||
if(result)
|
||||
{
|
||||
if (result) {
|
||||
return this.replaceUntitledNotebookEditor(resource, target);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
});
|
||||
}
|
||||
return false; // User clicks cancel
|
||||
});
|
||||
@@ -459,7 +454,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
}
|
||||
|
||||
private setDirty(isDirty: boolean): void {
|
||||
if(this._notebookParams.input){
|
||||
if (this._notebookParams.input) {
|
||||
this._notebookParams.input.setDirty(isDirty);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user