You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.2 KiB

import { $t } from 'platform-core';
1 year ago
import { Processor } from '../Processor';
1 year ago
class SingleRule extends Processor {
1 year ago
constructor(targetType: string, context?: any) {
super(targetType, context);
this.PROCESSOR_TYPE = 'SINGLE_RULE';
this.EDITOR_DIALOG_WIDTH = 800;
}
1 year ago
public getToolbarAction(): any {
return {
extend: 'add',
name: 'singleRule',
1 year ago
label: $t('io.sc.engine.rule.core.enums.ProcessorType.' + this.PROCESSOR_TYPE),
icon: 'bi-noise-reduction',
enableIf: (args: any) => {
1 year ago
const type = this.context.target.type;
return type !== 'RULE_RESULT' && type !== 'SINGLE_RULE_RESULT';
},
afterClick: (args: any) => {
1 year ago
args.grid.getEditorForm().setFieldValue('type', this.PROCESSOR_TYPE);
},
};
}
1 year ago
public format(row: any): any {
return row.singleRule;
}
1 year ago
public getEditorFields(): any {
return [];
}
1 year ago
public getViewerFields(): any {
return [{ name: 'singleRule', label: $t('re.resources.designer.processor.grid.entity.singleRule') }];
}
1 year ago
public beforeEditorDataSubmit(args: any): void {}
1 year ago
public afterEditorOpen(args: any): void {
1 year ago
args.grid.getEditorDialog().setWidth(this.EDITOR_DIALOG_WIDTH);
1 year ago
}
}
export { SingleRule };