42 lines
1.2 KiB
TypeScript
42 lines
1.2 KiB
TypeScript
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef} from "@angular/core";
|
|
import {AbstractButton, NotNull, ObjectRef, TextArea} from "@webbpm/base-package";
|
|
import {ConfigExecutorRpcService} from "../generated/rpc/ConfigExecutorRpcService";
|
|
|
|
/**
|
|
* @author: a.petrov
|
|
*/
|
|
@Component({
|
|
moduleId: module.id,
|
|
selector: 'button-component',
|
|
templateUrl: './../../../src/resources/template/app/component/ConfigExecuteBtn.html',
|
|
changeDetection: ChangeDetectionStrategy.OnPush
|
|
})
|
|
export class ConfigExecuteBtn extends AbstractButton {
|
|
|
|
@ObjectRef()
|
|
@NotNull()
|
|
public ervuIdField: TextArea;
|
|
@NotNull()
|
|
public methodPath: string;
|
|
private script: ConfigExecutorRpcService;
|
|
|
|
constructor(el: ElementRef, cd: ChangeDetectorRef) {
|
|
super(el, cd);
|
|
}
|
|
|
|
public initialize() {
|
|
super.initialize();
|
|
this.script = this.getScript(ConfigExecutorRpcService)
|
|
}
|
|
|
|
doClickActions(): Promise<any> {
|
|
const methodPath = this.methodPath;
|
|
const idsValue = this.ervuIdField.getValue();
|
|
this.script.callConfigExecutor(methodPath, idsValue, true);
|
|
return Promise.resolve();
|
|
}
|
|
|
|
protected getFocusElement(): HTMLInputElement {
|
|
return this.el.nativeElement.querySelector('button');
|
|
}
|
|
}
|