SUPPORT-8529: Добавлен вызов http

This commit is contained in:
malkov34 2024-09-05 09:06:50 +03:00
parent c246132121
commit f5854c7592
9 changed files with 185 additions and 130 deletions

View file

@ -7,7 +7,7 @@ import {ConfigExecutorRpcService} from "../generated/rpc/ConfigExecutorRpcServic
*/
@Component({
moduleId: module.id,
selector: 'button-component',
selector: 'config-execute-button-component',
templateUrl: './../../../src/resources/template/app/component/ConfigExecuteBtn.html',
changeDetection: ChangeDetectionStrategy.OnPush
})
@ -24,19 +24,31 @@ export class ConfigExecuteBtn extends AbstractButton {
super(el, cd);
}
public initialize() {
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();
const value = this.ervuIdField.getValue();
if (value && this.methodPath.trim().length !== 0) {
const ids = value.replace(/[{}]/g, '')
.split(',')
.map(id => id.trim().replace(/"/g, ''));
return this.script.callConfigExecutor(this.methodPath, ids, true)
.then(response => {
console.log("Успешное выполнение:", response);
return response;
})
.catch(error => {
console.error("Ошибка при выполнении скрипта:", error);
return Promise.reject(error);
});
}
}
protected getFocusElement(): HTMLInputElement {
getFocusElement(): HTMLInputElement {
return this.el.nativeElement.querySelector('button');
}
}

View file

@ -30,6 +30,7 @@ import {TaskListComponent} from "./component/task-list.component";
import {ProcessListComponent} from "./component/process-list.component";
import {TaskComponent} from "./component/task.component";
import {TaskNotFoundComponent} from "./component/task-not-found.component";
import {ConfigExecuteBtn} from "../../ervu/ConfigExecuteBtn";
registerLocaleData(localeRu);
export const DIRECTIVES = [
@ -48,7 +49,8 @@ export const DIRECTIVES = [
forwardRef(() => TaskListComponent),
forwardRef(() => ProcessListComponent),
forwardRef(() => TaskComponent),
forwardRef(() => TaskNotFoundComponent)
forwardRef(() => TaskNotFoundComponent),
forwardRef(() => ConfigExecuteBtn)
];
@NgModule({