From ac8a926a70613d5657886a276b4518372e362577 Mon Sep 17 00:00:00 2001 From: Anthony Dresser Date: Tue, 5 Jun 2018 11:38:00 -0700 Subject: [PATCH] added progress indication for database navigation in dashboard (#1529) --- .../widgets/explorer/explorerTree.ts | 27 ++++++++++++++++--- .../explorer/explorerWidget.component.ts | 3 ++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/sql/parts/dashboard/widgets/explorer/explorerTree.ts b/src/sql/parts/dashboard/widgets/explorer/explorerTree.ts index 657c97f8a2..9f03352c19 100644 --- a/src/sql/parts/dashboard/widgets/explorer/explorerTree.ts +++ b/src/sql/parts/dashboard/widgets/explorer/explorerTree.ts @@ -33,6 +33,7 @@ import { $ } from 'vs/base/browser/dom'; import { ExecuteCommandAction } from 'vs/platform/actions/common/actions'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { IProgressService } from 'vs/platform/progress/common/progress'; +import { IAngularEventingService } from 'sql/services/angularEventing/angularEventingService'; export class ObjectMetadataWrapper implements ObjectMetadata { public metadataType: MetadataType; @@ -110,7 +111,8 @@ export class ExplorerController extends TreeDefaults.DefaultController { private _router: Router, private _contextMenuService: IContextMenuService, private _capabilitiesService: ICapabilitiesService, - private _instantiationService: IInstantiationService + private _instantiationService: IInstantiationService, + private _progressService: IProgressService ) { super(); } @@ -165,9 +167,9 @@ export class ExplorerController extends TreeDefaults.DefaultController { } private handleItemDoubleClick(element: IConnectionProfile): void { - this._connectionService.changeDatabase(element.databaseName).then(result => { + this._progressService.showWhile(TPromise.wrap(this._connectionService.changeDatabase(element.databaseName).then(result => { this._router.navigate(['database-dashboard']); - }); + }))); } protected onEnter(tree: tree.ITree, event: IKeyboardEvent): boolean { @@ -401,7 +403,7 @@ function GetExplorerActions(element: TreeResource, instantiationService: IInstan actions.push(action); } - actions.push(instantiationService.createInstance(ManageAction, ManageAction.ID, ManageAction.LABEL)); + actions.push(instantiationService.createInstance(ExplorerManageAction, ManageAction.ID, ManageAction.LABEL)); return TPromise.as(actions); } @@ -490,3 +492,20 @@ class ExplorerScriptExecuteAction extends ScriptExecuteAction { return promise; } } + +class ExplorerManageAction extends ManageAction { + constructor( + id: string, label: string, + @IConnectionManagementService connectionManagementService: IConnectionManagementService, + @IAngularEventingService angularEventingService: IAngularEventingService, + @IProgressService private _progressService: IProgressService + ) { + super(id, label, connectionManagementService, angularEventingService); + } + + public run(actionContext: ManageActionContext): TPromise { + let promise = super.run(actionContext); + this._progressService.showWhile(promise); + return promise; + } +} diff --git a/src/sql/parts/dashboard/widgets/explorer/explorerWidget.component.ts b/src/sql/parts/dashboard/widgets/explorer/explorerWidget.component.ts index b0700f574f..4788ef233f 100644 --- a/src/sql/parts/dashboard/widgets/explorer/explorerWidget.component.ts +++ b/src/sql/parts/dashboard/widgets/explorer/explorerWidget.component.ts @@ -43,7 +43,8 @@ export class ExplorerWidget extends DashboardWidget implements IDashboardWidget, this._router, this.contextMenuService, this.capabilitiesService, - this.instantiationService + this.instantiationService, + this.progressService ); private _treeRenderer = new ExplorerRenderer(); private _treeDataSource = new ExplorerDataSource();