From 5ddb7df2b49e439ffcbf647a52124a1f9ae6a701 Mon Sep 17 00:00:00 2001 From: Kristan Ntavidi Date: Tue, 20 Jul 2021 13:32:40 +0300 Subject: [PATCH 1/2] Finalize dataset from dataset editor. * Finalize dataset from dataset editor. * Finalize dataset on dataset overview redirects you to dataset editor * Grouping save action buttons --- .../src/app/core/common/enum/save-type.ts | 3 +- .../dataset-wizard.component.html | 15 +++- .../dataset-wizard.component.ts | 54 ++++++++++---- .../overview/dataset-overview.component.ts | 73 ++++++++++++------- .../table-of-contents-internal.ts | 5 +- .../table-of-contents.html | 2 +- .../table-of-contents.ts | 14 +++- dmp-frontend/src/assets/i18n/de.json | 13 +++- dmp-frontend/src/assets/i18n/en.json | 13 +++- dmp-frontend/src/assets/i18n/es.json | 13 +++- dmp-frontend/src/assets/i18n/gr.json | 13 +++- dmp-frontend/src/assets/i18n/pt.json | 13 +++- dmp-frontend/src/assets/i18n/sk.json | 13 +++- dmp-frontend/src/assets/i18n/sr.json | 13 +++- dmp-frontend/src/assets/i18n/tr.json | 13 +++- 15 files changed, 210 insertions(+), 60 deletions(-) diff --git a/dmp-frontend/src/app/core/common/enum/save-type.ts b/dmp-frontend/src/app/core/common/enum/save-type.ts index 897d86dd7..855a3109a 100644 --- a/dmp-frontend/src/app/core/common/enum/save-type.ts +++ b/dmp-frontend/src/app/core/common/enum/save-type.ts @@ -1,4 +1,5 @@ export enum SaveType { close = 0, - addNew = 1 + addNew = 1, + finalize = 2 } diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html index 9a894bd63..923de03f4 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.html @@ -33,10 +33,21 @@
- + + + + + + + + +
diff --git a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts index 0853efffb..c2207d5ce 100644 --- a/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts +++ b/dmp-frontend/src/app/ui/dataset/dataset-wizard/dataset-wizard.component.ts @@ -32,7 +32,7 @@ import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog import { TranslateService } from '@ngx-translate/core'; import * as FileSaver from 'file-saver'; import { Observable, of as observableOf, interval} from 'rxjs'; -import { catchError, debounceTime, map, takeUntil } from 'rxjs/operators'; +import { catchError, debounceTime, filter, map, takeUntil } from 'rxjs/operators'; import { LockService } from '@app/core/services/lock/lock.service'; import { Location } from '@angular/common'; import { LockModel } from '@app/core/model/lock/lock.model'; @@ -778,20 +778,47 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme } reverse() { - this.viewOnly = false; - this.datasetWizardModel.status = DatasetStatus.Draft; - setTimeout(x => { this.formGroup = null; }); - setTimeout(x => { - this.formGroup = this.datasetWizardModel.buildForm(); - this.registerFormListeners(); + + this.dialog.open(ConfirmationDialogComponent, { + data:{ + message: this.language.instant('DATASET-WIZARD.ACTIONS.UNDO-FINALIZATION-QUESTION'), + confirmButton: this.language.instant('DATASET-WIZARD.ACTIONS.CONFIRM'), + cancelButton: this.language.instant('DATASET-WIZARD.ACTIONS.REJECT'), + }, + maxWidth: '30em' + }) + .afterClosed() + .pipe( + filter(x=> x), + takeUntil(this._destroyed) + ).subscribe( _ => { + this.viewOnly = false; + this.datasetWizardModel.status = DatasetStatus.Draft; + setTimeout(x => { this.formGroup = null; }); + setTimeout(x => { + this.formGroup = this.datasetWizardModel.buildForm(); + this.registerFormListeners(); + }); }); + + } saveFinalize() { - this.formService.touchAllFormFields(this.formGroup); - if (!this.isFormValid()) { - this.showValidationErrorsDialog(); + // this.formService.touchAllFormFields(this.formGroup); + + if (!this.isSemiFormValid(this.formGroup) || (this.table0fContents && this.table0fContents.hasVisibleInvalidFields())) { + // this.showValidationErrorsDialog(); + this.dialog.open(FormValidationErrorsDialogComponent, { + data:{ + errorMessages:[this.language.instant('DATASET-WIZARD.MESSAGES.MISSING-FIELDS')] + } + }) + + + this.touchForm(); + this.hintErrors = true; return; } const dialogRef = this.dialog.open(ConfirmationDialogComponent, { @@ -805,9 +832,9 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme }); dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { if (result) { - if (!this.isFormValid()) { return; } + // if (!this.isFormValid()) { return; } this.formGroup.get('status').setValue(DatasetStatus.Finalized); - this.submit(); + this.submit(SaveType.finalize); } }); } @@ -819,10 +846,11 @@ export class DatasetWizardComponent extends CheckDeactivateBaseComponent impleme this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'new', this.formGroup.get('dmp').value.id]); }) } else if (saveType === this.saveAnd.close) { this.router.navigate(['/reload']).then(() => { this.router.navigate(['/plans', 'edit', this.formGroup.get('dmp').value.id]); }); + } else if (saveType === SaveType.finalize) { + this.router.navigate(['/reload']).then(() => { this.router.navigate(['/datasets', 'edit', data.id]); }); } else { this.datasetWizardModel = new DatasetWizardEditorModel().fromModel(data); this.editMode = this.datasetWizardModel.status === DatasetStatus.Draft; - // setTimeout(() => { this.formGroup = null; }); setTimeout(() => { this.formGroup.get('id').patchValue(data.id); diff --git a/dmp-frontend/src/app/ui/dataset/overview/dataset-overview.component.ts b/dmp-frontend/src/app/ui/dataset/overview/dataset-overview.component.ts index 9d7834dbe..881c3f51b 100644 --- a/dmp-frontend/src/app/ui/dataset/overview/dataset-overview.component.ts +++ b/dmp-frontend/src/app/ui/dataset/overview/dataset-overview.component.ts @@ -12,7 +12,7 @@ import { SnackBarNotificationLevel, UiNotificationService } from '@app/core/serv import { ConfigurationService } from '@app/core/services/configuration/configuration.service'; import { Oauth2DialogService } from '@app/ui/misc/oauth2-dialog/service/oauth2-dialog.service'; import { UserService } from '@app/core/services/user/user.service'; -import { takeUntil } from 'rxjs/operators'; +import { filter, takeUntil } from 'rxjs/operators'; import { Principal } from '@app/core/model/auth/principal'; import { Role } from '@app/core/common/enum/role'; import { Location } from '@angular/common'; @@ -479,31 +479,54 @@ export class DatasetOverviewComponent extends BaseComponent implements OnInit { // } finalize(dataset: DatasetOverviewModel) { - const dialogRef = this.dialog.open(ConfirmationDialogComponent, { - restoreFocus: false, + + + this.dialog.open(ConfirmationDialogComponent, { data: { - message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.FINALIZE-ITEM'), - confirmButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.AFFIRMATIVE'), - cancelButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.NEGATIVE'), - isDeleteConfirmation: false - } - }); - dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { - if (result) { - this.datasetWizardService.getSingle(dataset.id) - .pipe(takeUntil(this._destroyed)) - .subscribe(data => { - this.datasetWizardModel = data; - this.datasetWizardModel.status = DatasetStatus.Finalized; - this.datasetWizardService.createDataset(this.datasetWizardModel) - .pipe(takeUntil(this._destroyed)) - .subscribe( - data => this.onUpdateCallbackSuccess(), - error => this.onUpdateCallbackError(error) - ); - }); - } - }); + message: this.language.instant('DATASET-OVERVIEW.FINALISE-POPUP.MESSAGE'), + confirmButton: this.language.instant('DATASET-OVERVIEW.FINALISE-POPUP.CONFIRM'), + cancelButton: this.language.instant('DATASET-OVERVIEW.FINALISE-POPUP.CANCEL'), + }, + maxWidth: '30em' + }) + .afterClosed() + .pipe( + filter(x => x), + takeUntil(this._destroyed) + ) + .subscribe( _ =>{ + this.router.navigate(['datasets','edit',dataset.id]); + }) + + + + + + // const dialogRef = this.dialog.open(ConfirmationDialogComponent, { + // restoreFocus: false, + // data: { + // message: this.language.instant('GENERAL.CONFIRMATION-DIALOG.FINALIZE-ITEM'), + // confirmButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.AFFIRMATIVE'), + // cancelButton: this.language.instant('QUICKWIZARD.SAVE-DIALOG.ACTIONS.NEGATIVE'), + // isDeleteConfirmation: false + // } + // }); + // dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => { + // if (result) { + // this.datasetWizardService.getSingle(dataset.id) + // .pipe(takeUntil(this._destroyed)) + // .subscribe(data => { + // this.datasetWizardModel = data; + // this.datasetWizardModel.status = DatasetStatus.Finalized; + // this.datasetWizardService.createDataset(this.datasetWizardModel) + // .pipe(takeUntil(this._destroyed)) + // .subscribe( + // data => this.onUpdateCallbackSuccess(), + // error => this.onUpdateCallbackError(error) + // ); + // }); + // } + // }); } hasReversableStatus(dataset: DatasetOverviewModel): boolean { diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.ts b/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.ts index 5e65e1c16..9724daff3 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.ts +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents-internal/table-of-contents-internal.ts @@ -142,8 +142,11 @@ export class TableOfContentsInternal implements OnInit { return entry.subEntries.some(_ => this.invalidChildsVisible(_)); } if(entry.type === this.tocEntryTypeEnum.FieldSet){ + const id = entry.form.get('id').value + if(!this.visibilityRulesService.checkElementVisibility(id)){ + return false; + } const fieldsArray = entry.form.get('fields') as FormArray; - const hasError = !fieldsArray.controls.every(field=>{//every invalid field should be invisible if(field.invalid){ const id = field.get('id').value; diff --git a/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents.html b/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents.html index d4ca182f3..6a10aeaac 100644 --- a/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents.html +++ b/dmp-frontend/src/app/ui/misc/dataset-description-form/tableOfContentsMaterial/table-of-contents.html @@ -27,7 +27,7 @@
- this.internalTable.invalidChildsVisible(e)); + } + } export interface LinkToScroll { diff --git a/dmp-frontend/src/assets/i18n/de.json b/dmp-frontend/src/assets/i18n/de.json index 14746f6df..43dcbee82 100644 --- a/dmp-frontend/src/assets/i18n/de.json +++ b/dmp-frontend/src/assets/i18n/de.json @@ -702,12 +702,16 @@ "DOWNLOAD-DOCX": "DOCX herunterladen", "COPY-DATASET": "Datensatzbeschreibung kopieren", "UPDATE-DATASET-PROFILE": "Vorlage aktualisieren", - "VALIDATE":"Validate" + "VALIDATE":"Validate", + "UNDO-FINALIZATION-QUESTION" :"Undo finalization?", + "CONFIRM" : "Yes", + "REJECT": "No" }, "MESSAGES": { "DATASET-NOT-FOUND": "Datensatzbeschreibung ist nicht vorhanden", "DATASET-NOT-ALLOWED": "Sie haben keinen Zugriff auf diese Datensatzbeschreibung", - "SUCCESS-UPDATE-DATASET-PROFILE": "Vorlage der Datensatzbeschreibung erfolgreich aktualisiert" + "SUCCESS-UPDATE-DATASET-PROFILE": "Vorlage der Datensatzbeschreibung erfolgreich aktualisiert", + "MISSING-FIELDS": "There are some required fields left unfilled. Please check the form and make sure that all required fields are filled. (Missing fields are marked in red color)" }, "UPLOAD": { "UPLOAD-XML": "Importieren", @@ -770,6 +774,11 @@ "LOCKED":{ "TITLE": "Dataset is locked", "MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later." + }, + "FINALISE-POPUP":{ + "MESSAGE":"You will be directed to Dataset Editor where you can finalize the selected dataset. Would you like to proceed?", + "CONFIRM":"OK", + "CANCEL":"Cancel" } }, "DATASET-LISTING": { diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index ca3101c01..6913e67da 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -702,12 +702,16 @@ "DOWNLOAD-DOCX": "Download DOCX", "COPY-DATASET": "Copy Dataset", "UPDATE-DATASET-PROFILE": "Update Template", - "VALIDATE":"Validate" + "VALIDATE":"Validate", + "UNDO-FINALIZATION-QUESTION" :"Undo finalization?", + "CONFIRM" : "Yes", + "REJECT": "No" }, "MESSAGES": { "DATASET-NOT-FOUND": "Dataset does not exist", "DATASET-NOT-ALLOWED": "You have no access to this Dataset", - "SUCCESS-UPDATE-DATASET-PROFILE": "Dataset Template updated successfully" + "SUCCESS-UPDATE-DATASET-PROFILE": "Dataset Template updated successfully", + "MISSING-FIELDS": "There are some required fields left unfilled. Please check the form and make sure that all required fields are filled. (Missing fields are marked in red color)" }, "UPLOAD": { "UPLOAD-XML": "Import", @@ -770,6 +774,11 @@ "LOCKED":{ "TITLE": "Dataset is locked", "MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later." + }, + "FINALISE-POPUP":{ + "MESSAGE":"You will be directed to Dataset Editor where you can finalize the selected dataset. Would you like to proceed?", + "CONFIRM":"OK", + "CANCEL":"Cancel" } }, "DATASET-LISTING": { diff --git a/dmp-frontend/src/assets/i18n/es.json b/dmp-frontend/src/assets/i18n/es.json index c4a23e765..eef1d9145 100644 --- a/dmp-frontend/src/assets/i18n/es.json +++ b/dmp-frontend/src/assets/i18n/es.json @@ -702,12 +702,16 @@ "DOWNLOAD-DOCX": "Descargar DOCX", "COPY-DATASET": "Copiar la descripción del dataset", "UPDATE-DATASET-PROFILE": "Plantilla de modificación", - "VALIDATE":"Validate" + "VALIDATE":"Validate", + "UNDO-FINALIZATION-QUESTION" :"Undo finalization?", + "CONFIRM" : "Yes", + "REJECT": "No" }, "MESSAGES": { "DATASET-NOT-FOUND": "No existe la descripción del dataset", "DATASET-NOT-ALLOWED": "No tiene acceso a la descricipción de este dataset", - "SUCCESS-UPDATE-DATASET-PROFILE": "Plantilla de descripción del dataset actualizada correctamente" + "SUCCESS-UPDATE-DATASET-PROFILE": "Plantilla de descripción del dataset actualizada correctamente", + "MISSING-FIELDS": "There are some required fields left unfilled. Please check the form and make sure that all required fields are filled. (Missing fields are marked in red color)" }, "UPLOAD": { "UPLOAD-XML": "Importar", @@ -770,6 +774,11 @@ "LOCKED":{ "TITLE": "Dataset is locked", "MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later." + }, + "FINALISE-POPUP":{ + "MESSAGE":"You will be directed to Dataset Editor where you can finalize the selected dataset. Would you like to proceed?", + "CONFIRM":"OK", + "CANCEL":"Cancel" } }, "DATASET-LISTING": { diff --git a/dmp-frontend/src/assets/i18n/gr.json b/dmp-frontend/src/assets/i18n/gr.json index 0673ac5ac..bfa8afbfa 100644 --- a/dmp-frontend/src/assets/i18n/gr.json +++ b/dmp-frontend/src/assets/i18n/gr.json @@ -702,12 +702,16 @@ "DOWNLOAD-DOCX": "Ληψη DOCX", "COPY-DATASET": "Αντιφραφή Περιγραφής Συνόλου Δεδομένων", "UPDATE-DATASET-PROFILE": "Ενημέρωση Template", - "VALIDATE":"Επικύρωση" + "VALIDATE":"Επικύρωση", + "UNDO-FINALIZATION-QUESTION" :"Αναίρεση Οριστικοποίησης?", + "CONFIRM" : "Ναι", + "REJECT": "Oχι" }, "MESSAGES": { "DATASET-NOT-FOUND": "Η Περιγραφή Συνόλου Δεδομένων δεν υπάρχει", "DATASET-NOT-ALLOWED": "Δεν έχετε πρόσβαση σε αυτή την Περιγραφή Συνόλου Δεδομένων", - "SUCCESS-UPDATE-DATASET-PROFILE": "Επιτυχία ενημέρωσης της Περιγραφής Συνόλου Δεδομένων" + "SUCCESS-UPDATE-DATASET-PROFILE": "Επιτυχία ενημέρωσης της Περιγραφής Συνόλου Δεδομένων", + "MISSING-FIELDS": "Υπάρχουν ορισμένα υποχρεωτικά πεδία που δεν έχουν συμπληρωθεί. Ελέγξτε τη φόρμα και βεβαιωθείτε ότι έχουν συμπληρωθεί όλα τα απαιτούμενα πεδία. (Τα πεδία που λείπουν επισημαίνονται με κόκκινο χρώμα)" }, "UPLOAD": { "UPLOAD-XML": "Εισαγωγή", @@ -770,6 +774,11 @@ "LOCKED":{ "TITLE": "Dataset is locked", "MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later." + }, + "FINALISE-POPUP":{ + "MESSAGE":"You will be directed to Dataset Editor where you can finalize the selected dataset. Would you like to proceed?", + "CONFIRM":"OK", + "CANCEL":"Cancel" } }, "DATASET-LISTING": { diff --git a/dmp-frontend/src/assets/i18n/pt.json b/dmp-frontend/src/assets/i18n/pt.json index 1b9138389..de2cd7b96 100644 --- a/dmp-frontend/src/assets/i18n/pt.json +++ b/dmp-frontend/src/assets/i18n/pt.json @@ -702,12 +702,16 @@ "DOWNLOAD-DOCX": "Exportar para DOCX", "COPY-DATASET": "Copiar o Dataset", "UPDATE-DATASET-PROFILE": "Atualizar o Modelo", - "VALIDATE":"Validate" + "VALIDATE":"Validate", + "UNDO-FINALIZATION-QUESTION" :"Desfazer a finalização??", + "CONFIRM" : "Sim", + "REJECT": "Não" }, "MESSAGES": { "DATASET-NOT-FOUND": "O Dataset não existe", "DATASET-NOT-ALLOWED": "Não tem acesso a este Dataset", - "SUCCESS-UPDATE-DATASET-PROFILE": "O Dataset foi atualizado com sucesso" + "SUCCESS-UPDATE-DATASET-PROFILE": "O Dataset foi atualizado com sucesso", + "MISSING-FIELDS": "Alguns campos obrigatórios não foram preenchidos. Por favor, verifique o formulário e certifique-se de que todos os campos obrigatórios foram preenchidos. (Os campos ausentes são marcados em vermelho)" }, "UPLOAD": { "UPLOAD-XML": "Importar", @@ -729,6 +733,11 @@ "LOCKED":{ "TITLE":"Dataset is locked", "MESSAGE": "Somebody else is modifying the dataset at this moment. You may view the dataset but you cannot make any changes. If you would like to modify it please come back later." + }, + "FINALISE-POPUP":{ + "MESSAGE":"You will be directed to Dataset Editor where you can finalize the selected dataset. Would you like to proceed?", + "CONFIRM":"OK", + "CANCEL":"Cancelar" } }, "DMP-OVERVIEW": { diff --git a/dmp-frontend/src/assets/i18n/sk.json b/dmp-frontend/src/assets/i18n/sk.json index 9611808ee..2a35ac9f0 100644 --- a/dmp-frontend/src/assets/i18n/sk.json +++ b/dmp-frontend/src/assets/i18n/sk.json @@ -702,12 +702,16 @@ "DOWNLOAD-DOCX": "Stiahnuť DOCX", "COPY-DATASET": "Kopírovať súbor dát", "UPDATE-DATASET-PROFILE": "Aktualizovať šablónu", - "VALIDATE":"Validate" + "VALIDATE":"Validate", + "UNDO-FINALIZATION-QUESTION" :"Undo finalization?", + "CONFIRM" : "Yes", + "REJECT": "No" }, "MESSAGES": { "DATASET-NOT-FOUND": "Súbor dát neexistuje", "DATASET-NOT-ALLOWED": "K tomuto súboru dát nemáte prístup", - "SUCCESS-UPDATE-DATASET-PROFILE": "Šablóna súboru dát bola úspešne aktualizovaná" + "SUCCESS-UPDATE-DATASET-PROFILE": "Šablóna súboru dát bola úspešne aktualizovaná", + "MISSING-FIELDS": "There are some required fields left unfilled. Please check the form and make sure that all required fields are filled. (Missing fields are marked in red color)" }, "UPLOAD": { "UPLOAD-XML": "Importovať", @@ -770,6 +774,11 @@ "LOCKED":{ "TITLE": "Dataset is locked", "MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later." + }, + "FINALISE-POPUP":{ + "MESSAGE":"You will be directed to Dataset Editor where you can finalize the selected dataset. Would you like to proceed?", + "CONFIRM":"OK", + "CANCEL":"Cancel" } }, "DATASET-LISTING": { diff --git a/dmp-frontend/src/assets/i18n/sr.json b/dmp-frontend/src/assets/i18n/sr.json index 17fa54c26..e8878736a 100644 --- a/dmp-frontend/src/assets/i18n/sr.json +++ b/dmp-frontend/src/assets/i18n/sr.json @@ -702,12 +702,16 @@ "DOWNLOAD-DOCX": "Preuzmite DOCX", "COPY-DATASET": "Kopirajte skup podataka", "UPDATE-DATASET-PROFILE": "Ažurirajte obrazac", - "VALIDATE":"Validate" + "VALIDATE":"Validate", + "UNDO-FINALIZATION-QUESTION" :"Undo finalization?", + "CONFIRM" : "Yes", + "REJECT": "No" }, "MESSAGES": { "DATASET-NOT-FOUND": "Skup podataka ne postoji", "DATASET-NOT-ALLOWED": "Nemate pristup ovom skupu podataka", - "SUCCESS-UPDATE-DATASET-PROFILE": "Obrazac skupa podataka je ažuriran uspešno" + "SUCCESS-UPDATE-DATASET-PROFILE": "Obrazac skupa podataka je ažuriran uspešno", + "MISSING-FIELDS": "There are some required fields left unfilled. Please check the form and make sure that all required fields are filled. (Missing fields are marked in red color)" }, "UPLOAD": { "UPLOAD-XML": "Uvezite", @@ -770,6 +774,11 @@ "LOCKED":{ "TITLE": "Dataset is locked", "MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later." + }, + "FINALISE-POPUP":{ + "MESSAGE":"You will be directed to Dataset Editor where you can finalize the selected dataset. Would you like to proceed?", + "CONFIRM":"OK", + "CANCEL":"Cancel" } }, "DATASET-LISTING": { diff --git a/dmp-frontend/src/assets/i18n/tr.json b/dmp-frontend/src/assets/i18n/tr.json index 42b27bbde..c0e2eecfd 100644 --- a/dmp-frontend/src/assets/i18n/tr.json +++ b/dmp-frontend/src/assets/i18n/tr.json @@ -702,12 +702,16 @@ "DOWNLOAD-DOCX": "DOCX İndir", "COPY-DATASET": "Veri Seti Tanımını Kopyala", "UPDATE-DATASET-PROFILE": "Şablonu Güncelle", - "VALIDATE":"Validate" + "VALIDATE":"Validate", + "UNDO-FINALIZATION-QUESTION" :"Undo finalization?", + "CONFIRM" : "Yes", + "REJECT": "No" }, "MESSAGES": { "DATASET-NOT-FOUND": "Veri Seti mevcut değildir", "DATASET-NOT-ALLOWED": "Bu Veri Setine erişiminiz yok", - "SUCCESS-UPDATE-DATASET-PROFILE": "Veri Seti Tanımı başarılı olarak güncellendi" + "SUCCESS-UPDATE-DATASET-PROFILE": "Veri Seti Tanımı başarılı olarak güncellendi", + "MISSING-FIELDS": "There are some required fields left unfilled. Please check the form and make sure that all required fields are filled. (Missing fields are marked in red color)" }, "UPLOAD": { "UPLOAD-XML": "İçeri Aktar", @@ -770,6 +774,11 @@ "LOCKED":{ "TITLE": "Dataset is locked", "MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later." + }, + "FINALISE-POPUP":{ + "MESSAGE":"You will be directed to Dataset Editor where you can finalize the selected dataset. Would you like to proceed?", + "CONFIRM":"OK", + "CANCEL":"Cancel" } }, "DATASET-LISTING": { From 1b731fdf2078b19c219dfe26718f1ba2ab4d9939 Mon Sep 17 00:00:00 2001 From: Kristan Ntavidi Date: Wed, 21 Jul 2021 11:09:13 +0300 Subject: [PATCH 2/2] Changes on multi-auto complete component. * Give precedence on autocomplete option-selected over onblur. * Invitation dialog on blur commit given email till that time, on emails list. --- .../multiple-auto-complete.component.ts | 52 +++++++++++++++++-- .../dmp-invitation-dialog.component.ts | 3 +- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts b/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts index fd9854690..d209c4593 100644 --- a/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts +++ b/dmp-frontend/src/app/library/auto-complete/multiple/multiple-auto-complete.component.ts @@ -8,7 +8,8 @@ import { MatFormFieldControl } from '@angular/material/form-field'; import { AutoCompleteGroup } from '@app/library/auto-complete/auto-complete-group'; import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration'; import { BaseComponent } from '@common/base/base.component'; -import { Observable, of as observableOf, Subject } from 'rxjs'; +import { isNullOrUndefined } from '@swimlane/ngx-datatable'; +import { BehaviorSubject, combineLatest, Observable, of as observableOf, Subject, Subscription } from 'rxjs'; import { debounceTime, distinctUntilChanged, map, mergeMap, startWith, takeUntil, switchMap } from 'rxjs/operators'; export class CustomComponentBase extends BaseComponent { @@ -50,6 +51,11 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp id = `multiple-autocomplete-${MultipleAutoCompleteComponent.nextId++}`; stateChanges = new Subject(); + + valueOnBlur = new BehaviorSubject(null); + onSelectAutoCompleteValue = new BehaviorSubject(null); + valueAssignSubscription: Subscription; + focused = false; controlType = 'multiple-autocomplete'; describedBy = ''; @@ -123,7 +129,36 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp } } - ngOnInit() { } + ngOnInit() { + this.valueAssignSubscription = combineLatest(this.valueOnBlur.asObservable(), this.onSelectAutoCompleteValue.asObservable()) + .pipe(debounceTime(100)) + .subscribe(latest =>{ + const fromBlur = latest[0]; + const fromAutoComplete = latest[1]; + + if(isNullOrUndefined(fromBlur) && isNullOrUndefined(fromAutoComplete)){ + return; + } + //higher precedence + if(!isNullOrUndefined(fromAutoComplete)){ + this.optionSelectedInternal(fromAutoComplete); + + // consumed and flush + this.onSelectAutoCompleteValue.next(null); + this.valueOnBlur.next(null); + return; + } + + if(!isNullOrUndefined(fromBlur)){ + this.optionSelectedInternal(fromBlur); + + // consumed and flush + this.onSelectAutoCompleteValue.next(null); + this.valueOnBlur.next(null); + return; + } + }); + } ngDoCheck(): void { if (this.ngControl) { @@ -178,7 +213,8 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp } _optionSelected(event: MatAutocompleteSelectedEvent) { - this.optionSelectedInternal(event.option.value); + // this.optionSelectedInternal(event.option.value); + this.onSelectAutoCompleteValue.next(event.option.value); this.autocompleteInput.nativeElement.value = ''; } @@ -235,7 +271,8 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp public onBlur($event: MouseEvent) { if (this.inputValue && this.inputValue.length > 1 && this.autocomplete.options && this.autocomplete.options.length > 0 && this.autoSelectFirstOptionOnBlur) { - this.optionSelectedInternal(this.autocomplete.options.first.value); + // this.optionSelectedInternal(this.autocomplete.options.first.value); + this.valueOnBlur.next(this.autocomplete.options.first.value); } // Clear text if not an option @@ -271,6 +308,10 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp ngOnDestroy() { this.stateChanges.complete(); this.fm.stopMonitoring(this.elRef.nativeElement); + if(this.valueAssignSubscription){ + this.valueAssignSubscription.unsubscribe(); + this.valueAssignSubscription = null; + } } //Configuration getters @@ -332,7 +373,8 @@ export class MultipleAutoCompleteComponent extends _CustomComponentMixinBase imp const value = event.value; // Add our fruit if ((value || '').trim()) { - this.optionSelectedInternal(value); + // this.optionSelectedInternal(value); + this.valueOnBlur.next(value); } // Reset the input value if (input) { diff --git a/dmp-frontend/src/app/ui/dmp/invitation/dmp-invitation-dialog.component.ts b/dmp-frontend/src/app/ui/dmp/invitation/dmp-invitation-dialog.component.ts index a57ee5cb6..d15a9dd9c 100644 --- a/dmp-frontend/src/app/ui/dmp/invitation/dmp-invitation-dialog.component.ts +++ b/dmp-frontend/src/app/ui/dmp/invitation/dmp-invitation-dialog.component.ts @@ -68,7 +68,8 @@ export class DmpInvitationDialogComponent extends BaseComponent implements OnIni valueAssign: (item) => { const result = typeof(item) === 'string' ? item : item.email; return result; - } + }, + autoSelectFirstOptionOnBlur: true }; add(event: MatChipInputEvent): void {