[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.
This commit is contained in:
parent
894792daae
commit
b2cddcbfb6
|
@ -19,7 +19,7 @@
|
||||||
"@angular/router": "^16.1.8",
|
"@angular/router": "^16.1.8",
|
||||||
"rxjs": "~7.5.0",
|
"rxjs": "~7.5.0",
|
||||||
"tslib": "^2.3.0",
|
"tslib": "^2.3.0",
|
||||||
"uikit": "3.13.10",
|
"uikit": "3.16.24",
|
||||||
"zone.js": "~0.13.1"
|
"zone.js": "~0.13.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -11575,9 +11575,9 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/uikit": {
|
"node_modules/uikit": {
|
||||||
"version": "3.13.10",
|
"version": "3.16.24",
|
||||||
"resolved": "https://registry.npmjs.org/uikit/-/uikit-3.13.10.tgz",
|
"resolved": "https://registry.npmjs.org/uikit/-/uikit-3.16.24.tgz",
|
||||||
"integrity": "sha512-kxSPDT7HiwiQW3e++V8LfIe7/E1L5viPXH4P2yxyDIaU6CP1gWh2Ggy6skc/ziZNlY3CqI2JJkOU2/5zd+NaVw=="
|
"integrity": "sha512-b33pxCinNlgrkQf+VUNk7AzN0wFWo41C5avYbXQTtt41xOAlJD2mBQHNwlTm8s8uo+CZa3djX1inJLuY2JwusQ=="
|
||||||
},
|
},
|
||||||
"node_modules/unicode-canonical-property-names-ecmascript": {
|
"node_modules/unicode-canonical-property-names-ecmascript": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
|
@ -20994,9 +20994,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"uikit": {
|
"uikit": {
|
||||||
"version": "3.13.10",
|
"version": "3.16.24",
|
||||||
"resolved": "https://registry.npmjs.org/uikit/-/uikit-3.13.10.tgz",
|
"resolved": "https://registry.npmjs.org/uikit/-/uikit-3.16.24.tgz",
|
||||||
"integrity": "sha512-kxSPDT7HiwiQW3e++V8LfIe7/E1L5viPXH4P2yxyDIaU6CP1gWh2Ggy6skc/ziZNlY3CqI2JJkOU2/5zd+NaVw=="
|
"integrity": "sha512-b33pxCinNlgrkQf+VUNk7AzN0wFWo41C5avYbXQTtt41xOAlJD2mBQHNwlTm8s8uo+CZa3djX1inJLuY2JwusQ=="
|
||||||
},
|
},
|
||||||
"unicode-canonical-property-names-ecmascript": {
|
"unicode-canonical-property-names-ecmascript": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 11d0be4ffd6649189f87c91aed1c2d47c5d9b2c8
|
Subproject commit 6d7f6eca720d18fe694f13e380c1ede1f46303a8
|
|
@ -1,6 +1,7 @@
|
||||||
export class JobResult {
|
export class JobResult {
|
||||||
id: string;
|
id: string;
|
||||||
baseUrl: string;
|
baseUrl: string;
|
||||||
|
set: string;
|
||||||
numberOfRecords: number;
|
numberOfRecords: number;
|
||||||
guidelines: string;
|
guidelines: string;
|
||||||
startDate: Date;
|
startDate: Date;
|
||||||
|
@ -9,6 +10,7 @@ export class JobResult {
|
||||||
progress: Progress;
|
progress: Progress;
|
||||||
status: Status;
|
status: Status;
|
||||||
score: number;
|
score: number;
|
||||||
|
exceptionMessage: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum Status {
|
export enum Status {
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
export class RulePerJob {
|
export class RulePerJob {
|
||||||
rule_name: string;
|
rule_name: string;
|
||||||
rule_description: string;
|
|
||||||
rule_weight: number;
|
rule_weight: number;
|
||||||
guidelines: string;
|
guidelines: string;
|
||||||
rule_status: Status;
|
rule_status: Status;
|
||||||
|
|
||||||
|
"requirement_level": string;
|
||||||
|
"description": string;
|
||||||
|
"fair_principles": string;
|
||||||
|
"fair_principles_tooltip": string;
|
||||||
|
"link": string;
|
||||||
|
|
||||||
passed_records: number;
|
passed_records: number;
|
||||||
failed_records: number;
|
failed_records: number;
|
||||||
// warnings: string[];
|
// warnings: string[];
|
||||||
|
|
|
@ -15,8 +15,16 @@
|
||||||
<tbody class="uk-text-small">
|
<tbody class="uk-text-small">
|
||||||
<tr *ngFor="let ruleResult of rules">
|
<tr *ngFor="let ruleResult of rules">
|
||||||
<td>
|
<td>
|
||||||
<div>{{ruleResult.rule_name ? ruleResult.rule_name : '-'}}</div>
|
<div>
|
||||||
<div *ngIf="ruleResult.rule_description" class="uk-text-small uk-text-meta">{{ruleResult.rule_description}}</div>
|
<span>{{ruleResult.rule_name ? ruleResult.rule_name : '-'}}</span>
|
||||||
|
<span *ngIf="ruleResult.requirement_level">
|
||||||
|
<span> (</span>
|
||||||
|
<ng-container *ngIf="requirementLevelMapping.has(ruleResult.requirement_level)">{{requirementLevelMapping.get(ruleResult.requirement_level)}}</ng-container>
|
||||||
|
<ng-container *ngIf="!requirementLevelMapping.has(ruleResult.requirement_level)">{{ruleResult.requirement_level}}</ng-container>
|
||||||
|
<span>)</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div *ngIf="ruleResult.description" class="uk-text-small uk-text-meta">{{ruleResult.description}}</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="uk-text-center uk-text-normal">
|
<td class="uk-text-center uk-text-normal">
|
||||||
<!-- <span uk-tooltip="Findable">F</span>-->
|
<!-- <span uk-tooltip="Findable">F</span>-->
|
||||||
|
@ -26,7 +34,8 @@
|
||||||
<!-- <span uk-tooltip="Interoperable">I</span>-->
|
<!-- <span uk-tooltip="Interoperable">I</span>-->
|
||||||
<!-- <span>, </span>-->
|
<!-- <span>, </span>-->
|
||||||
<!-- <span uk-tooltip="Reusable">R</span>-->
|
<!-- <span uk-tooltip="Reusable">R</span>-->
|
||||||
-
|
<span *ngIf="ruleResult.fair_principles" [attr.uk-tooltip]="ruleResult.fair_principles_tooltip">{{ruleResult.fair_principles}}</span>
|
||||||
|
<span *ngIf="!ruleResult.fair_principles">-</span>
|
||||||
</td>
|
</td>
|
||||||
<!-- <td class="uk-text-center">{{(ruleResult.rule_weight != undefined && ruleResult.rule_weight != null) ? ruleResult.rule_weight : '-'}}</td>-->
|
<!-- <td class="uk-text-center">{{(ruleResult.rule_weight != undefined && ruleResult.rule_weight != null) ? ruleResult.rule_weight : '-'}}</td>-->
|
||||||
<!-- <td class="uk-text-center">{{ruleResult.passed_records | number}}/{{(ruleResult.passed_records+ruleResult.failed_records) | number}}</td>-->
|
<!-- <td class="uk-text-center">{{ruleResult.passed_records | number}}/{{(ruleResult.passed_records+ruleResult.failed_records) | number}}</td>-->
|
||||||
|
@ -198,10 +207,34 @@
|
||||||
<div class="uk-sticky" uk-sticky="end: true" [attr.offset]="offset">
|
<div class="uk-sticky" uk-sticky="end: true" [attr.offset]="offset">
|
||||||
<div class="uk-overflow-auto uk-height-1-1 uk-padding">
|
<div class="uk-overflow-auto uk-height-1-1 uk-padding">
|
||||||
<div class="uk-card uk-card-default">
|
<div class="uk-card uk-card-default">
|
||||||
|
<div class="uk-card-body uk-card-small">
|
||||||
|
<div class="uk-flex uk-flex-middle">
|
||||||
|
<icon name="link" ratio="1.2" class="uk-text-background"></icon>
|
||||||
|
<div class="uk-margin-left uk-width-expand uk-text-break">
|
||||||
|
<div class="uk-text-meta uk-text-xsmall">Base url</div>
|
||||||
|
<div class="uk-text-primary uk-text-bold uk-text-default">{{jobResult.baseUrl}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div *ngIf="jobResult.set" class="uk-margin-top uk-card uk-card-default">
|
||||||
|
<div class="uk-card-body uk-card-small">
|
||||||
|
<div class="uk-flex uk-flex-middle">
|
||||||
|
<icon name="workspaces" ratio="1.2" class="uk-text-background"></icon>
|
||||||
|
<div class="uk-margin-left uk-width-expand uk-text-break">
|
||||||
|
<div class="uk-text-meta uk-text-xsmall">Set</div>
|
||||||
|
<div class="uk-text-primary uk-text-bold uk-text-default">{{jobResult.set}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="uk-margin-top uk-card uk-card-default">
|
||||||
<div class="uk-card-body uk-card-small">
|
<div class="uk-card-body uk-card-small">
|
||||||
<div class="uk-flex uk-flex-middle">
|
<div class="uk-flex uk-flex-middle">
|
||||||
<icon name="gavel" ratio="1.2" class="uk-text-background"></icon>
|
<icon name="gavel" ratio="1.2" class="uk-text-background"></icon>
|
||||||
<div class="uk-margin-left">
|
<div class="uk-margin-left uk-width-expand uk-text-break">
|
||||||
<div class="uk-text-meta uk-text-xsmall">Guidelines</div>
|
<div class="uk-text-meta uk-text-xsmall">Guidelines</div>
|
||||||
<div class="uk-text-primary uk-text-bold uk-text-default">{{jobResult.guidelines}}</div>
|
<div class="uk-text-primary uk-text-bold uk-text-default">{{jobResult.guidelines}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -212,7 +245,7 @@
|
||||||
<div class="uk-card-body uk-card-small">
|
<div class="uk-card-body uk-card-small">
|
||||||
<div class="uk-flex uk-flex-top">
|
<div class="uk-flex uk-flex-top">
|
||||||
<icon name="today" ratio="1.2" class="uk-text-background"></icon>
|
<icon name="today" ratio="1.2" class="uk-text-background"></icon>
|
||||||
<div class="uk-margin-left">
|
<div class="uk-margin-left uk-width-expand uk-text-break">
|
||||||
<div class="uk-text-meta uk-text-xsmall">Started</div>
|
<div class="uk-text-meta uk-text-xsmall">Started</div>
|
||||||
<div class="uk-text-primary uk-text-bold uk-text-default">{{jobResult.startDate | date: 'yyyy-MM-dd, HH:mm:ss'}}</div>
|
<div class="uk-text-primary uk-text-bold uk-text-default">{{jobResult.startDate | date: 'yyyy-MM-dd, HH:mm:ss'}}</div>
|
||||||
<div class="uk-text-meta uk-text-xsmall uk-margin-small-top"><span *ngIf="!jobResult.endDate">Not yet </span>Ended</div>
|
<div class="uk-text-meta uk-text-xsmall uk-margin-small-top"><span *ngIf="!jobResult.endDate">Not yet </span>Ended</div>
|
||||||
|
@ -225,7 +258,7 @@
|
||||||
<div class="uk-card-body uk-card-small">
|
<div class="uk-card-body uk-card-small">
|
||||||
<div class="uk-flex uk-flex-middle">
|
<div class="uk-flex uk-flex-middle">
|
||||||
<icon name="schedule" ratio="1.2" class="uk-text-background"></icon>
|
<icon name="schedule" ratio="1.2" class="uk-text-background"></icon>
|
||||||
<div class="uk-margin-left">
|
<div class="uk-margin-left uk-width-expand uk-text-break">
|
||||||
<div class="uk-text-meta uk-text-xsmall">Duration</div>
|
<div class="uk-text-meta uk-text-xsmall">Duration</div>
|
||||||
<div class="uk-text-primary uk-text-bold uk-text-default" [title]="jobResult.progress" [attr.uk-tooltip]="!jobResult.endDate ? 'cls: uk-active' : 'cls: uk-invisible'">
|
<div class="uk-text-primary uk-text-bold uk-text-default" [title]="jobResult.progress" [attr.uk-tooltip]="!jobResult.endDate ? 'cls: uk-active' : 'cls: uk-invisible'">
|
||||||
<span *ngIf="jobDuration.years">{{jobDuration.years}} years</span>
|
<span *ngIf="jobDuration.years">{{jobDuration.years}} years</span>
|
||||||
|
|
|
@ -53,6 +53,14 @@ export class OaipmhAnalysisComponent implements OnInit {
|
||||||
['OpenAIRE FAIR Guidelines for Data Repositories Profile', 'oai_datacite']
|
['OpenAIRE FAIR Guidelines for Data Repositories Profile', 'oai_datacite']
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
public requirementLevelMapping: Map<string, string> = new Map([
|
||||||
|
["MANDATORY", "M"],
|
||||||
|
["MANDATORY_IF_APPLICABLE", "MA"],
|
||||||
|
["RECOMMENDED", "R"],
|
||||||
|
["OPTIONAL", "O"]
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
constructor(private route: ActivatedRoute, private cdr: ChangeDetectorRef, private validator: OaipmhValidatorService) {}
|
constructor(private route: ActivatedRoute, private cdr: ChangeDetectorRef, private validator: OaipmhValidatorService) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
@ -100,6 +108,32 @@ export class OaipmhAnalysisComponent implements OnInit {
|
||||||
new Map<string, {"analysisResult": RulePerJob[], "successfulAnalysisResult": RulePerJob[], "warningAnalysisResult": RulePerJob[], "failedAnalysisResult": RulePerJob[] }>;
|
new Map<string, {"analysisResult": RulePerJob[], "successfulAnalysisResult": RulePerJob[], "warningAnalysisResult": RulePerJob[], "failedAnalysisResult": RulePerJob[] }>;
|
||||||
|
|
||||||
for(let rulePerJob of result) {
|
for(let rulePerJob of result) {
|
||||||
|
if(rulePerJob.fair_principles) {
|
||||||
|
if(rulePerJob.fair_principles.includes("F")) {
|
||||||
|
rulePerJob.fair_principles_tooltip = "Findable";
|
||||||
|
}
|
||||||
|
if(rulePerJob.fair_principles.includes("F") &&
|
||||||
|
(rulePerJob.fair_principles.includes("A") || rulePerJob.fair_principles.includes("I") || rulePerJob.fair_principles.includes("R"))) {
|
||||||
|
rulePerJob.fair_principles_tooltip += ", ";
|
||||||
|
}
|
||||||
|
if(rulePerJob.fair_principles.includes("A")) {
|
||||||
|
rulePerJob.fair_principles_tooltip += "Accessible";
|
||||||
|
}
|
||||||
|
if(rulePerJob.fair_principles.includes("A") &&
|
||||||
|
(rulePerJob.fair_principles.includes("I") || rulePerJob.fair_principles.includes("R"))) {
|
||||||
|
rulePerJob.fair_principles_tooltip += ", ";
|
||||||
|
}
|
||||||
|
if(rulePerJob.fair_principles.includes("I")) {
|
||||||
|
rulePerJob.fair_principles_tooltip += "Interoperable";
|
||||||
|
}
|
||||||
|
if(rulePerJob.fair_principles.includes("I") && rulePerJob.fair_principles.includes("R")) {
|
||||||
|
rulePerJob.fair_principles_tooltip += ", ";
|
||||||
|
}
|
||||||
|
if(rulePerJob.fair_principles.includes("R")) {
|
||||||
|
rulePerJob.fair_principles_tooltip += "Reusable";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!validationResult.has(rulePerJob.guidelines)) {
|
if(!validationResult.has(rulePerJob.guidelines)) {
|
||||||
validationResult.set(rulePerJob.guidelines, {analysisResult: [], successfulAnalysisResult: [], warningAnalysisResult: [], failedAnalysisResult: []});
|
validationResult.set(rulePerJob.guidelines, {analysisResult: [], successfulAnalysisResult: [], warningAnalysisResult: [], failedAnalysisResult: []});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,12 @@
|
||||||
<div class="uk-margin-large-top">
|
<div class="uk-margin-large-top">
|
||||||
<h1 class="uk-h5">Validator's History</h1>
|
<h1 class="uk-h5">Validator's History</h1>
|
||||||
|
|
||||||
<div *ngIf="!result" class="uk-alert uk-alert-primary">
|
<!-- <paging-prev-next totalResults="20" baseUrl="/oaipmh-history"></paging-prev-next>-->
|
||||||
|
|
||||||
|
<div *ngIf="!results || results.length == 0" class="uk-alert uk-alert-primary">
|
||||||
No validated metadata record yet
|
No validated metadata record yet
|
||||||
</div>
|
</div>
|
||||||
<div *ngIf="result" class="uk-margin-large-top">
|
<div *ngIf="results && results.length > 0" class="uk-margin-large-top">
|
||||||
<table class="uk-table uk-table-middle uk-table-divider uk-table-striped">
|
<table class="uk-table uk-table-middle uk-table-divider uk-table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -21,11 +23,11 @@
|
||||||
<th class="uk-text-center uk-width-medium">Guidelines</th>
|
<th class="uk-text-center uk-width-medium">Guidelines</th>
|
||||||
<!-- <th class="uk-text-center uk-width-small">Progress</th>-->
|
<!-- <th class="uk-text-center uk-width-small">Progress</th>-->
|
||||||
<th class="uk-text-center uk-width-small">Status</th>
|
<th class="uk-text-center uk-width-small">Status</th>
|
||||||
<th class="uk-width-medium">Actions</th>
|
<!-- <th class="uk-width-medium">Actions</th>-->
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr *ngFor="let result of results">
|
||||||
<td class="uk-text-truncate">{{result.baseUrl}}</td>
|
<td class="uk-text-truncate">{{result.baseUrl}}</td>
|
||||||
<!-- <td class="uk-text-center">{{result.score ? result.score : '-'}}</td>-->
|
<!-- <td class="uk-text-center">{{result.score ? result.score : '-'}}</td>-->
|
||||||
<!-- <td *ngIf="result.fairScore" class="uk-text-center">{{result.fairScore ? result.fairScore : '-'}}</td>-->
|
<!-- <td *ngIf="result.fairScore" class="uk-text-center">{{result.fairScore ? result.fairScore : '-'}}</td>-->
|
||||||
|
@ -34,27 +36,52 @@
|
||||||
<!-- <td class="uk-text-center">{{result.progress}}</td>-->
|
<!-- <td class="uk-text-center">{{result.progress}}</td>-->
|
||||||
<!-- <td class="uk-text-center">{{result.status}}</td>-->
|
<!-- <td class="uk-text-center">{{result.status}}</td>-->
|
||||||
<td class="uk-text-center">
|
<td class="uk-text-center">
|
||||||
<span *ngIf="result.progress == Progress.COMPLETED"
|
<!-- <span *ngIf="result.progress == Progress.COMPLETED"-->
|
||||||
class="uk-label" [ngClass]="result.status == Status.SUCCESS ? 'uk-label-success' : 'uk-label-danger'">
|
<!-- class="uk-label" [ngClass]="result.status == Status.SUCCESS ? 'uk-label-success' : 'uk-label-danger'">-->
|
||||||
{{result.status}}
|
<!-- {{result.status}}-->
|
||||||
</span>
|
<!-- </span>-->
|
||||||
<span *ngIf="result.progress != Progress.COMPLETED"
|
<a *ngIf="result.progress == Progress.COMPLETED" class="clickable uk-text-success"
|
||||||
class="uk-label" [ngClass]="result.progress == Progress.IN_PROGRESS ? 'uk-label-warning' : 'uk-label-danger'">
|
|
||||||
{{result.progress}}
|
|
||||||
</span>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a class="uk-button-link uk-flex uk-flex-middle" [ngClass]="result.progress != Progress.COMPLETED ? 'uk-disabled uk-link-muted' : ''"
|
|
||||||
routerLink="/oaipmh-analysis" [queryParams]="{'jobId': result.id}">
|
routerLink="/oaipmh-analysis" [queryParams]="{'jobId': result.id}">
|
||||||
<icon name="visibility" flex="true" class="uk-margin-small-right"></icon>
|
View results
|
||||||
<ng-container>View Results</ng-container>
|
<!-- <ng-container *ngIf="validationAnalysis">Hide Results</ng-container>-->
|
||||||
<!-- <ng-container *ngIf="validationAnalysis">Hide Results</ng-container>-->
|
|
||||||
</a>
|
</a>
|
||||||
|
<span *ngIf="result.progress == Progress.IN_PROGRESS" class="uk-text-warning">
|
||||||
|
In progess
|
||||||
|
</span>
|
||||||
|
<span *ngIf="result.progress == Progress.STOPPED && result.status != Status.FAILURE && !result.exceptionMessage" class="uk-text-danger">
|
||||||
|
Stopped
|
||||||
|
</span>
|
||||||
|
<span *ngIf="result.status == Status.FAILURE && !result.exceptionMessage && result.progress != Progress.COMPLETED" class="uk-text-danger">
|
||||||
|
Error
|
||||||
|
</span>
|
||||||
|
<span *ngIf="result.exceptionMessage" class="clickable uk-text-danger" (click)="viewErrors(result.exceptionMessage)">
|
||||||
|
Errors
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
|
<!-- <td>-->
|
||||||
|
<!-- <a class="uk-button-link uk-flex uk-flex-middle" [ngClass]="result.progress != Progress.COMPLETED ? 'uk-disabled uk-link-muted' : ''"-->
|
||||||
|
<!-- routerLink="/oaipmh-analysis" [queryParams]="{'jobId': result.id}">-->
|
||||||
|
<!-- <icon name="visibility" flex="true" class="uk-margin-small-right"></icon>-->
|
||||||
|
<!-- <ng-container>View Results</ng-container>-->
|
||||||
|
<!--<!– <ng-container *ngIf="validationAnalysis">Hide Results</ng-container>–>-->
|
||||||
|
<!-- </a>-->
|
||||||
|
<!-- </td>-->
|
||||||
<!-- SUCCESS, FAILURE, IN_PROGRESS, COMPLETED, STOPPED-->
|
<!-- SUCCESS, FAILURE, IN_PROGRESS, COMPLETED, STOPPED-->
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div *ngIf="warning" class="uk-alert uk-alert-warning">Please reload the page to get the updated status.</div>
|
||||||
|
|
||||||
|
<modal-alert #errorsModal large="true" (alertOutput)="errorsModalOpen=false" classTitle="uk-border-bottom">
|
||||||
|
<div *ngIf="errorsModalOpen" class="uk-modal-body uk-height-min-medium uk-width-expand">
|
||||||
|
<div *ngIf="!error">No errors available</div>
|
||||||
|
<div *ngIf="error" [class.uk-margin-medium-bottom]="error">
|
||||||
|
<div class="uk-text-danger">{{error}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</modal-alert>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component, OnInit} from '@angular/core';
|
import {Component, OnInit, ViewChild} from '@angular/core';
|
||||||
import {OaipmhValidatorService} from "../../../services/oaipmh-validator.service";
|
import {OaipmhValidatorService} from "../../../services/oaipmh-validator.service";
|
||||||
import {JobResult, Progress, Status} from "../../entities/JobResult";
|
import {JobResult, Progress, Status} from "../../entities/JobResult";
|
||||||
import {ActivatedRoute} from "@angular/router";
|
import {ActivatedRoute} from "@angular/router";
|
||||||
|
@ -12,10 +12,16 @@ import {filter, repeat, take} from "rxjs/operators";
|
||||||
styleUrls: ['./oaipmh-history.component.less']
|
styleUrls: ['./oaipmh-history.component.less']
|
||||||
})
|
})
|
||||||
export class OaipmhHistoryComponent implements OnInit {
|
export class OaipmhHistoryComponent implements OnInit {
|
||||||
public result: JobResult;
|
public warning: boolean = false;
|
||||||
|
public results: JobResult[];
|
||||||
public jobId: string = "";
|
public jobId: string = "";
|
||||||
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Validator\'s History'}];
|
public breadcrumbs: Breadcrumb[] = [{name: 'home', route: '/'}, {name: 'Validator\'s History'}];
|
||||||
protected readonly Progress = Progress;
|
protected readonly Progress = Progress;
|
||||||
|
protected readonly Status = Status;
|
||||||
|
|
||||||
|
@ViewChild('errorsModal') errorsModal;
|
||||||
|
public errorsModalOpen: boolean = false;
|
||||||
|
public error: string = null;
|
||||||
|
|
||||||
subscriptions = [];
|
subscriptions = [];
|
||||||
|
|
||||||
|
@ -24,11 +30,13 @@ export class OaipmhHistoryComponent implements OnInit {
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
||||||
this.jobId = params['jobId'];
|
this.jobId = params['jobId'];
|
||||||
this.result = null;
|
this.results = [];
|
||||||
|
this.warning = false;
|
||||||
if(!this.jobId) {
|
if(!this.jobId) {
|
||||||
this.jobId = "825";
|
this.getJobResults();
|
||||||
}
|
} else {
|
||||||
this.getJobResult();
|
this.getJobResult();
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,11 +49,18 @@ export class OaipmhHistoryComponent implements OnInit {
|
||||||
}
|
}
|
||||||
|
|
||||||
public getJobResult() {
|
public getJobResult() {
|
||||||
|
let count: number = 0;
|
||||||
this.subscriptions.push(this.validator.getJobResult(this.jobId)
|
this.subscriptions.push(this.validator.getJobResult(this.jobId)
|
||||||
.pipe(
|
.pipe(
|
||||||
repeat({ delay: 5000 }),
|
repeat({ delay: 5000 }),
|
||||||
filter((result: JobResult) => {
|
filter((result: JobResult) => {
|
||||||
this.result = result;
|
this.results = [];
|
||||||
|
this.results.push(result);
|
||||||
|
count++;
|
||||||
|
if(count == 120 && result.progress == Progress.IN_PROGRESS) {
|
||||||
|
this.warning = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
return result.progress !== Progress.IN_PROGRESS
|
return result.progress !== Progress.IN_PROGRESS
|
||||||
}),
|
}),
|
||||||
take(1)
|
take(1)
|
||||||
|
@ -54,5 +69,25 @@ export class OaipmhHistoryComponent implements OnInit {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly Status = Status;
|
public getJobResults() {
|
||||||
|
this.subscriptions.push(this.validator.getJobResults().subscribe(
|
||||||
|
(results: JobResult[]) => {
|
||||||
|
this.results = results;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public viewErrors(error: string) {
|
||||||
|
this.error = error;
|
||||||
|
this.openErrorsModal();
|
||||||
|
this.errorsModalOpen = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public openErrorsModal() {
|
||||||
|
this.errorsModalOpen = true;
|
||||||
|
this.errorsModal.cancelButton = false;
|
||||||
|
this.errorsModal.okButton = false;
|
||||||
|
this.errorsModal.alertTitle = "Errors";
|
||||||
|
this.errorsModal.open();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import {JobResult} from "../../entities/JobResult";
|
||||||
import {Router} from "@angular/router";
|
import {Router} from "@angular/router";
|
||||||
import {Subscriber} from "rxjs";
|
import {Subscriber} from "rxjs";
|
||||||
|
|
||||||
|
declare var UIkit: any;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-oaipmh-validator',
|
selector: 'app-oaipmh-validator',
|
||||||
templateUrl: './oaipmh-validator.component.html',
|
templateUrl: './oaipmh-validator.component.html',
|
||||||
|
@ -18,7 +20,7 @@ export class OaipmhValidatorComponent implements OnInit {
|
||||||
@ViewChild("right_sidebar_footer") right_sidebar_footer;
|
@ViewChild("right_sidebar_footer") right_sidebar_footer;
|
||||||
|
|
||||||
public options: Option[] = [
|
public options: Option[] = [
|
||||||
{label: 'OpenAIRE Guidelines for Data Archives Profile v2', value: 'OpenAIRE Guidelines for Data Archives Profile v2'},
|
{label: 'OpenAIRE Guidelines for Data Archives Profile v2 & OpenAIRE FAIR Guidelines for Data Repositories Profile', value: 'OpenAIRE Guidelines for Data Archives Profile v2'},
|
||||||
{label: 'OpenAIRE Guidelines for Literature Repositories Profile v3', value: 'OpenAIRE Guidelines for Literature Repositories Profile v3'},
|
{label: 'OpenAIRE Guidelines for Literature Repositories Profile v3', value: 'OpenAIRE Guidelines for Literature Repositories Profile v3'},
|
||||||
{label: 'OpenAIRE Guidelines for Literature Repositories Profile v4', value: 'OpenAIRE Guidelines for Literature Repositories Profile v4'},
|
{label: 'OpenAIRE Guidelines for Literature Repositories Profile v4', value: 'OpenAIRE Guidelines for Literature Repositories Profile v4'},
|
||||||
{label: 'OpenAIRE FAIR Guidelines for Data Repositories Profile', value: 'OpenAIRE FAIR Guidelines for Data Repositories Profile'}
|
{label: 'OpenAIRE FAIR Guidelines for Data Repositories Profile', value: 'OpenAIRE FAIR Guidelines for Data Repositories Profile'}
|
||||||
|
@ -40,7 +42,7 @@ export class OaipmhValidatorComponent implements OnInit {
|
||||||
private cdr: ChangeDetectorRef,
|
private cdr: ChangeDetectorRef,
|
||||||
private validator: OaipmhValidatorService) {
|
private validator: OaipmhValidatorService) {
|
||||||
this.form = this.fb.group({
|
this.form = this.fb.group({
|
||||||
url: this.fb.control("", StringUtils.urlValidator()),//[Validators.required/*, Validators.email*/]),
|
url: this.fb.control("", [Validators.required, StringUtils.urlValidator()]),//[Validators.required/*, Validators.email*/]),
|
||||||
guidelines: this.fb.control("", Validators.required),
|
guidelines: this.fb.control("", Validators.required),
|
||||||
recordsNum: this.fb.control(null, Validators.required),
|
recordsNum: this.fb.control(null, Validators.required),
|
||||||
set: this.fb.control('all', Validators.required)
|
set: this.fb.control('all', Validators.required)
|
||||||
|
@ -113,9 +115,21 @@ export class OaipmhValidatorComponent implements OnInit {
|
||||||
this.router.navigate(['/oaipmh-history'], {
|
this.router.navigate(['/oaipmh-history'], {
|
||||||
queryParams: { 'jobId': result.id }
|
queryParams: { 'jobId': result.id }
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
error => {
|
||||||
|
// if(error.status == 400) {
|
||||||
|
UIkit.notification((error.error && error.error.message) ? error.error.message: error.message, {
|
||||||
|
status: 'danger',
|
||||||
|
timeout: 4000,
|
||||||
|
pos: 'bottom-right'
|
||||||
|
});
|
||||||
|
// }
|
||||||
|
// if(error.status == 422) {
|
||||||
|
// this.router.navigate(['/oaipmh-history'], {
|
||||||
|
// queryParams: { 'jobId': error.error.id }
|
||||||
|
// })
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected readonly innerHeight = innerHeight;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,11 @@ export class OaipmhValidatorService {
|
||||||
return this.http.get(url);
|
return this.http.get(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getJobResults(limit: number = 200) {
|
||||||
|
let url: string = environment.validatorAPI + "jobs/latest?limit="+limit;
|
||||||
|
return this.http.get(url);
|
||||||
|
}
|
||||||
|
|
||||||
getSets(baseUrl) {
|
getSets(baseUrl) {
|
||||||
let url: string = environment.validatorAPI + "getSets?baseUrl="+baseUrl;
|
let url: string = environment.validatorAPI + "getSets?baseUrl="+baseUrl;
|
||||||
return this.http.get(url).pipe(map(res => res['set']));
|
return this.http.get(url).pipe(map(res => res['set']));
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
<a routerLink="/oaipmh">Validate [demo]</a>
|
<a routerLink="/oaipmh">Validate [demo]</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="uk-parent">
|
<li class="uk-parent">
|
||||||
<a routerLink="/oaipmh-history" [queryParams]="{jobId: 825}">History [demo]</a>
|
<a routerLink="/oaipmh-history">History [demo]</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="uk-parent">
|
<li class="uk-parent">
|
||||||
<a routerLink="/oaipmh-analysis" [queryParams]="{jobId: 825}">Analysis [demo]</a>
|
<a routerLink="/oaipmh-analysis" [queryParams]="{jobId: 825}">Analysis [demo]</a>
|
||||||
|
|
Loading…
Reference in New Issue