|
|
|
|
import { $t } from 'platform-core';
|
|
|
|
|
import { Processor } from '../Processor';
|
|
|
|
|
|
|
|
|
|
class SingleRule extends Processor {
|
|
|
|
|
public getToolbarAction(target: any): any {
|
|
|
|
|
return {
|
|
|
|
|
extend: 'add',
|
|
|
|
|
name: 'singleRule',
|
|
|
|
|
label: $t('io.sc.engine.rule.core.enums.ProcessorType.SINGLE_RULE'),
|
|
|
|
|
icon: 'bi-noise-reduction',
|
|
|
|
|
enableIf: (args: any) => {
|
|
|
|
|
return target.type === 'RULE_RESULT' || target.type === 'SINGLE_RULE_RESULT';
|
|
|
|
|
},
|
|
|
|
|
afterClick: (args: any) => {
|
|
|
|
|
args.grid.getEditorForm().setFieldValue('type', 'SINGLE_RULE');
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public format(row: any): any {
|
|
|
|
|
return row.singleRule;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getEditorFields(context?: any): any {
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public getViewerFields(context?: any): any {
|
|
|
|
|
return [{ name: 'singleRule', label: $t('re.resources.designer.processor.grid.entity.singleRule') }];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public beforeEditorDataSubmit(args: any): void {}
|
|
|
|
|
|
|
|
|
|
public afterEditorOpen(args: any): void {}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export { SingleRule };
|