2023-07-14 17:22:25 +02:00
|
|
|
import {Injectable} from "@angular/core";
|
|
|
|
import {HttpClient} from "@angular/common/http";
|
|
|
|
import {environment} from "../../environments/environment";
|
2023-07-25 10:58:23 +02:00
|
|
|
import {map} from "rxjs";
|
2023-07-14 17:22:25 +02:00
|
|
|
|
|
|
|
@Injectable({
|
|
|
|
providedIn: "root"
|
|
|
|
})
|
|
|
|
export class OaipmhValidatorService {
|
|
|
|
|
|
|
|
constructor(private http: HttpClient) {}
|
|
|
|
|
|
|
|
getAnalysis(jobId: string) {
|
2023-11-21 14:21:24 +01:00
|
|
|
let url: string = environment.validatorAPI + "reports/getSummaryFromDB?jobId="+jobId;
|
2023-07-14 17:22:25 +02:00
|
|
|
return this.http.get(url);
|
|
|
|
}
|
|
|
|
|
|
|
|
getWarnings(jobId: string, ruleName: string) {
|
|
|
|
let url: string = environment.validatorAPI + "reports/getWarningsReport?jobId="+jobId+"&ruleName="+ruleName;
|
|
|
|
return this.http.get<any>(url);
|
|
|
|
}
|
|
|
|
|
|
|
|
getErrors(jobId: string, ruleName: string) {
|
|
|
|
let url:string = environment.validatorAPI + "reports/getErrorsReport?jobId="+jobId+"&ruleName="+ruleName;
|
|
|
|
return this.http.get<any>(url);
|
|
|
|
}
|
|
|
|
|
|
|
|
getJobResult(jobId: string) {
|
|
|
|
let url: string = environment.validatorAPI + "reports/getJobResult?jobId="+jobId;
|
|
|
|
return this.http.get(url);
|
|
|
|
}
|
2023-07-25 10:58:23 +02:00
|
|
|
|
[Validator]: Updates & improvements.
1. JobResult.ts: Added "set:string" and "exceptionMessage: string" fields.
2. RulePerJob.ts: Removed "rule_description" field and added fields "requirement_level: string, description: string, fair_principles: string, fair_principles_tooltip: string, link: string;".
3. oaipmh-analysis.component.html: Added cards on the right for base url and set | Added requirement level to the rule name, updated field for description, added fair principles.
4. oaipmh-analysis.component.ts: Added "requirementLevelMapping" and initialize tooltip of fair principles.
5. oaipmh-history.component.html: Updated table to show multiple validations | Updated columns of table - removed actions and updated status (view results - gets us to the analysis, in progress, stoppes, error, errors - opens a modal with the exception message).
6. oaipmh-history.component.ts: Added method "getJobResults()" and methods for error modal | Added a limit of 120 requests (10 minutes) for repetable requests of getting jobResult to update status when status is in progress.
7. oaipmh-validator.component.ts: Updated label for guidelines | Updated validation checks | Added exception catch in getSets().
8. oaipmh-validator.service.ts: Added method "getJobResults(limit: number = 200)".
9. topmenu.component.html: Removed jobId from history demo page.
10. package-lock.json: Updated uikit version.
2023-10-03 16:00:58 +02:00
|
|
|
getJobResults(limit: number = 200) {
|
|
|
|
let url: string = environment.validatorAPI + "jobs/latest?limit="+limit;
|
|
|
|
return this.http.get(url);
|
|
|
|
}
|
|
|
|
|
2023-07-25 10:58:23 +02:00
|
|
|
getSets(baseUrl) {
|
|
|
|
let url: string = environment.validatorAPI + "getSets?baseUrl="+baseUrl;
|
|
|
|
return this.http.get(url).pipe(map(res => res['set']));
|
|
|
|
}
|
|
|
|
|
|
|
|
validate(guidelines: string, baseUrl: string, numberOfRecords: string, set: string) {
|
|
|
|
let url: string = environment.validatorAPI + "realValidator?guidelines="+guidelines+"&baseUrl="+baseUrl
|
2023-07-25 15:58:41 +02:00
|
|
|
+(numberOfRecords ? ("&numberOfRecords="+numberOfRecords) : "") + (set && set != 'all' ? ("&set="+set) : "");
|
2023-07-25 10:58:23 +02:00
|
|
|
console.log(url);
|
2023-07-25 15:58:41 +02:00
|
|
|
return this.http.get(url);
|
2023-07-25 10:58:23 +02:00
|
|
|
}
|
2023-07-14 17:22:25 +02:00
|
|
|
}
|