mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add Delete Alert action implementation (#1840)
* Delete alert WIP 1 * Add agent delete methods * Add Delete implementation for Jobs, Operators, and Proxies
This commit is contained in:
@@ -19,7 +19,7 @@ import { Component, Inject, forwardRef, ElementRef, ChangeDetectorRef, ViewChild
|
||||
import { Table } from 'sql/base/browser/ui/table/table';
|
||||
import { AgentViewComponent } from 'sql/parts/jobManagement/agent/agentView.component';
|
||||
import { IJobManagementService } from 'sql/parts/jobManagement/common/interfaces';
|
||||
import { EditOperator, DeleteOperator } from 'sql/parts/jobManagement/common/jobActions';
|
||||
import { EditOperatorAction, DeleteOperatorAction } from 'sql/parts/jobManagement/common/jobActions';
|
||||
import { JobManagementView } from 'sql/parts/jobManagement/views/jobManagementView';
|
||||
import { CommonServiceInterface } from 'sql/services/common/commonServiceInterface.service';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
@@ -29,6 +29,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { TPromise } from 'vs/base/common/winjs.base';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
export const VIEW_SELECTOR: string = 'joboperatorsview-component';
|
||||
export const ROW_HEIGHT: number = 45;
|
||||
@@ -67,18 +68,19 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit
|
||||
public operators: sqlops.AgentOperatorInfo[];
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => CommonServiceInterface)) private _dashboardService: CommonServiceInterface,
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _cd: ChangeDetectorRef,
|
||||
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
|
||||
@Inject(forwardRef(() => AgentViewComponent)) private _agentViewComponent: AgentViewComponent,
|
||||
@Inject(IJobManagementService) private _jobManagementService: IJobManagementService,
|
||||
@Inject(IThemeService) private _themeService: IThemeService,
|
||||
@Inject(ICommandService) private _commandService: ICommandService,
|
||||
@Inject(IInstantiationService) private _instantiationService: IInstantiationService,
|
||||
@Inject(forwardRef(() => CommonServiceInterface)) commonService: CommonServiceInterface,
|
||||
@Inject(IContextMenuService) contextMenuService: IContextMenuService,
|
||||
@Inject(IKeybindingService) keybindingService: IKeybindingService
|
||||
) {
|
||||
super(contextMenuService, keybindingService);
|
||||
this._isCloud = this._dashboardService.connectionManagementService.connectionInfo.serverInfo.isCloud;
|
||||
super(commonService, contextMenuService, keybindingService);
|
||||
this._isCloud = commonService.connectionManagementService.connectionInfo.serverInfo.isCloud;
|
||||
}
|
||||
|
||||
ngOnInit(){
|
||||
@@ -115,7 +117,7 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit
|
||||
self.openContextMenu(e);
|
||||
}));
|
||||
|
||||
let ownerUri: string = this._dashboardService.connectionManagementService.connectionInfo.ownerUri;
|
||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||
this._jobManagementService.getOperators(ownerUri).then((result) => {
|
||||
if (result && result.operators) {
|
||||
self.operators = result.operators;
|
||||
@@ -150,13 +152,19 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit
|
||||
|
||||
protected getTableActions(): TPromise<IAction[]> {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(new EditOperator(EditOperator.ID, EditOperator.LABEL));
|
||||
actions.push(new DeleteOperator(DeleteOperator.ID, DeleteOperator.LABEL));
|
||||
actions.push(this._instantiationService.createInstance(EditOperatorAction));
|
||||
actions.push(this._instantiationService.createInstance(DeleteOperatorAction));
|
||||
return TPromise.as(actions);
|
||||
}
|
||||
|
||||
protected getCurrentTableObject(rowIndex: number): any {
|
||||
return (this.operators && this.operators.length >= rowIndex)
|
||||
? this.operators[rowIndex]
|
||||
: undefined;
|
||||
}
|
||||
|
||||
private openCreateOperatorDialog() {
|
||||
let ownerUri: string = this._dashboardService.connectionManagementService.connectionInfo.ownerUri;
|
||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||
this._commandService.executeCommand('agent.openCreateOperatorDialog', ownerUri);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user