dnet-applications/frontends/dnet-is-application/src/app/cleaner-tester/cleaner-tester.component.ts

33 lines
1.1 KiB
TypeScript

import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl, Validators } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute } from '@angular/router';
import { ResourceType, SimpleResource } from '../common/is.model';
import { ISService } from '../common/is.service';
@Component({
selector: 'app-cleaner-tester',
templateUrl: './cleaner-tester.component.html',
styleUrls: ['./cleaner-tester.component.css']
})
export class CleanerTesterComponent {
rules: SimpleResource[] = [];
xmlOutput: string = ''
cleanForm = new FormGroup({
xmlIn: new FormControl('', [Validators.required]),
rule: new FormControl('', [Validators.required]),
xmlOut: new FormControl('')
});
constructor(public service: ISService, public route: ActivatedRoute, public dialog: MatDialog) {
this.service.loadSimpleResources("cleaning_rule", (data: SimpleResource[]) => this.rules = data);
}
clean() {
this.service.testCleaning(this.cleanForm.get("rule")?.value!, this.cleanForm.get("xmlIn")?.value!, (data: string) => this.cleanForm.get("xmlOut")?.setValue(data), this.cleanForm);
}
}