metadata-validator-ui/src/app/pages/single-record-validator/single-record-validator.com...

37 lines
1.3 KiB
TypeScript

import { Component, OnInit } from '@angular/core';
import {UntypedFormBuilder, UntypedFormGroup, Validators} from "@angular/forms";
import {SingleRecordValidatorService} from "./single-record-validator.service";
import {Option} from "../../shared/utils/input/input.component";
@Component({
selector: 'app-single-record-validator',
templateUrl: './single-record-validator.component.html',
styleUrls: ['./single-record-validator.component.less']
})
export class SingleRecordValidatorComponent implements OnInit {
public options: Option[] = [
{label: 'Data Archive Guidelines V2 Profile', value: 'dataArchiveGuidelinesV2Profile'},
{label: 'Literature Guidelines V3 Profile', value: 'literatureGuidelinesV3Profile'},
{label: 'Literature Guidelines V4 Profile', value: 'literatureGuidelinesV4Profile'}
];
public form: UntypedFormGroup;
public result: any;
constructor(private fb: UntypedFormBuilder, private validator: SingleRecordValidatorService) {
this.form = this.fb.group({
guidelines: this.fb.control("", Validators.required),
xml: this.fb.control('', Validators.required)
});
}
ngOnInit(): void {}
public validate() {
this.validator.validateRecord(this.form.get('xml')?.getRawValue(), this.form.get('guidelines')?.getRawValue()).subscribe(
result => {
this.result = result;
}
)
}
}