mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 01:25:38 -05:00
Add progress indicator for dashboard scripting (#1511)
* add progress indicator for dashboard scripting * formatting
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { IConnectionProfile } from 'sql/parts/connection/common/interfaces';
|
||||
import { MetadataType } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { MetadataType, IConnectionManagementService, IErrorMessageService } from 'sql/parts/connection/common/connectionManagement';
|
||||
import { SingleConnectionManagementService } from 'sql/services/common/commonServiceInterface.service';
|
||||
import {
|
||||
NewQueryAction, ScriptSelectAction, EditDataAction, ScriptCreateAction, ScriptExecuteAction, ScriptAlterAction,
|
||||
@@ -16,6 +16,8 @@ import { ICapabilitiesService } from 'sql/services/capabilities/capabilitiesServ
|
||||
import { ConnectionManagementInfo } from 'sql/parts/connection/common/connectionManagementInfo';
|
||||
import * as Constants from 'sql/parts/connection/common/constants';
|
||||
import { OEAction } from 'sql/parts/objectExplorer/viewlet/objectExplorerActions';
|
||||
import { IQueryEditorService } from 'sql/parts/query/common/queryEditorService';
|
||||
import { IScriptingService } from 'sql/services/scripting/scriptingService';
|
||||
|
||||
import { ObjectMetadata } from 'sqlops';
|
||||
|
||||
@@ -30,6 +32,7 @@ import { generateUuid } from 'vs/base/common/uuid';
|
||||
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';
|
||||
|
||||
export class ObjectMetadataWrapper implements ObjectMetadata {
|
||||
public metadataType: MetadataType;
|
||||
@@ -370,7 +373,7 @@ function GetExplorerActions(element: TreeResource, instantiationService: IInstan
|
||||
|
||||
if (element instanceof ObjectMetadataWrapper) {
|
||||
if (element.metadataType === MetadataType.View || element.metadataType === MetadataType.Table) {
|
||||
actions.push(instantiationService.createInstance(ScriptSelectAction, ScriptSelectAction.ID, ScriptSelectAction.LABEL));
|
||||
actions.push(instantiationService.createInstance(ExplorerScriptSelectAction, ScriptSelectAction.ID, ScriptSelectAction.LABEL));
|
||||
}
|
||||
|
||||
if (element.metadataType === MetadataType.Table) {
|
||||
@@ -378,12 +381,12 @@ function GetExplorerActions(element: TreeResource, instantiationService: IInstan
|
||||
}
|
||||
|
||||
if (element.metadataType === MetadataType.SProc && info.connectionProfile.providerName === Constants.mssqlProviderName) {
|
||||
actions.push(instantiationService.createInstance(ScriptExecuteAction, ScriptExecuteAction.ID, ScriptExecuteAction.LABEL));
|
||||
actions.push(instantiationService.createInstance(ExplorerScriptExecuteAction, ScriptExecuteAction.ID, ScriptExecuteAction.LABEL));
|
||||
}
|
||||
|
||||
if ((element.metadataType === MetadataType.SProc || element.metadataType === MetadataType.Function || element.metadataType === MetadataType.View)
|
||||
&& info.connectionProfile.providerName === Constants.mssqlProviderName) {
|
||||
actions.push(instantiationService.createInstance(ScriptAlterAction, ScriptAlterAction.ID, ScriptAlterAction.LABEL));
|
||||
actions.push(instantiationService.createInstance(ExplorerScriptAlterAction, ScriptAlterAction.ID, ScriptAlterAction.LABEL));
|
||||
}
|
||||
} else {
|
||||
actions.push(instantiationService.createInstance(CustomExecuteCommandAction, NewQueryAction.ID, NewQueryAction.LABEL));
|
||||
@@ -402,7 +405,7 @@ function GetExplorerActions(element: TreeResource, instantiationService: IInstan
|
||||
return TPromise.as(actions);
|
||||
}
|
||||
|
||||
actions.push(instantiationService.createInstance(ScriptCreateAction, ScriptCreateAction.ID, ScriptCreateAction.LABEL));
|
||||
actions.push(instantiationService.createInstance(ExplorerScriptCreateAction, ScriptCreateAction.ID, ScriptCreateAction.LABEL));
|
||||
|
||||
return TPromise.as(actions);
|
||||
}
|
||||
@@ -412,3 +415,78 @@ class CustomExecuteCommandAction extends ExecuteCommandAction {
|
||||
return super.run(context.profile);
|
||||
}
|
||||
}
|
||||
|
||||
class ExplorerScriptSelectAction extends ScriptSelectAction {
|
||||
constructor(
|
||||
id: string, label: string,
|
||||
@IQueryEditorService queryEditorService: IQueryEditorService,
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||
@IScriptingService scriptingService: IScriptingService,
|
||||
@IProgressService private progressService: IProgressService
|
||||
) {
|
||||
super(id, label, queryEditorService, connectionManagementService, scriptingService);
|
||||
}
|
||||
|
||||
public run(actionContext: BaseActionContext): TPromise<boolean> {
|
||||
let promise = super.run(actionContext);
|
||||
this.progressService.showWhile(promise);
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
class ExplorerScriptCreateAction extends ScriptCreateAction {
|
||||
constructor(
|
||||
id: string, label: string,
|
||||
@IQueryEditorService queryEditorService: IQueryEditorService,
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||
@IScriptingService scriptingService: IScriptingService,
|
||||
@IErrorMessageService errorMessageService: IErrorMessageService,
|
||||
@IProgressService private progressService: IProgressService
|
||||
) {
|
||||
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
|
||||
}
|
||||
|
||||
public run(actionContext: BaseActionContext): TPromise<boolean> {
|
||||
let promise = super.run(actionContext);
|
||||
this.progressService.showWhile(promise);
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
class ExplorerScriptAlterAction extends ScriptAlterAction {
|
||||
constructor(
|
||||
id: string, label: string,
|
||||
@IQueryEditorService queryEditorService: IQueryEditorService,
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||
@IScriptingService scriptingService: IScriptingService,
|
||||
@IErrorMessageService errorMessageService: IErrorMessageService,
|
||||
@IProgressService private progressService: IProgressService
|
||||
) {
|
||||
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
|
||||
}
|
||||
|
||||
public run(actionContext: BaseActionContext): TPromise<boolean> {
|
||||
let promise = super.run(actionContext);
|
||||
this.progressService.showWhile(promise);
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
class ExplorerScriptExecuteAction extends ScriptExecuteAction {
|
||||
constructor(
|
||||
id: string, label: string,
|
||||
@IQueryEditorService queryEditorService: IQueryEditorService,
|
||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||
@IScriptingService scriptingService: IScriptingService,
|
||||
@IErrorMessageService errorMessageService: IErrorMessageService,
|
||||
@IProgressService private progressService: IProgressService
|
||||
) {
|
||||
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
|
||||
}
|
||||
|
||||
public run(actionContext: BaseActionContext): TPromise<boolean> {
|
||||
let promise = super.run(actionContext);
|
||||
this.progressService.showWhile(promise);
|
||||
return promise;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import { Delayer } from 'vs/base/common/async';
|
||||
import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
|
||||
@Component({
|
||||
selector: 'explorer-widget',
|
||||
@@ -63,7 +64,8 @@ export class ExplorerWidget extends DashboardWidget implements IDashboardWidget,
|
||||
@Inject(IContextViewService) private contextViewService: IContextViewService,
|
||||
@Inject(IInstantiationService) private instantiationService: IInstantiationService,
|
||||
@Inject(IContextMenuService) private contextMenuService: IContextMenuService,
|
||||
@Inject(ICapabilitiesService) private capabilitiesService: ICapabilitiesService
|
||||
@Inject(ICapabilitiesService) private capabilitiesService: ICapabilitiesService,
|
||||
@Inject(IProgressService) private progressService: IProgressService
|
||||
) {
|
||||
super();
|
||||
this.init();
|
||||
|
||||
@@ -45,6 +45,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IClipboardService as vsIClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { IProgressService } from 'vs/platform/progress/common/progress';
|
||||
|
||||
const selectorCounter = new Map<string, number>();
|
||||
|
||||
@@ -121,7 +122,8 @@ export function bootstrapAngular<T>(collection: ServicesAccessor, moduleType: IM
|
||||
{ provide: IJobManagementService, useValue: collection.get(IJobManagementService) },
|
||||
{ provide: IEnvironmentService, useValue: collection.get(IEnvironmentService) },
|
||||
{ provide: INotificationService, useValue: collection.get(INotificationService) },
|
||||
{ provide: IWorkbenchThemeService, useValue: collection.get(IWorkbenchThemeService) }
|
||||
{ provide: IWorkbenchThemeService, useValue: collection.get(IWorkbenchThemeService) },
|
||||
{ provide: IProgressService, useValue: collection.get(IProgressService) }
|
||||
];
|
||||
|
||||
platform = platformBrowserDynamic(providers);
|
||||
|
||||
Reference in New Issue
Block a user