DMP Overview. Provide user feedback of invalid datasets on finalize. Prevent user from submitting invalid Datasets.
This commit is contained in:
parent
1d5befaf6a
commit
9eb1c12afd
|
@ -90,6 +90,10 @@ export class DatasetService {
|
|||
return this.httpClient.get(this.actionUrl + 'getPDF/' + id, { responseType: 'blob', observe: 'response', headers: headerPdf });
|
||||
}
|
||||
|
||||
public validateDataset(id: string) : Observable<any>{
|
||||
return this.http.get<any>(this.actionUrl+id+"/validate");
|
||||
}
|
||||
|
||||
//GK: NO
|
||||
// public downloadJson(id: string): Observable<HttpResponse<Blob>> {
|
||||
// return this.httpClient.get(this.actionUrl + 'rda/' + id, { responseType: 'blob', observe: 'response' });
|
||||
|
|
|
@ -30,8 +30,14 @@
|
|||
<mat-icon *ngIf="dataset.status == 0" class="col-1 draft-bookmark">bookmark</mat-icon>
|
||||
<mat-icon *ngIf="dataset.status != 0" class="col-1 finalized-bookmark">bookmark</mat-icon>
|
||||
<h4 *ngIf="dataset.status == 0" class="col-11 ml-auto mt-1 mb-4">
|
||||
<span>{{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}:</span>
|
||||
{{ dataset.label }}</h4>
|
||||
<span>{{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}
|
||||
<ng-container *ngIf="datasetLookupStatus[dataset.id] && (datasetLookupStatus[dataset.id] === datasetLookupStatusEnum.INVALID)">
|
||||
({{'DMP-FINALISE-DIALOG.INVALID' | translate}})
|
||||
</ng-container>
|
||||
:</span>
|
||||
{{ dataset.label }}
|
||||
<i *ngIf="(datasetLookupStatus[dataset.id] != datasetLookupStatusEnum.INVALID) && (datasetLookupStatus[dataset.id] != datasetLookupStatusEnum.VALID) " class="fa fa-spinner fa-spin" ></i>
|
||||
</h4>
|
||||
<h4 *ngIf="dataset.status != 0" class="col-11 ml-auto mt-1 mb-4">{{ dataset.label }}</h4>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -39,11 +45,11 @@
|
|||
</mat-expansion-panel>
|
||||
</mat-accordion>
|
||||
|
||||
<div *ngIf="getDraftDatasets().length > 0" class="pt-4 pb-2">
|
||||
<div *ngIf="validDrafts.length > 0" class="pt-4 pb-2">
|
||||
<h4 class="pl-2">{{'DMP-FINALISE-DIALOG.FINALISE-TITLE' | translate}}</h4>
|
||||
<mat-selection-list #datasetsDraftSelectionList [(ngModel)]="outputModel.datasetsToBeFinalized">
|
||||
<div class="styleBorder" *ngFor="let dataset of getDraftDatasets()">
|
||||
<mat-list-option [value]='dataset.id'>
|
||||
<div class="styleBorder" *ngFor="let dataset of validDrafts">
|
||||
<mat-list-option [value]='dataset.id' [disabled]="!datasetLookupStatus[dataset.id] || (datasetLookupStatus[dataset.id] != datasetLookupStatusEnum.VALID)">
|
||||
{{ dataset.label }}
|
||||
</mat-list-option>
|
||||
</div>
|
||||
|
|
|
@ -4,6 +4,9 @@ import { Router } from '@angular/router';
|
|||
import { DatasetStatus } from '@app/core/common/enum/dataset-status';
|
||||
import { DatasetService } from '@app/core/services/dataset/dataset.service';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
import { Observable, of } from 'rxjs';
|
||||
import { catchError, map, takeUntil } from 'rxjs/operators';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-finalize-dialog-component',
|
||||
|
@ -15,6 +18,8 @@ export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit
|
|||
inputModel: DmpFinalizeDialogInput;
|
||||
outputModel: DmpFinalizeDialogOutput;
|
||||
|
||||
protected datasetLookupStatus:DatasetStatusLookup[] = [];
|
||||
protected datasetLookupStatusEnum = DatasetStatusLookup;
|
||||
constructor(
|
||||
public router: Router,
|
||||
public dialogRef: MatDialogRef<DmpFinalizeDialogComponent>,
|
||||
|
@ -26,7 +31,30 @@ export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit
|
|||
this.outputModel = { datasetsToBeFinalized: [] };
|
||||
}
|
||||
|
||||
ngOnInit(): void { }
|
||||
ngOnInit(): void {
|
||||
this.inputModel.datasets.forEach(ds=>{
|
||||
|
||||
this.validateDataset(ds.id).subscribe(_=>{
|
||||
console.log('response', _);
|
||||
});
|
||||
})
|
||||
|
||||
const drafts = this.getDraftDatasets();
|
||||
|
||||
drafts.forEach(draft=>{
|
||||
this.datasetLookupStatus[draft.id] == DatasetStatusLookup.PENDING_VALIDATION;
|
||||
this.validateDataset(draft.id)
|
||||
.subscribe(isValid=>{
|
||||
if(isValid){
|
||||
this.datasetLookupStatus[draft.id] = DatasetStatusLookup.VALID;
|
||||
}else{
|
||||
this.datasetLookupStatus[draft.id] = DatasetStatusLookup.INVALID;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
onSubmit() {
|
||||
this.dialogRef.close(this.outputModel);
|
||||
|
@ -43,6 +71,24 @@ export class DmpFinalizeDialogComponent extends BaseComponent implements OnInit
|
|||
close() {
|
||||
this.dialogRef.close({ cancelled: true } as DmpFinalizeDialogOutput);
|
||||
}
|
||||
|
||||
validateDataset(datasetId: string) : Observable<boolean>{
|
||||
return this.datasetService
|
||||
.validateDataset(datasetId)
|
||||
.pipe(
|
||||
takeUntil(this._destroyed),
|
||||
map(_=>{
|
||||
return true
|
||||
}),
|
||||
catchError(error=>{
|
||||
return of(false);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
get validDrafts(){
|
||||
return this.getDraftDatasets().filter(x=> this.datasetLookupStatus[x.id] && (this.datasetLookupStatus[x.id] == DatasetStatusLookup.VALID));
|
||||
}
|
||||
}
|
||||
|
||||
export interface DmpFinalizeDialogInput {
|
||||
|
@ -61,3 +107,8 @@ export interface DmpFinalizeDialogOutput {
|
|||
cancelled?: boolean;
|
||||
datasetsToBeFinalized?: string[];
|
||||
}
|
||||
enum DatasetStatusLookup{
|
||||
VALID = "VALID",
|
||||
INVALID = "INVALID",
|
||||
PENDING_VALIDATION = "PENDING"
|
||||
}
|
||||
|
|
|
@ -1652,7 +1652,8 @@
|
|||
"AT-LEAST-ONE-DATASET-FINALISED": "Sie müssen mindestens eine Datensatzbeschreibung fertiggestellt haben"
|
||||
},
|
||||
"IMPACT": "Mit dieser Aktion wird Ihr DMP fertiggestellt und Sie werden ihn nicht erneut bearbeiten können.",
|
||||
"AFTER-FINALIZATION": "Nach der Fertigstellung Ihres DMP können Sie ihn veröffentlichen, wodurch er für das ARGOS Programm öffentlich zugänglich sein wird."
|
||||
"AFTER-FINALIZATION": "Nach der Fertigstellung Ihres DMP können Sie ihn veröffentlichen, wodurch er für das ARGOS Programm öffentlich zugänglich sein wird.",
|
||||
"INVALID":"Invalid"
|
||||
},
|
||||
"DRAFTS": {
|
||||
"FOR-DMP": "Für DMP:",
|
||||
|
|
|
@ -1652,7 +1652,8 @@
|
|||
"AT-LEAST-ONE-DATASET-FINALISED": "You need to have at least one Dataset Finalized"
|
||||
},
|
||||
"IMPACT": "This action will finalize your DMP, and you won't be able to edit it again.",
|
||||
"AFTER-FINALIZATION": "After finalizing your DMP you can Publish it, and it'll be publicly available to the ARGOS tool."
|
||||
"AFTER-FINALIZATION": "After finalizing your DMP you can Publish it, and it'll be publicly available to the ARGOS tool.",
|
||||
"INVALID":"Invalid"
|
||||
},
|
||||
"DRAFTS": {
|
||||
"FOR-DMP": "For DMP:",
|
||||
|
|
|
@ -1652,7 +1652,8 @@
|
|||
"AT-LEAST-ONE-DATASET-FINALISED": "Necesita tener al menos una descripción del dataset finalizada"
|
||||
},
|
||||
"IMPACT": "Esta acción finaliza su PGD, y no podrá editarla otra vez. ",
|
||||
"AFTER-FINALIZATION": "Después de finalizar su PGD puede publicarlo, y estará disponible públicamente en la herramienta ARGOS."
|
||||
"AFTER-FINALIZATION": "Después de finalizar su PGD puede publicarlo, y estará disponible públicamente en la herramienta ARGOS.",
|
||||
"INVALID":"Invalid"
|
||||
},
|
||||
"DRAFTS": {
|
||||
"FOR-DMP": "Para el PGD:",
|
||||
|
|
|
@ -1652,7 +1652,8 @@
|
|||
"AT-LEAST-ONE-DATASET-FINALISED": "Πρέπει να έχετε οριστικοποιήσει τουλάχιστον μία Περιγραφή Συνόλου Δεδομένων."
|
||||
},
|
||||
"IMPACT": "Αυτή η επιλογή θα οριστικοποιήσει το Σχέδιο Διαχείρισης Δεδομένων σας και δε θα μπορείτε να το επεξεργαστείτε ξανά σε αυτήν την έκδοση.",
|
||||
"AFTER-FINALIZATION": "Μετά την οριστικοποίηση του Σχεδίου Διαχείρισης Δεδομένων σας, μπορείτε να το δημοσιεύσετε και να το διαθέσετε δημόσια στο εργαλείο ARGOS."
|
||||
"AFTER-FINALIZATION": "Μετά την οριστικοποίηση του Σχεδίου Διαχείρισης Δεδομένων σας, μπορείτε να το δημοσιεύσετε και να το διαθέσετε δημόσια στο εργαλείο ARGOS.",
|
||||
"INVALID":"Invalid"
|
||||
},
|
||||
"DRAFTS": {
|
||||
"FOR-DMP": "Για Σχέδιο Διαχείρισης Δεδομένων:",
|
||||
|
|
|
@ -1652,7 +1652,8 @@
|
|||
"AT-LEAST-ONE-DATASET-FINALISED": "Tem de ter pelo menos um Dataset Concluído"
|
||||
},
|
||||
"IMPACT": "Esta ação finalizará o seu PGD, não sendo possível a sua edição.",
|
||||
"AFTER-FINALIZATION": "Após a finalização do seu PGD poderá publicá-lo, e este ficará publicamente disponível na ferramenta ARGOS."
|
||||
"AFTER-FINALIZATION": "Após a finalização do seu PGD poderá publicá-lo, e este ficará publicamente disponível na ferramenta ARGOS.",
|
||||
"INVALID":"Invalid"
|
||||
},
|
||||
"DRAFTS": {
|
||||
"FOR-DMP": "Para PGD:",
|
||||
|
|
|
@ -1652,7 +1652,8 @@
|
|||
"AT-LEAST-ONE-DATASET-FINALISED": "Musíte mať dokončený aspoň jeden súbor dát"
|
||||
},
|
||||
"IMPACT": "Týmto krokom dokončíte svoj DMP a nebudete ho môcť znovu editovať.",
|
||||
"AFTER-FINALIZATION": "Po dokončení DMP ho budete môcť Zverejniť, čím bude verejne dostupný pre ARGOS nástroje ."
|
||||
"AFTER-FINALIZATION": "Po dokončení DMP ho budete môcť Zverejniť, čím bude verejne dostupný pre ARGOS nástroje .",
|
||||
"INVALID":"Invalid"
|
||||
},
|
||||
"DRAFTS": {
|
||||
"FOR-DMP": "Pre DMP:",
|
||||
|
|
|
@ -1652,7 +1652,8 @@
|
|||
"AT-LEAST-ONE-DATASET-FINALISED": "Bar jedan skup podataka mora da bude dovršen"
|
||||
},
|
||||
"IMPACT": "Ovim korakom se završava proces kreiranja plana upravljanja podacima i posle toga nećete biti u mogućnosti da ga menjate.",
|
||||
"AFTER-FINALIZATION": "Kada dovršite rad na Planu, možete ga objaviti i on će biti javno dostupan u Argosu."
|
||||
"AFTER-FINALIZATION": "Kada dovršite rad na Planu, možete ga objaviti i on će biti javno dostupan u Argosu.",
|
||||
"INVALID":"Invalid"
|
||||
},
|
||||
"DRAFTS": {
|
||||
"FOR-DMP": "Za Plan:",
|
||||
|
|
|
@ -1652,7 +1652,8 @@
|
|||
"AT-LEAST-ONE-DATASET-FINALISED": "En azından bir bitirilmiş Veri Seti tanımınız olmalı"
|
||||
},
|
||||
"IMPACT": "Bu işlem VYP'nızı sonlandıracak ve onu tekrar düzenleyemeyeceksiniz.",
|
||||
"AFTER-FINALIZATION": "VYP'nızı tamamladıktan sonra onu yayınlayabilirsiniz, plan ARGOS içinde herkese açık olacaktır."
|
||||
"AFTER-FINALIZATION": "VYP'nızı tamamladıktan sonra onu yayınlayabilirsiniz, plan ARGOS içinde herkese açık olacaktır.",
|
||||
"INVALID":"Invalid"
|
||||
},
|
||||
"DRAFTS": {
|
||||
"FOR-DMP": "For DMP:",
|
||||
|
|
Loading…
Reference in New Issue