diff --git a/dmp-frontend/src/app/core/services/dataset/dataset.service.ts b/dmp-frontend/src/app/core/services/dataset/dataset.service.ts index b56e3b19c..418196418 100644 --- a/dmp-frontend/src/app/core/services/dataset/dataset.service.ts +++ b/dmp-frontend/src/app/core/services/dataset/dataset.service.ts @@ -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{ + return this.http.get(this.actionUrl+id+"/validate"); + } + //GK: NO // public downloadJson(id: string): Observable> { // return this.httpClient.get(this.actionUrl + 'rda/' + id, { responseType: 'blob', observe: 'response' }); diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html index 9fdff3056..68021e4cf 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.html @@ -30,8 +30,14 @@ bookmark bookmark

- {{ 'TYPES.DATASET-STATUS.DRAFT' | translate }}: - {{ dataset.label }}

+ {{ 'TYPES.DATASET-STATUS.DRAFT' | translate }} + + ({{'DMP-FINALISE-DIALOG.INVALID' | translate}}) + + : + {{ dataset.label }} + +

{{ dataset.label }}

@@ -39,11 +45,11 @@ -
+

{{'DMP-FINALISE-DIALOG.FINALISE-TITLE' | translate}}

-
- +
+ {{ dataset.label }}
diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.ts index c8aca013d..f16ff8747 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-finalize-dialog/dmp-finalize-dialog.component.ts @@ -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, @@ -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{ + 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" +} diff --git a/dmp-frontend/src/assets/i18n/de.json b/dmp-frontend/src/assets/i18n/de.json index a26fbb35c..e56ce0dae 100644 --- a/dmp-frontend/src/assets/i18n/de.json +++ b/dmp-frontend/src/assets/i18n/de.json @@ -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:", diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index ac1f9a0f9..60e2bcaf6 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -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:", diff --git a/dmp-frontend/src/assets/i18n/es.json b/dmp-frontend/src/assets/i18n/es.json index 59a19697c..ffc05768a 100644 --- a/dmp-frontend/src/assets/i18n/es.json +++ b/dmp-frontend/src/assets/i18n/es.json @@ -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:", diff --git a/dmp-frontend/src/assets/i18n/gr.json b/dmp-frontend/src/assets/i18n/gr.json index d2b82edc5..6682eb0aa 100644 --- a/dmp-frontend/src/assets/i18n/gr.json +++ b/dmp-frontend/src/assets/i18n/gr.json @@ -1652,7 +1652,8 @@ "AT-LEAST-ONE-DATASET-FINALISED": "Πρέπει να έχετε οριστικοποιήσει τουλάχιστον μία Περιγραφή Συνόλου Δεδομένων." }, "IMPACT": "Αυτή η επιλογή θα οριστικοποιήσει το Σχέδιο Διαχείρισης Δεδομένων σας και δε θα μπορείτε να το επεξεργαστείτε ξανά σε αυτήν την έκδοση.", - "AFTER-FINALIZATION": "Μετά την οριστικοποίηση του Σχεδίου Διαχείρισης Δεδομένων σας, μπορείτε να το δημοσιεύσετε και να το διαθέσετε δημόσια στο εργαλείο ARGOS." + "AFTER-FINALIZATION": "Μετά την οριστικοποίηση του Σχεδίου Διαχείρισης Δεδομένων σας, μπορείτε να το δημοσιεύσετε και να το διαθέσετε δημόσια στο εργαλείο ARGOS.", + "INVALID":"Invalid" }, "DRAFTS": { "FOR-DMP": "Για Σχέδιο Διαχείρισης Δεδομένων:", diff --git a/dmp-frontend/src/assets/i18n/pt.json b/dmp-frontend/src/assets/i18n/pt.json index cdb87ee33..d0abb4fcd 100644 --- a/dmp-frontend/src/assets/i18n/pt.json +++ b/dmp-frontend/src/assets/i18n/pt.json @@ -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:", diff --git a/dmp-frontend/src/assets/i18n/sk.json b/dmp-frontend/src/assets/i18n/sk.json index 6d64be223..0322e0128 100644 --- a/dmp-frontend/src/assets/i18n/sk.json +++ b/dmp-frontend/src/assets/i18n/sk.json @@ -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:", diff --git a/dmp-frontend/src/assets/i18n/sr.json b/dmp-frontend/src/assets/i18n/sr.json index 37b7ca19b..200af832c 100644 --- a/dmp-frontend/src/assets/i18n/sr.json +++ b/dmp-frontend/src/assets/i18n/sr.json @@ -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:", diff --git a/dmp-frontend/src/assets/i18n/tr.json b/dmp-frontend/src/assets/i18n/tr.json index 7cf2bfd51..68cd741c4 100644 --- a/dmp-frontend/src/assets/i18n/tr.json +++ b/dmp-frontend/src/assets/i18n/tr.json @@ -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:",