fix job action context (#5053)

This commit is contained in:
Aditya Bist
2019-04-16 13:07:22 -07:00
committed by GitHub
parent 96c0f62cf5
commit b376f36733
2 changed files with 18 additions and 12 deletions

View File

@@ -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);