diff --git a/src/sql/parts/admin/database/create/createDatabase.component.html b/src/sql/parts/admin/database/create/createDatabase.component.html deleted file mode 100644 index a3bad1441b..0000000000 --- a/src/sql/parts/admin/database/create/createDatabase.component.html +++ /dev/null @@ -1,132 +0,0 @@ - - -
- -
- -General - - - - - - - - - -
- Database name: - - -
- -{{databaseFilesLabel}} - - - - - -
- - - - - - - - -
- - - -
- -
- -
- -
- diff --git a/src/sql/parts/admin/database/create/createDatabase.component.ts b/src/sql/parts/admin/database/create/createDatabase.component.ts deleted file mode 100644 index d87463b5dc..0000000000 --- a/src/sql/parts/admin/database/create/createDatabase.component.ts +++ /dev/null @@ -1,95 +0,0 @@ -/*--------------------------------------------------------------------------------------------- -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Source EULA. See License.txt in the project root for license information. -*--------------------------------------------------------------------------------------------*/ - -import { ChangeDetectorRef, ElementRef, Component, forwardRef, Inject } from '@angular/core'; -import { NgForm } from '@angular/forms'; - -import { ITaskDialogComponentParams } from 'sql/services/bootstrap/bootstrapParams'; -import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo'; -import { IAdminService } from 'sql/workbench/services/admin/common/adminService'; -import { ITaskDialogComponent } from 'sql/parts/tasks/common/tasks'; - -import * as azdata from 'azdata'; -import * as nls from 'vs/nls'; - -export const CREATEDATABASE_SELECTOR: string = 'createdatabase-component'; - -export interface DatabaseFile { - logicalName: string; - fileType: string; - filegroup: string; - initialSize: string; - autogrow: string; - path: string; -} - -@Component({ - selector: CREATEDATABASE_SELECTOR, - templateUrl: decodeURI(require.toUrl('sql/parts/admin/database/create/createDatabase.component.html')) -}) -export class CreateDatabaseComponent implements ITaskDialogComponent { - - public formSubmitted: boolean = false; - - public ownerUri: string; - - public connection: ConnectionManagementInfo; - - public databaseFiles: DatabaseFile[] = []; - - // tslint:disable:no-unused-variable - private readonly databaseFilesLabel: string = nls.localize('createDatabase.databaseFiles', 'Database files:'); - private readonly noRecordsFoundLabel: string = nls.localize('createDatabase.noRecordsFound', 'No records found'); - // tslint:enable:no-unused-variable - - constructor( - @Inject(forwardRef(() => ElementRef)) private _el: ElementRef, - @Inject(forwardRef(() => ChangeDetectorRef)) private _changeDetectorRef: ChangeDetectorRef, - @Inject(IAdminService) private _adminService: IAdminService - ) { - } - - private getDatabaseInfo(form: NgForm): azdata.DatabaseInfo { - return { - options: { - name: form.value.databaseName, - owner: form.value.databaseOwner - } - }; - } - - public onSubmit(form: NgForm): void { - this._adminService.createDatabase(this.ownerUri, this.getDatabaseInfo(form)); - this.formSubmitted = true; - this._changeDetectorRef.detectChanges(); - } - - public onOk(): void { } - - public onGenerateScript(): void { } - - public onCancel(): void { } - - public onSelectOwner(): void { } - - public injectBootstapper(parameters: ITaskDialogComponentParams): void { - let self = this; - this.ownerUri = parameters.ownerUri; - this._adminService.getDefaultDatabaseInfo(this.ownerUri).then(dbInfo => { - let databaseFilesCount = dbInfo.options['databaseFilesCount']; - for (let i = 0; i < databaseFilesCount; ++i) { - self.databaseFiles[i] = { - logicalName: dbInfo.options['databaseFiles.' + i + '.name'], - fileType: dbInfo.options['databaseFiles.' + i + '.databaseFileType'], - filegroup: dbInfo.options['databaseFiles.' + i + '.fileGroup'], - initialSize: dbInfo.options['databaseFiles.' + i + '.initialSize'], - autogrow: dbInfo.options['databaseFiles.' + i + '.autogrowth'], - path: dbInfo.options['databaseFiles.' + i + '.folder'] - }; - } - self._changeDetectorRef.detectChanges(); - }); - } -} diff --git a/src/sql/parts/admin/security/createLogin.component.html b/src/sql/parts/admin/security/createLogin.component.html deleted file mode 100644 index 42096908d2..0000000000 --- a/src/sql/parts/admin/security/createLogin.component.html +++ /dev/null @@ -1,34 +0,0 @@ - - -

New Login

- -

General

