added progress indication for database navigation in dashboard (#1529)

This commit is contained in:
Anthony Dresser
2018-06-05 11:38:00 -07:00
committed by GitHub
parent aef7244939
commit ac8a926a70
2 changed files with 25 additions and 5 deletions

View File

@@ -33,6 +33,7 @@ import { $ } from 'vs/base/browser/dom';
import { ExecuteCommandAction } from 'vs/platform/actions/common/actions'; import { ExecuteCommandAction } from 'vs/platform/actions/common/actions';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { IProgressService } from 'vs/platform/progress/common/progress'; import { IProgressService } from 'vs/platform/progress/common/progress';
import { IAngularEventingService } from 'sql/services/angularEventing/angularEventingService';
export class ObjectMetadataWrapper implements ObjectMetadata { export class ObjectMetadataWrapper implements ObjectMetadata {
public metadataType: MetadataType; public metadataType: MetadataType;
@@ -110,7 +111,8 @@ export class ExplorerController extends TreeDefaults.DefaultController {
private _router: Router, private _router: Router,
private _contextMenuService: IContextMenuService, private _contextMenuService: IContextMenuService,
private _capabilitiesService: ICapabilitiesService, private _capabilitiesService: ICapabilitiesService,
private _instantiationService: IInstantiationService private _instantiationService: IInstantiationService,
private _progressService: IProgressService
) { ) {
super(); super();
} }
@@ -165,9 +167,9 @@ export class ExplorerController extends TreeDefaults.DefaultController {
} }
private handleItemDoubleClick(element: IConnectionProfile): void { 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']); this._router.navigate(['database-dashboard']);
}); })));
} }
protected onEnter(tree: tree.ITree, event: IKeyboardEvent): boolean { protected onEnter(tree: tree.ITree, event: IKeyboardEvent): boolean {
@@ -401,7 +403,7 @@ function GetExplorerActions(element: TreeResource, instantiationService: IInstan
actions.push(action); 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); return TPromise.as(actions);
} }
@@ -490,3 +492,20 @@ class ExplorerScriptExecuteAction extends ScriptExecuteAction {
return promise; 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<boolean> {
let promise = super.run(actionContext);
this._progressService.showWhile(promise);
return promise;
}
}

View File

@@ -43,7 +43,8 @@ export class ExplorerWidget extends DashboardWidget implements IDashboardWidget,
this._router, this._router,
this.contextMenuService, this.contextMenuService,
this.capabilitiesService, this.capabilitiesService,
this.instantiationService this.instantiationService,
this.progressService
); );
private _treeRenderer = new ExplorerRenderer(); private _treeRenderer = new ExplorerRenderer();
private _treeDataSource = new ExplorerDataSource(); private _treeDataSource = new ExplorerDataSource();