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