mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-09 01:32:34 -05:00
Fix agent context menu to appear in correct location (#5671)
* Fix agent context menu to appear in correct location * Further type function params * Just use anchor directly
This commit is contained in:
@@ -14,7 +14,7 @@ import { Table } from 'sql/base/browser/ui/table/table';
|
||||
import { AgentViewComponent } from 'sql/workbench/parts/jobManagement/electron-browser/agentView.component';
|
||||
import { IJobManagementService } from 'sql/platform/jobManagement/common/interfaces';
|
||||
import { EditAlertAction, DeleteAlertAction, NewAlertAction } from 'sql/platform/jobManagement/common/jobActions';
|
||||
import { JobManagementView } from 'sql/workbench/parts/jobManagement/electron-browser/jobManagementView';
|
||||
import { JobManagementView, JobActionContext } from 'sql/workbench/parts/jobManagement/electron-browser/jobManagementView';
|
||||
import { CommonServiceInterface } from 'sql/platform/bootstrap/node/commonServiceInterface.service';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
|
||||
@@ -194,11 +194,11 @@ export class AlertsViewComponent extends JobManagementView implements OnInit, On
|
||||
this._table.resizeCanvas();
|
||||
}
|
||||
|
||||
protected getTableActions(targetObject: any): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(this._instantiationService.createInstance(EditAlertAction));
|
||||
actions.push(this._instantiationService.createInstance(DeleteAlertAction));
|
||||
return actions;
|
||||
protected getTableActions(): IAction[] {
|
||||
return [
|
||||
this._instantiationService.createInstance(EditAlertAction),
|
||||
this._instantiationService.createInstance(DeleteAlertAction)
|
||||
];
|
||||
}
|
||||
|
||||
protected getCurrentTableObject(rowIndex: number): any {
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Taskbar } from 'sql/base/browser/ui/taskbar/taskbar';
|
||||
import { JobsRefreshAction, IJobActionInfo } from 'sql/platform/jobManagement/common/jobActions';
|
||||
import { TabChild } from 'sql/base/electron-browser/ui/panel/tab.component';
|
||||
import { IDashboardService } from 'sql/platform/dashboard/browser/dashboardService';
|
||||
import { ITableMouseEvent } from 'sql/base/browser/ui/table/interfaces';
|
||||
|
||||
export abstract class JobManagementView extends TabChild implements AfterContentChecked {
|
||||
protected isVisible: boolean = false;
|
||||
@@ -72,22 +73,21 @@ export abstract class JobManagementView extends TabChild implements AfterContent
|
||||
|
||||
abstract onFirstVisible();
|
||||
|
||||
protected openContextMenu(event): void {
|
||||
let rowIndex = event.cell.row;
|
||||
protected openContextMenu(event: ITableMouseEvent): void {
|
||||
const rowIndex = event.cell.row;
|
||||
|
||||
let targetObject = this.getCurrentTableObject(rowIndex);
|
||||
let actions = this.getTableActions(targetObject);
|
||||
const targetObject = this.getCurrentTableObject(rowIndex);
|
||||
const actions = this.getTableActions(targetObject);
|
||||
if (actions) {
|
||||
let ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||
let actionContext: IJobActionInfo = {
|
||||
const ownerUri: string = this._commonService.connectionManagementService.connectionInfo.ownerUri;
|
||||
const actionContext: IJobActionInfo = {
|
||||
ownerUri: ownerUri,
|
||||
targetObject: targetObject,
|
||||
component: this
|
||||
};
|
||||
|
||||
let anchor = { x: event.pageX + 1, y: event.pageY };
|
||||
this._contextMenuService.showContextMenu({
|
||||
getAnchor: () => anchor,
|
||||
getAnchor: () => event.anchor,
|
||||
getActions: () => actions,
|
||||
getKeyBinding: (action) => this._keybindingFor(action),
|
||||
getActionsContext: () => (actionContext)
|
||||
@@ -100,7 +100,7 @@ export abstract class JobManagementView extends TabChild implements AfterContent
|
||||
return kb;
|
||||
}
|
||||
|
||||
protected getTableActions(targetObject?: any): IAction[] {
|
||||
protected getTableActions(targetObject?: JobActionContext): IAction[] {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
@@ -855,14 +855,14 @@ export class JobsViewComponent extends JobManagementView implements OnInit, OnDe
|
||||
}
|
||||
|
||||
protected getTableActions(targetObject: JobActionContext): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
let editAction = this._instantiationService.createInstance(EditJobAction);
|
||||
const editAction = this._instantiationService.createInstance(EditJobAction);
|
||||
if (!targetObject.canEdit) {
|
||||
editAction.enabled = false;
|
||||
}
|
||||
actions.push(editAction);
|
||||
actions.push(this._instantiationService.createInstance(DeleteJobAction));
|
||||
return actions;
|
||||
return [
|
||||
editAction,
|
||||
this._instantiationService.createInstance(DeleteJobAction)
|
||||
];
|
||||
}
|
||||
|
||||
protected convertStepsToStepInfos(steps: azdata.AgentJobStep[], job: azdata.AgentJobInfo): azdata.AgentJobStepInfo[] {
|
||||
|
||||
@@ -194,10 +194,10 @@ export class OperatorsViewComponent extends JobManagementView implements OnInit,
|
||||
}
|
||||
|
||||
protected getTableActions(): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(this._instantiationService.createInstance(EditOperatorAction));
|
||||
actions.push(this._instantiationService.createInstance(DeleteOperatorAction));
|
||||
return actions;
|
||||
return [
|
||||
this._instantiationService.createInstance(EditOperatorAction),
|
||||
this._instantiationService.createInstance(DeleteOperatorAction)
|
||||
];
|
||||
}
|
||||
|
||||
protected getCurrentTableObject(rowIndex: number): any {
|
||||
|
||||
@@ -198,10 +198,10 @@ export class ProxiesViewComponent extends JobManagementView implements OnInit, O
|
||||
}
|
||||
|
||||
protected getTableActions(): IAction[] {
|
||||
let actions: IAction[] = [];
|
||||
actions.push(this._instantiationService.createInstance(EditProxyAction));
|
||||
actions.push(this._instantiationService.createInstance(DeleteProxyAction));
|
||||
return actions;
|
||||
return [
|
||||
this._instantiationService.createInstance(EditProxyAction),
|
||||
this._instantiationService.createInstance(DeleteProxyAction)
|
||||
];
|
||||
}
|
||||
|
||||
protected getCurrentTableObject(rowIndex: number): any {
|
||||
|
||||
Reference in New Issue
Block a user