mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 09:35:38 -05:00
fix job action context (#5053)
This commit is contained in:
@@ -14,7 +14,7 @@ import { IContextMenuService } from 'vs/platform/contextview/browser/contextView
|
||||
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Taskbar } from '../../../base/browser/ui/taskbar/taskbar';
|
||||
import { JobsRefreshAction } from 'sql/platform/jobManagement/common/jobActions';
|
||||
import { JobsRefreshAction, IJobActionInfo } from 'sql/platform/jobManagement/common/jobActions';
|
||||
import { TabChild } from 'sql/base/browser/ui/panel/tab.component';
|
||||
import { IDashboardService } from 'sql/platform/dashboard/browser/dashboardService';
|
||||
|
||||
@@ -82,6 +82,7 @@ export abstract class JobManagementView extends TabChild implements AfterContent
|
||||
let actionContext = {
|
||||
ownerUri: ownerUri,
|
||||
targetObject: targetObject
|
||||
|
||||
};
|
||||
|
||||
let anchor = { x: event.pageX + 1, y: event.pageY };
|
||||
@@ -116,7 +117,8 @@ export abstract class JobManagementView extends TabChild implements AfterContent
|
||||
{ action: refreshAction },
|
||||
{ action: newAction }
|
||||
]);
|
||||
this._actionBar.context = { component: this };
|
||||
let context: IJobActionInfo = { component: this };
|
||||
this._actionBar.context = context;
|
||||
}
|
||||
|
||||
public refreshJobs() {
|
||||
|
||||
@@ -30,8 +30,8 @@ export enum JobActions {
|
||||
}
|
||||
|
||||
export class IJobActionInfo {
|
||||
ownerUri: string;
|
||||
targetObject: any;
|
||||
ownerUri?: string;
|
||||
targetObject?: any;
|
||||
component: JobManagementView;
|
||||
}
|
||||
|
||||
@@ -69,10 +69,11 @@ export class NewJobAction extends Action {
|
||||
super(NewJobAction.ID, NewJobAction.LABEL, 'newStepIcon');
|
||||
}
|
||||
|
||||
public run(context: JobsViewComponent): Promise<boolean> {
|
||||
public run(context: IJobActionInfo): Promise<boolean> {
|
||||
let component = context.component as JobsViewComponent;
|
||||
return new Promise<boolean>(async (resolve, reject) => {
|
||||
try {
|
||||
await context.openCreateJobDialog();
|
||||
await component.openCreateJobDialog();
|
||||
resolve(true);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
@@ -293,10 +294,11 @@ export class NewAlertAction extends Action {
|
||||
super(NewAlertAction.ID, NewAlertAction.LABEL, 'newStepIcon');
|
||||
}
|
||||
|
||||
public run(context: AlertsViewComponent): Promise<boolean> {
|
||||
public run(context: IJobActionInfo): Promise<boolean> {
|
||||
let component = context.component as AlertsViewComponent;
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
try {
|
||||
context.openCreateAlertDialog();
|
||||
component.openCreateAlertDialog();
|
||||
resolve(true);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
@@ -380,10 +382,11 @@ export class NewOperatorAction extends Action {
|
||||
super(NewOperatorAction.ID, NewOperatorAction.LABEL, 'newStepIcon');
|
||||
}
|
||||
|
||||
public run(context: OperatorsViewComponent): Promise<boolean> {
|
||||
public run(context: IJobActionInfo): Promise<boolean> {
|
||||
let component = context.component as OperatorsViewComponent;
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
try {
|
||||
context.openCreateOperatorDialog();
|
||||
component.openCreateOperatorDialog();
|
||||
resolve(true);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
@@ -466,10 +469,11 @@ export class NewProxyAction extends Action {
|
||||
super(NewProxyAction.ID, NewProxyAction.LABEL, 'newStepIcon');
|
||||
}
|
||||
|
||||
public run(context: ProxiesViewComponent): Promise<boolean> {
|
||||
public run(context: IJobActionInfo): Promise<boolean> {
|
||||
let component = context.component as ProxiesViewComponent;
|
||||
return new Promise<boolean>((resolve, reject) => {
|
||||
try {
|
||||
context.openCreateProxyDialog();
|
||||
component.openCreateProxyDialog();
|
||||
resolve(true);
|
||||
} catch (e) {
|
||||
reject(e);
|
||||
|
||||
Reference in New Issue
Block a user