- - - - - - - - - - -
- Login name: - - -
- Password: - - -
- -
-
- - diff --git a/src/sql/parts/admin/security/createLogin.component.ts b/src/sql/parts/admin/security/createLogin.component.ts deleted file mode 100644 index f876048fe5..0000000000 --- a/src/sql/parts/admin/security/createLogin.component.ts +++ /dev/null @@ -1,28 +0,0 @@ -/*--------------------------------------------------------------------------------------------- -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Source EULA. See License.txt in the project root for license information. -*--------------------------------------------------------------------------------------------*/ - -import { ElementRef, Component, Inject, forwardRef } from '@angular/core'; -import { IBootstrapParams } from 'sql/services/bootstrap/bootstrapService'; -import { IDashboardComponentParams } from 'sql/services/bootstrap/bootstrapParams'; -import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo'; - -export const CREATELOGIN_SELECTOR: string = 'createlogin-component'; - -@Component({ - selector: CREATELOGIN_SELECTOR, - templateUrl: decodeURI(require.toUrl('sql/parts/admin/security/createLogin.component.html')) -}) -export class CreateLoginComponent { - - public ownerUri: string; - - public connection: ConnectionManagementInfo; - - constructor( - @Inject(forwardRef(() => ElementRef)) private _el: ElementRef, - @Inject(IBootstrapParams) private _params: IDashboardComponentParams - ) { - } -} diff --git a/src/sql/parts/admin/security/createLogin.module.ts b/src/sql/parts/admin/security/createLogin.module.ts deleted file mode 100644 index bad681b912..0000000000 --- a/src/sql/parts/admin/security/createLogin.module.ts +++ /dev/null @@ -1,48 +0,0 @@ -/*--------------------------------------------------------------------------------------------- -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Source EULA. See License.txt in the project root for license information. -*--------------------------------------------------------------------------------------------*/ - -import { NgModule, Inject, forwardRef, ApplicationRef, ComponentFactoryResolver, Type } from '@angular/core'; -import { APP_BASE_HREF, CommonModule } from '@angular/common'; -import { BrowserModule } from '@angular/platform-browser'; - -import { IBootstrapParams, providerIterator } from 'sql/services/bootstrap/bootstrapService'; -import { CreateLoginComponent } from 'sql/parts/admin/security/createLogin.component'; - -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; - -// Connection Dashboard main angular module -export const CreateLoginModule = (params: IBootstrapParams, selector: string, instantiationService: IInstantiationService): Type => { - - @NgModule({ - declarations: [ - CreateLoginComponent - ], - entryComponents: [CreateLoginComponent], - imports: [ - CommonModule, - BrowserModule - ], - providers: [ - { provide: APP_BASE_HREF, useValue: '/' }, - { provide: IBootstrapParams, useValue: params }, - ...providerIterator(instantiationService) - ] - }) - class ModuleClass { - - constructor( - @Inject(forwardRef(() => ComponentFactoryResolver)) private _resolver: ComponentFactoryResolver - ) { - } - - ngDoBootstrap(appRef: ApplicationRef) { - const factory = this._resolver.resolveComponentFactory(CreateLoginComponent); - (factory).factory.selector = selector; - appRef.bootstrap(factory); - } - } - - return ModuleClass; -}; diff --git a/src/sql/parts/admin/security/createLoginEditor.ts b/src/sql/parts/admin/security/createLoginEditor.ts deleted file mode 100644 index d537591832..0000000000 --- a/src/sql/parts/admin/security/createLoginEditor.ts +++ /dev/null @@ -1,114 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import 'vs/css!sql/parts/query/editor/media/queryEditor'; -import * as DOM from 'vs/base/browser/dom'; -import { EditorOptions } from 'vs/workbench/common/editor'; -import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; -import { CreateLoginInput } from 'sql/parts/admin/security/createLoginInput'; -import { CreateLoginModule } from 'sql/parts/admin/security/createLogin.module'; -import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement'; -import { IMetadataService } from 'sql/platform/metadata/common/metadataService'; -import { IScriptingService } from 'sql/platform/scripting/common/scriptingService'; -import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService'; -import { bootstrapAngular, IBootstrapParams } from 'sql/services/bootstrap/bootstrapService'; -import { CREATELOGIN_SELECTOR } from 'sql/parts/admin/security/createLogin.component'; -import { CancellationToken } from 'vs/base/common/cancellation'; -import { IStorageService } from 'vs/platform/storage/common/storage'; - -export class CreateLoginEditor extends BaseEditor { - - public static ID: string = 'workbench.editor.createlogin'; - - constructor( - @ITelemetryService telemetryService: ITelemetryService, - @IThemeService themeService: IThemeService, - @IInstantiationService private instantiationService: IInstantiationService, - @IConnectionManagementService private _connectionService: IConnectionManagementService, - @IMetadataService private _metadataService: IMetadataService, - @IScriptingService private _scriptingService: IScriptingService, - @IQueryEditorService private _queryEditorService: IQueryEditorService, - @IStorageService storageService: IStorageService - ) { - super(CreateLoginEditor.ID, telemetryService, themeService, storageService); - } - - /** - * Called to create the editor in the parent element. - */ - public createEditor(parent: HTMLElement): void { - } - - /** - * Sets focus on this editor. Specifically, it sets the focus on the hosted text editor. - */ - public focus(): void { - } - - /** - * Updates the internal variable keeping track of the editor's size, and re-calculates the sash position. - * To be called when the container of this editor changes size. - */ - public layout(dimension: DOM.Dimension): void { - } - - public setInput(input: CreateLoginInput, options: EditorOptions): Promise { - if (this.input instanceof CreateLoginInput && this.input.matches(input)) { - return Promise.resolve(undefined); - } - - if (!input.hasInitialized) { - this.bootstrapAngular(input); - } - this.revealElementWithTagName(input.uniqueSelector, this.getContainer()); - - return super.setInput(input, options, CancellationToken.None); - } - - /** - * Reveal the child element with the given tagName and hide all other elements. - */ - private revealElementWithTagName(tagName: string, parent: HTMLElement): void { - let elementToReveal: HTMLElement; - - for (let i = 0; i < parent.children.length; i++) { - let child: HTMLElement = parent.children[i]; - if (child.tagName && child.tagName.toLowerCase() === tagName && !elementToReveal) { - elementToReveal = child; - } else { - child.style.display = 'none'; - } - } - - if (elementToReveal) { - elementToReveal.style.display = ''; - } - } - - /** - * Load the angular components and record for this input that we have done so - */ - private bootstrapAngular(input: CreateLoginInput): void { - - // Get the bootstrap params and perform the bootstrap - let params: IBootstrapParams = { - connection: input.getConnectionProfile(), - ownerUri: input.getUri() - }; - let uniqueSelector = bootstrapAngular(this.instantiationService, - CreateLoginModule, - this.getContainer(), - CREATELOGIN_SELECTOR, - params); - input.setUniqueSelector(uniqueSelector); - } - - public dispose(): void { - super.dispose(); - } -} diff --git a/src/sql/parts/admin/security/createLoginInput.ts b/src/sql/parts/admin/security/createLoginInput.ts deleted file mode 100644 index 1102e225cd..0000000000 --- a/src/sql/parts/admin/security/createLoginInput.ts +++ /dev/null @@ -1,56 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { EditorInput, EditorModel } from 'vs/workbench/common/editor'; -import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput'; -import { IConnectionProfile } from 'sql/platform/connection/common/interfaces'; - -export class CreateLoginInput extends EditorInput { - - public static ID: string = 'workbench.editorinputs.createlogininput'; - public static SCHEMA: string = 'adminlogincreate'; - - private _uniqueSelector: string; - - constructor(private _uri: string, private _connection: IConnectionProfile) { - super(); - } - - public setUniqueSelector(uniqueSelector: string): void { - this._uniqueSelector = uniqueSelector; - } - - public getTypeId(): string { - return UntitledEditorInput.ID; - } - - public getName(): string { - return this._connection.serverName + ':' + this._connection.databaseName; - } - - public getUri(): string { - return this._uri; - } - - public supportsSplitEditor(): boolean { - return false; - } - - public getConnectionProfile(): IConnectionProfile { - return this._connection; - } - - public resolve(refresh?: boolean): Promise { - return undefined; - } - - public get hasInitialized(): boolean { - return !!this._uniqueSelector; - } - - public get uniqueSelector(): string { - return this._uniqueSelector; - } -} diff --git a/src/sql/parts/tasks/common/tasks.contribution.ts b/src/sql/parts/tasks/common/tasks.contribution.ts deleted file mode 100644 index 5d13114303..0000000000 --- a/src/sql/parts/tasks/common/tasks.contribution.ts +++ /dev/null @@ -1,32 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { IEditorRegistry, Extensions as EditorExtensions, EditorDescriptor } from 'vs/workbench/browser/editor'; -import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; -import { Registry } from 'vs/platform/registry/common/platform'; -import { TaskDialogEditor } from 'sql/parts/tasks/dialog/taskDialogEditor'; -import { TaskDialogInput } from 'sql/parts/tasks/dialog/taskDialogInput'; -import { CreateLoginEditor } from 'sql/parts/admin/security/createLoginEditor'; -import { CreateLoginInput } from 'sql/parts/admin/security/createLoginInput'; - -// Task Dialog registration -const taskDialogEditorDescriptor = new EditorDescriptor( - TaskDialogEditor, - TaskDialogEditor.ID, - 'Task Dialog' -); - -// Create Login registration -const createLoginEditorDescriptor = new EditorDescriptor( - CreateLoginEditor, - CreateLoginEditor.ID, - 'CreateLogin' -); - -Registry.as(EditorExtensions.Editors) - .registerEditor(createLoginEditorDescriptor, [new SyncDescriptor(CreateLoginInput)]); - -Registry.as(EditorExtensions.Editors) - .registerEditor(taskDialogEditorDescriptor, [new SyncDescriptor(TaskDialogInput)]); \ No newline at end of file diff --git a/src/sql/parts/tasks/common/tasks.ts b/src/sql/parts/tasks/common/tasks.ts deleted file mode 100644 index 4601e56121..0000000000 --- a/src/sql/parts/tasks/common/tasks.ts +++ /dev/null @@ -1,18 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { ITaskDialogComponentParams } from 'sql/services/bootstrap/bootstrapParams'; -/** - * Interface for task dialog component events - */ -export interface ITaskDialogComponent { - onOk(): void; - - onGenerateScript(): void; - - onCancel(): void; - - injectBootstapper(parameters: ITaskDialogComponentParams ): void; -} diff --git a/src/sql/parts/tasks/dialog/taskDialog.component.html b/src/sql/parts/tasks/dialog/taskDialog.component.html deleted file mode 100644 index 5efde3d263..0000000000 --- a/src/sql/parts/tasks/dialog/taskDialog.component.html +++ /dev/null @@ -1,10 +0,0 @@ - - -
- -
diff --git a/src/sql/parts/tasks/dialog/taskDialog.component.ts b/src/sql/parts/tasks/dialog/taskDialog.component.ts deleted file mode 100644 index f18e11b3bf..0000000000 --- a/src/sql/parts/tasks/dialog/taskDialog.component.ts +++ /dev/null @@ -1,47 +0,0 @@ -/*--------------------------------------------------------------------------------------------- -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Source EULA. See License.txt in the project root for license information. -*--------------------------------------------------------------------------------------------*/ - -import { ConnectionManagementInfo } from 'sql/platform/connection/common/connectionManagementInfo'; -import { ITaskDialogComponent } from 'sql/parts/tasks/common/tasks'; -import { ITaskDialogComponentParams } from 'sql/services/bootstrap/bootstrapParams'; -import { ElementRef, Component, Inject, forwardRef } from '@angular/core'; -import { IBootstrapParams } from 'sql/services/bootstrap/bootstrapService'; - -export const TASKDIALOG_SELECTOR: string = 'taskdialog-component'; - -@Component({ - selector: TASKDIALOG_SELECTOR, - templateUrl: decodeURI(require.toUrl('sql/parts/tasks/dialog/taskDialog.component.html')), -}) -export class TaskDialogComponent { - - private _currentComponent: ITaskDialogComponent; - - public ownerUri: string; - - public connection: ConnectionManagementInfo; - - constructor( - @Inject(forwardRef(() => ElementRef)) private _el: ElementRef, - @Inject(IBootstrapParams) private _parameters: ITaskDialogComponentParams - ) { - this.ownerUri = this._parameters.ownerUri; - - } - - public onActivate(component: any) { - // validate the component implements ITaskDialogComponent (or at least part of the interface) - if ((component).onOk) { - this._currentComponent = component; - this._currentComponent.injectBootstapper(this._parameters); - } else { - this._currentComponent = undefined; - } - } - - public onDeactivate(component: any) { - - } -} diff --git a/src/sql/parts/tasks/dialog/taskDialog.module.ts b/src/sql/parts/tasks/dialog/taskDialog.module.ts deleted file mode 100644 index 0f66ec00df..0000000000 --- a/src/sql/parts/tasks/dialog/taskDialog.module.ts +++ /dev/null @@ -1,68 +0,0 @@ -/*--------------------------------------------------------------------------------------------- -* Copyright (c) Microsoft Corporation. All rights reserved. -* Licensed under the Source EULA. See License.txt in the project root for license information. -*--------------------------------------------------------------------------------------------*/ - -import { Routes, RouterModule } from '@angular/router'; -import { - ApplicationRef, ComponentFactoryResolver, ModuleWithProviders, NgModule, - Inject, forwardRef, Type -} from '@angular/core'; -import { APP_BASE_HREF, CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { BrowserModule } from '@angular/platform-browser'; - -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; - -import { TaskDialogComponent } from 'sql/parts/tasks/dialog/taskDialog.component'; -import { CreateDatabaseComponent } from 'sql/parts/admin/database/create/createDatabase.component'; -import { IBootstrapParams, ISelector, providerIterator } from 'sql/services/bootstrap/bootstrapService'; - -// Setup routes for various child components -const appRoutes: Routes = [ - { path: 'create-database', component: CreateDatabaseComponent }, - { - path: '', - redirectTo: '/create-database', - pathMatch: 'full' - }, - { path: '**', component: CreateDatabaseComponent } -]; - -export const TaskDialogModule = (params: IBootstrapParams, selector: string, instantiationService: IInstantiationService): Type => { - @NgModule({ - declarations: [ - TaskDialogComponent, - CreateDatabaseComponent - ], - entryComponents: [TaskDialogComponent], - imports: [ - FormsModule, - CommonModule, - BrowserModule, - RouterModule.forRoot(appRoutes) - ], - providers: [ - { provide: APP_BASE_HREF, useValue: '/' }, - { provide: IBootstrapParams, useValue: params }, - { provide: ISelector, useValue: selector }, - ...providerIterator(instantiationService) - ] - }) - class ModuleClass { - - constructor( - @Inject(forwardRef(() => ComponentFactoryResolver)) private _resolver: ComponentFactoryResolver, - @Inject(ISelector) private selector: string - ) { - } - - ngDoBootstrap(appRef: ApplicationRef) { - const factory = this._resolver.resolveComponentFactory(TaskDialogComponent); - (factory).factory.selector = this.selector; - appRef.bootstrap(factory); - } - } - - return ModuleClass; -}; diff --git a/src/sql/parts/tasks/dialog/taskDialogEditor.ts b/src/sql/parts/tasks/dialog/taskDialogEditor.ts deleted file mode 100644 index 79c44abacc..0000000000 --- a/src/sql/parts/tasks/dialog/taskDialogEditor.ts +++ /dev/null @@ -1,108 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import 'vs/css!sql/parts/query/editor/media/queryEditor'; - -import { Dimension } from 'vs/base/browser/dom'; -import { EditorOptions } from 'vs/workbench/common/editor'; -import { BaseEditor } from 'vs/workbench/browser/parts/editor/baseEditor'; -import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; -import { IThemeService } from 'vs/platform/theme/common/themeService'; -import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; - -import { TaskDialogInput } from './taskDialogInput'; -import { ITaskDialogComponentParams } from 'sql/services/bootstrap/bootstrapParams'; -import { TaskDialogModule } from 'sql/parts/tasks/dialog/taskDialog.module'; -import { TASKDIALOG_SELECTOR } from 'sql/parts/tasks/dialog/taskDialog.component'; -import { bootstrapAngular } from 'sql/services/bootstrap/bootstrapService'; -import { CancellationToken } from 'vs/base/common/cancellation'; -import { IStorageService } from 'vs/platform/storage/common/storage'; - -export class TaskDialogEditor extends BaseEditor { - - public static ID: string = 'workbench.editor.taskdialog'; - - constructor( - @ITelemetryService telemetryService: ITelemetryService, - @IThemeService themeService: IThemeService, - @IInstantiationService private instantiationService: IInstantiationService, - @IStorageService storageService: IStorageService - ) { - super(TaskDialogEditor.ID, telemetryService, themeService, storageService); - } - - /** - * Called to create the editor in the parent element. - */ - public createEditor(parent: HTMLElement): void { - } - - /** - * Sets focus on this editor. Specifically, it sets the focus on the hosted text editor. - */ - public focus(): void { - } - - /** - * Updates the internal variable keeping track of the editor's size, and re-calculates the sash position. - * To be called when the container of this editor changes size. - */ - public layout(dimension: Dimension): void { - } - - public setInput(input: TaskDialogInput, options: EditorOptions): Promise { - if (this.input instanceof TaskDialogInput && this.input.matches(input)) { - return Promise.resolve(undefined); - } - - if (!input.hasInitialized) { - this.bootstrapAngular(input); - } - this.revealElementWithTagName(input.uniqueSelector, this.getContainer()); - - return super.setInput(input, options, CancellationToken.None); - } - - /** - * Reveal the child element with the given tagName and hide all other elements. - */ - private revealElementWithTagName(tagName: string, parent: HTMLElement): void { - let elementToReveal: HTMLElement; - - for (let i = 0; i < parent.children.length; i++) { - let child: HTMLElement = parent.children[i]; - if (child.tagName && child.tagName.toLowerCase() === tagName && !elementToReveal) { - elementToReveal = child; - } else { - child.style.display = 'none'; - } - } - - if (elementToReveal) { - elementToReveal.style.display = ''; - } - } - - /** - * Load the angular components and record for this input that we have done so - */ - private bootstrapAngular(input: TaskDialogInput): void { - - // Get the bootstrap params and perform the bootstrap - let params: ITaskDialogComponentParams = { - ownerUri: input.getUri() - }; - let uniqueSelector = bootstrapAngular(this.instantiationService, - TaskDialogModule, - this.getContainer(), - TASKDIALOG_SELECTOR, - params); - input.setUniqueSelector(uniqueSelector); - } - - public dispose(): void { - super.dispose(); - } -} diff --git a/src/sql/parts/tasks/dialog/taskDialogInput.ts b/src/sql/parts/tasks/dialog/taskDialogInput.ts deleted file mode 100644 index 72da8c2ac1..0000000000 --- a/src/sql/parts/tasks/dialog/taskDialogInput.ts +++ /dev/null @@ -1,56 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { EditorInput, EditorModel } from 'vs/workbench/common/editor'; -import { UntitledEditorInput } from 'vs/workbench/common/editor/untitledEditorInput'; -import { IConnectionProfile } from 'sql/platform/connection/common/interfaces'; - -export class TaskDialogInput extends EditorInput { - - public static ID: string = 'workbench.editorinputs.taskdialoginputs'; - public static SCHEMA: string = 'taskdialog'; - - private _uniqueSelector: string; - - constructor(private _uri: string, private _connection: IConnectionProfile) { - super(); - } - - public setUniqueSelector(uniqueSelector: string): void { - this._uniqueSelector = uniqueSelector; - } - - public getTypeId(): string { - return UntitledEditorInput.ID; - } - - public getName(): string { - return this._connection.serverName + ':' + this._connection.databaseName; - } - - public getUri(): string { - return this._uri; - } - - public supportsSplitEditor(): boolean { - return false; - } - - public getConnectionProfile(): IConnectionProfile { - return this._connection; - } - - public resolve(refresh?: boolean): Promise { - return undefined; - } - - public get hasInitialized(): boolean { - return !!this._uniqueSelector; - } - - public get uniqueSelector(): string { - return this._uniqueSelector; - } -} diff --git a/src/sql/platform/tasks/common/tasks.ts b/src/sql/platform/tasks/common/tasks.ts index afe6e20fd5..5e8ecf4a9a 100644 --- a/src/sql/platform/tasks/common/tasks.ts +++ b/src/sql/platform/tasks/common/tasks.ts @@ -2,6 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ + import { IConnectionProfile } from 'sql/platform/connection/common/interfaces'; import * as types from 'vs/base/common/types'; diff --git a/src/sql/workbench/common/actions.contribution.ts b/src/sql/workbench/common/actions.contribution.ts index 147c6e4622..ecb456b9c2 100644 --- a/src/sql/workbench/common/actions.contribution.ts +++ b/src/sql/workbench/common/actions.contribution.ts @@ -2,18 +2,15 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { TaskRegistry } from 'sql/platform/tasks/common/tasks'; + import * as Actions from './actions'; -import { IJSONSchema } from 'vs/base/common/jsonSchema'; import * as nls from 'vs/nls'; import { SyncActionDescriptor } from 'vs/platform/actions/common/actions'; import { Registry } from 'vs/platform/registry/common/platform'; import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions'; -import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions'; import { ShowCurrentReleaseNotesAction } from 'sql/workbench/update/releaseNotes'; -import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle'; import { IConfigurationRegistry, Extensions as ConfigExtensions } from 'vs/platform/configuration/common/configurationRegistry'; new Actions.BackupAction().registerTask(); @@ -49,4 +46,4 @@ Registry.as(ConfigExtensions.Configuration).registerConf 'description': nls.localize('showConnectDialogOnStartup', 'Show connect dialog on startup') } } -}); \ No newline at end of file +}); diff --git a/src/sql/workbench/common/actions.ts b/src/sql/workbench/common/actions.ts index 9cf5bf9777..a0adf2d228 100644 --- a/src/sql/workbench/common/actions.ts +++ b/src/sql/workbench/common/actions.ts @@ -12,7 +12,6 @@ import { IScriptingService } from 'sql/platform/scripting/common/scriptingServic import { IRestoreDialogController } from 'sql/platform/restore/common/restoreService'; import { IAngularEventingService, AngularEventType } from 'sql/platform/angularEventing/common/angularEventingService'; import { IInsightsDialogService } from 'sql/workbench/services/insights/common/insightsDialogService'; -import { IAdminService } from 'sql/workbench/services/admin/common/adminService'; import * as Constants from 'sql/common/constants'; import { Task } from 'sql/platform/tasks/common/tasks'; import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService'; @@ -58,22 +57,13 @@ export class NewQueryAction extends Task { } public runTask(accessor: ServicesAccessor, profile: IConnectionProfile): Promise { - return new Promise((resolve, reject) => { - TaskUtilities.newQuery( - profile, - accessor.get(IConnectionManagementService), - accessor.get(IQueryEditorService), - accessor.get(IObjectExplorerService), - accessor.get(IEditorService) - ).then( - result => { - resolve(void 0); - }, - error => { - resolve(void 0); - } - ); - }); + return TaskUtilities.newQuery( + profile, + accessor.get(IConnectionManagementService), + accessor.get(IQueryEditorService), + accessor.get(IObjectExplorerService), + accessor.get(IEditorService) + ).then(); } } @@ -91,21 +81,13 @@ export class ScriptSelectAction extends Action { } public run(actionContext: BaseActionContext): Promise { - return new Promise((resolve, reject) => { - TaskUtilities.scriptSelect( - actionContext.profile, - actionContext.object, - this._connectionManagementService, - this._queryEditorService, - this._scriptingService - ).then( - result => { - resolve(true); - }, - error => { - resolve(false); - }); - }); + return TaskUtilities.scriptSelect( + actionContext.profile, + actionContext.object, + this._connectionManagementService, + this._queryEditorService, + this._scriptingService + ).then(() => true); } } @@ -124,24 +106,15 @@ export class ScriptExecuteAction extends Action { } public run(actionContext: BaseActionContext): Promise { - return new Promise((resolve, reject) => { - TaskUtilities.script( - actionContext.profile, - actionContext.object, - this._connectionManagementService, - this._queryEditorService, - this._scriptingService, - TaskUtilities.ScriptOperation.Execute, - this._errorMessageService - ).then( - result => { - resolve(true); - }, - error => { - resolve(false); - } - ); - }); + return TaskUtilities.script( + actionContext.profile, + actionContext.object, + this._connectionManagementService, + this._queryEditorService, + this._scriptingService, + TaskUtilities.ScriptOperation.Execute, + this._errorMessageService + ).then(() => true); } } @@ -160,24 +133,15 @@ export class ScriptAlterAction extends Action { } public run(actionContext: BaseActionContext): Promise { - return new Promise((resolve, reject) => { - TaskUtilities.script( - actionContext.profile, - actionContext.object, - this._connectionManagementService, - this._queryEditorService, - this._scriptingService, - TaskUtilities.ScriptOperation.Alter, - this._errorMessageService - ).then( - result => { - resolve(true); - }, - error => { - resolve(false); - } - ); - }); + return TaskUtilities.script( + actionContext.profile, + actionContext.object, + this._connectionManagementService, + this._queryEditorService, + this._scriptingService, + TaskUtilities.ScriptOperation.Alter, + this._errorMessageService + ).then(() => true); } } @@ -195,22 +159,13 @@ export class EditDataAction extends Action { } public run(actionContext: BaseActionContext): Promise { - return new Promise((resolve, reject) => { - TaskUtilities.scriptEditSelect( - actionContext.profile, - actionContext.object, - this._connectionManagementService, - this._queryEditorService, - this._scriptingService - ).then( - result => { - resolve(true); - }, - error => { - resolve(false); - } - ); - }); + return TaskUtilities.scriptEditSelect( + actionContext.profile, + actionContext.object, + this._connectionManagementService, + this._queryEditorService, + this._scriptingService + ).then(() => true); } } @@ -229,24 +184,15 @@ export class ScriptCreateAction extends Action { } public run(actionContext: BaseActionContext): Promise { - return new Promise((resolve, reject) => { - TaskUtilities.script( - actionContext.profile, - actionContext.object, - this._connectionManagementService, - this._queryEditorService, - this._scriptingService, - TaskUtilities.ScriptOperation.Create, - this._errorMessageService - ).then( - result => { - resolve(true); - }, - error => { - resolve(false); - } - ); - }); + return TaskUtilities.script( + actionContext.profile, + actionContext.object, + this._connectionManagementService, + this._queryEditorService, + this._scriptingService, + TaskUtilities.ScriptOperation.Create, + this._errorMessageService + ).then(() => true); } } @@ -265,24 +211,15 @@ export class ScriptDeleteAction extends Action { } public run(actionContext: BaseActionContext): Promise { - return new Promise((resolve, reject) => { - TaskUtilities.script( - actionContext.profile, - actionContext.object, - this._connectionManagementService, - this._queryEditorService, - this._scriptingService, - TaskUtilities.ScriptOperation.Delete, - this._errorMessageService - ).then( - result => { - resolve(true); - }, - error => { - resolve(false); - } - ); - }); + return TaskUtilities.script( + actionContext.profile, + actionContext.object, + this._connectionManagementService, + this._queryEditorService, + this._scriptingService, + TaskUtilities.ScriptOperation.Delete, + this._errorMessageService + ).then(() => true); } } @@ -300,7 +237,7 @@ export class BackupAction extends Task { }); } - runTask(accessor: ServicesAccessor, profile: IConnectionProfile): Promise { + runTask(accessor: ServicesAccessor, profile: IConnectionProfile): void | Promise { if (!profile) { let objectExplorerService = accessor.get(IObjectExplorerService); let connectionManagementService = accessor.get(IConnectionManagementService); @@ -310,24 +247,13 @@ export class BackupAction extends Task { let configurationService = accessor.get(IConfigurationService); let previewFeaturesEnabled: boolean = configurationService.getValue('workbench')['enablePreviewFeatures']; if (!previewFeaturesEnabled) { - return new Promise((resolve, reject) => { - accessor.get(INotificationService).info(nls.localize('backup.isPreviewFeature', 'You must enable preview features in order to use backup')); - }); + return accessor.get(INotificationService).info(nls.localize('backup.isPreviewFeature', 'You must enable preview features in order to use backup')); } - return new Promise((resolve, reject) => { - TaskUtilities.showBackup( - profile, - accessor.get(IBackupUiService) - ).then( - result => { - resolve(void 0); - }, - error => { - resolve(void 0); - } - ); - }); + TaskUtilities.showBackup( + profile, + accessor.get(IBackupUiService) + ).then(); } } @@ -345,28 +271,17 @@ export class RestoreAction extends Task { }); } - runTask(accessor: ServicesAccessor, profile: IConnectionProfile): Promise { + runTask(accessor: ServicesAccessor, profile: IConnectionProfile): void | Promise { let configurationService = accessor.get(IConfigurationService); let previewFeaturesEnabled: boolean = configurationService.getValue('workbench')['enablePreviewFeatures']; if (!previewFeaturesEnabled) { - return new Promise((resolve, reject) => { - accessor.get(INotificationService).info(nls.localize('restore.isPreviewFeature', 'You must enable preview features in order to use restore')); - }); + return accessor.get(INotificationService).info(nls.localize('restore.isPreviewFeature', 'You must enable preview features in order to use restore')); } - return new Promise((resolve, reject) => { - TaskUtilities.showRestore( - profile, - accessor.get(IRestoreDialogController) - ).then( - result => { - resolve(void 0); - }, - error => { - resolve(void 0); - } - ); - }); + TaskUtilities.showRestore( + profile, + accessor.get(IRestoreDialogController) + ).then(); } } @@ -383,18 +298,12 @@ export class ManageAction extends Action { } run(actionContext: ManageActionContext): Promise { - let self = this; - return new Promise((resolve, reject) => { - self._connectionManagementService.connect(actionContext.profile, actionContext.uri, { showDashboard: true, saveTheConnection: false, params: undefined, showConnectionDialogOnError: false, showFirewallRuleOnError: true }).then( - () => { - self._angularEventingService.sendAngularEvent(actionContext.uri, AngularEventType.NAV_DATABASE); - resolve(true); - }, - error => { - resolve(error); - } - ); - }); + return this._connectionManagementService.connect(actionContext.profile, actionContext.uri, { showDashboard: true, saveTheConnection: false, params: undefined, showConnectionDialogOnError: false, showFirewallRuleOnError: true }).then( + () => { + this._angularEventingService.sendAngularEvent(actionContext.uri, AngularEventType.NAV_DATABASE); + return true; + } + ); } } @@ -410,31 +319,8 @@ export class InsightAction extends Action { } run(actionContext: InsightActionContext): Promise { - let self = this; - return new Promise((resolve, reject) => { - self._insightsDialogService.show(actionContext.insight, actionContext.profile); - resolve(true); - }); - } -} - -export class NewDatabaseAction extends Action { - public static ID = 'newDatabase'; - public static LABEL = nls.localize('newDatabase', 'New Database'); - public static ICON = 'new-database'; - - constructor( - id: string, label: string, icon: string, - @IAdminService private _adminService: IAdminService, - @IErrorMessageService private _errorMessageService: IErrorMessageService, - ) { - super(id, label, icon); - } - - run(actionContext: BaseActionContext): Promise { - return new Promise((resolve, reject) => { - TaskUtilities.showCreateDatabase(actionContext.profile, this._adminService, this._errorMessageService); - }); + this._insightsDialogService.show(actionContext.insight, actionContext.profile); + return Promise.resolve(true); } } @@ -454,12 +340,6 @@ export class ConfigureDashboardAction extends Task { } runTask(accessor: ServicesAccessor): Promise { - return new Promise((resolve, reject) => { - accessor.get(IWindowsService).openExternal(ConfigureDashboardAction.configHelpUri).then((result) => { - resolve(void 0); - }, err => { - resolve(void 0); - }); - }); + return accessor.get(IWindowsService).openExternal(ConfigureDashboardAction.configHelpUri).then(); } } diff --git a/src/sql/workbench/common/sqlWorkbenchUtils.ts b/src/sql/workbench/common/sqlWorkbenchUtils.ts index 224efb6076..8ef709c73d 100644 --- a/src/sql/workbench/common/sqlWorkbenchUtils.ts +++ b/src/sql/workbench/common/sqlWorkbenchUtils.ts @@ -2,7 +2,6 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; import ConnectionConstants = require('sql/platform/connection/common/constants'); import { QueryInput } from 'sql/parts/query/common/queryInput'; diff --git a/src/sql/workbench/common/taskUtilities.ts b/src/sql/workbench/common/taskUtilities.ts index 7803214dab..7f6a27c781 100644 --- a/src/sql/workbench/common/taskUtilities.ts +++ b/src/sql/workbench/common/taskUtilities.ts @@ -2,7 +2,6 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; import * as os from 'os'; @@ -15,7 +14,6 @@ import { import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService'; import { IScriptingService } from 'sql/platform/scripting/common/scriptingService'; import { EditDataInput } from 'sql/parts/editData/common/editDataInput'; -import { IAdminService } from 'sql/workbench/services/admin/common/adminService'; import { IRestoreDialogController } from 'sql/platform/restore/common/restoreService'; import { IInsightsConfig } from 'sql/workbench/parts/dashboard/widgets/insights/interfaces'; import { IInsightsDialogService } from 'sql/workbench/services/insights/common/insightsDialogService'; @@ -57,31 +55,6 @@ const targetDatabaseEngineEditionMap = { 7: 'SqlServerStretchEdition' }; -// map for object types for scripting -const objectScriptMap = { - Table: 'Table', - View: 'View', - StoredProcedure: 'Procedure', - UserDefinedFunction: 'Function', - UserDefinedDataType: 'Type', - User: 'User', - Default: 'Default', - Rule: 'Rule', - DatabaseRole: 'Role', - ApplicationRole: 'Application Role', - SqlAssembly: 'Assembly', - DdlTrigger: 'Trigger', - Synonym: 'Synonym', - XmlSchemaCollection: 'Xml Schema Collection', - Schema: 'Schema', - PlanGuide: 'sp_create_plan_guide', - UserDefinedType: 'Type', - UserDefinedAggregate: 'Aggregate', - FullTextCatalog: 'Fulltext Catalog', - UserDefinedTableType: 'Type', - MaterializedView: 'Materialized View' -}; - export enum ScriptOperation { Select = 0, Create = 1, @@ -111,31 +84,6 @@ export function GetScriptOperationName(operation: ScriptOperation) { } } -export function connectIfNotAlreadyConnected(connectionProfile: IConnectionProfile, connectionService: IConnectionManagementService): Promise { - return new Promise((resolve, reject) => { - let connectionID = connectionService.getConnectionUri(connectionProfile); - let uri: string = connectionService.getFormattedUri(connectionID, connectionProfile); - if (!connectionService.isConnected(uri)) { - let options: IConnectionCompletionOptions = { - params: { connectionType: ConnectionType.editor, runQueryOnCompletion: RunQueryOnConnectionMode.executeQuery, input: undefined }, - saveTheConnection: false, - showDashboard: false, - showConnectionDialogOnError: false, - showFirewallRuleOnError: true - }; - connectionService.connect(connectionProfile, uri, options).then(() => { - setTimeout(function () { - resolve(); - }, 2000); - }).catch(connectionError => { - reject(connectionError); - }); - } else { - resolve(); - } - }); -} - /** * Select the top rows from an object */ @@ -223,7 +171,7 @@ export function script(connectionProfile: IConnectionProfile, metadata: azdata.O let script: string = result.script; if (script) { - let description = (metadata.schema && metadata.schema !== '') ? `${metadata.schema}.${metadata.name}` : metadata.name; + let description = (metadata.schema && metadata.schema !== '') ? `${metadata.schema}.${metadata.name}` : metadata.name; queryEditorService.newSqlEditor(script, connectionProfile.providerName, undefined, description).then((owner) => { // Connect our editor to the input connection let options: IConnectionCompletionOptions = { @@ -336,27 +284,6 @@ export function replaceConnection(oldUri: string, newUri: string, connectionServ }); } -export function showCreateDatabase( - connection: IConnectionProfile, - adminService: IAdminService, - errorMessageService: IErrorMessageService): Promise { - - return new Promise((resolve) => { - // show not implemented - errorMessageService.showDialog(Severity.Info, - 'Coming Soon', - 'This feature is not yet implemented. It will be available in an upcoming release.'); - - // adminService.showCreateDatabaseWizard(uri, connection); - }); -} - -export function showCreateLogin(uri: string, connection: IConnectionProfile, adminService: IAdminService): Promise { - return new Promise((resolve) => { - adminService.showCreateLoginWizard(uri, connection); - }); -} - export function showBackup(connection: IConnectionProfile, backupUiService: IBackupUiService): Promise { return new Promise((resolve) => { backupUiService.showBackup(connection).then(() => { @@ -418,26 +345,6 @@ export function getCurrentGlobalConnection(objectExplorerService: IObjectExplore return connection; } -/* Helper Methods */ -function getStartPos(script: string, operation: ScriptOperation, typeName: string): number { - let objectTypeName = objectScriptMap[typeName]; - if (objectTypeName && script) { - let scriptTypeName = objectTypeName.toLowerCase(); - switch (operation) { - case (ScriptOperation.Create): - return script.toLowerCase().indexOf(`create ${scriptTypeName}`); - case (ScriptOperation.Delete): - return script.toLowerCase().indexOf(`drop ${scriptTypeName}`); - default: - /* script wasn't found for that object */ - return -1; - } - } else { - return -1; - } -} - - function getScriptingParamDetails(connectionService: IConnectionManagementService, ownerUri: string, metadata: azdata.ObjectMetadata): azdata.ScriptingParamDetails { let serverInfo: azdata.ServerInfo = getServerInfo(connectionService, ownerUri); let paramDetails: azdata.ScriptingParamDetails = { diff --git a/src/sql/workbench/common/workspaceActions.ts b/src/sql/workbench/common/workspaceActions.ts index 8a7b452092..840feae7f5 100644 --- a/src/sql/workbench/common/workspaceActions.ts +++ b/src/sql/workbench/common/workspaceActions.ts @@ -1,3 +1,8 @@ +/*--------------------------------------------------------------------------------------------- + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the Source EULA. See License.txt in the project root for license information. + *--------------------------------------------------------------------------------------------*/ + import { Action } from 'vs/base/common/actions'; import { IWindowsService } from 'vs/platform/windows/common/windows'; import { URI } from 'vs/base/common/uri'; diff --git a/src/sql/workbench/services/admin/common/adminService.ts b/src/sql/workbench/services/admin/common/adminService.ts index 7119627c7c..2c570ddfac 100644 --- a/src/sql/workbench/services/admin/common/adminService.ts +++ b/src/sql/workbench/services/admin/common/adminService.ts @@ -2,19 +2,13 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -'use strict'; import { localize } from 'vs/nls'; export const SERVICE_ID = 'adminService'; -import { IInstantiationService, createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement'; -import { CreateLoginInput } from 'sql/parts/admin/security/createLoginInput'; -import { TaskDialogInput } from 'sql/parts/tasks/dialog/taskDialogInput'; - -import { IEditorService, ACTIVE_GROUP } from 'vs/workbench/services/editor/common/editorService'; -import { IConnectionProfile } from 'sql/platform/connection/common/interfaces'; import * as azdata from 'azdata'; @@ -25,12 +19,6 @@ export interface IAdminService { registerProvider(providerId: string, provider: azdata.AdminServicesProvider): void; - showCreateDatabaseWizard(uri: string, connection: IConnectionProfile): Promise; - - showCreateLoginWizard(uri: string, connection: IConnectionProfile): Promise; - - createDatabase(connectionUri: string, database: azdata.DatabaseInfo): Thenable; - getDefaultDatabaseInfo(connectionUri: string): Thenable; getDatabaseInfo(connectionUri: string): Thenable; @@ -42,8 +30,6 @@ export class AdminService implements IAdminService { private _providers: { [handle: string]: azdata.AdminServicesProvider; } = Object.create(null); constructor( - @IInstantiationService private _instantiationService: IInstantiationService, - @IEditorService private _editorService: IEditorService, @IConnectionManagementService private _connectionService: IConnectionManagementService ) { } @@ -62,49 +48,6 @@ export class AdminService implements IAdminService { } } - public showCreateDatabaseWizard(uri: string, connection: IConnectionProfile): Promise { - const self = this; - return new Promise((resolve, reject) => { - let input: TaskDialogInput = self._instantiationService ? self._instantiationService.createInstance(TaskDialogInput, uri, connection) : undefined; - self._editorService.openEditor(input, { pinned: true }, ACTIVE_GROUP); - resolve(true); - }); - } - - public createDatabase(connectionUri: string, database: azdata.DatabaseInfo): Thenable { - let providerId: string = this._connectionService.getProviderIdFromUri(connectionUri); - if (providerId) { - let provider = this._providers[providerId]; - if (provider) { - return provider.createDatabase(connectionUri, database); - } - } - - return Promise.resolve(undefined); - } - - public showCreateLoginWizard(uri: string, connection: IConnectionProfile): Promise { - const self = this; - self.createLogin(uri, { name: 'TEST: login name' }); - - return new Promise((resolve, reject) => { - let loginInput: CreateLoginInput = self._instantiationService ? self._instantiationService.createInstance(CreateLoginInput, uri, connection) : undefined; - self._editorService.openEditor(loginInput, { pinned: true }, ACTIVE_GROUP); - resolve(true); - }); - } - - public createLogin(connectionUri: string, login: azdata.LoginInfo): Thenable { - let providerId: string = this._connectionService.getProviderIdFromUri(connectionUri); - if (providerId) { - let provider = this._providers[providerId]; - if (provider) { - return provider.createLogin(connectionUri, login); - } - } - return Promise.resolve(undefined); - } - public getDefaultDatabaseInfo(connectionUri: string): Thenable { let providerId: string = this._connectionService.getProviderIdFromUri(connectionUri); if (providerId) { diff --git a/src/sqltest/parts/admin/adminService.test.ts b/src/sqltest/parts/admin/adminService.test.ts deleted file mode 100644 index 55924f9c35..0000000000 --- a/src/sqltest/parts/admin/adminService.test.ts +++ /dev/null @@ -1,26 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -'use strict'; - -import { AdminService } from 'sql/workbench/services/admin/common/adminService'; - -suite('SQL AdminService tests', () => { - - let adminService: AdminService; - setup(() => { - adminService = new AdminService( - undefined, undefined, undefined - ); - }); - - test('createDatabase should call tools service provider', done => { - done(); - // adminService.createDatabase(undefined, undefined).then((result) => { - // assert.notEqual(result, undefined, 'Result is undefined'); - // done(); - // }); - }); -}); \ No newline at end of file diff --git a/src/vs/workbench/workbench.main.ts b/src/vs/workbench/workbench.main.ts index 1eeed31b72..28693c70bc 100644 --- a/src/vs/workbench/workbench.main.ts +++ b/src/vs/workbench/workbench.main.ts @@ -433,7 +433,6 @@ import 'vs/workbench/contrib/issue/electron-browser/issue.contribution'; // SQL import 'sql/parts/taskHistory/common/taskHistory.contribution'; import 'sql/parts/taskHistory/viewlet/taskHistoryViewlet'; -import 'sql/parts/tasks/common/tasks.contribution'; // data explorer import 'sql/workbench/parts/dataExplorer/browser/dataExplorer.contribution';