Question titles in dataset template with <textarea> | Bug fix in "Save & Continue" functionality of dataset templates | Added "Update & Continue" functionality in dataset templates | Changed placeholder text in the prefilling search box.

1. dataset-profile-editor-composite-field.component.html: #7792 - use <textarea> instead of <input> for question titles.
2. dataset-profile-editor-field.component.ts: #7790 - Set default value "unchecked" for checkbox.
3. dataset-profile.service.ts: In methods "createForm()" and "newVersion" updated response type from DatasetProfileEditorModel to string (id is returned only) and use httpClient instead of http.
4. dataset-profile-editor.component.html:
   a. [Bug fix] Fix conditions in action buttons (Save/Update/Finalize)
   b. On "Update" action button, added update dropdown options "Update & Continue", "Update & Close" and set default behavior "Update & Continue".
   c. On save dropdown options, used DATASET-PROFILE-EDITOR.ACTIONS instead of DATASET-WIZARD.ACTIONS.
5. dataset-profile-editor.component.ts:
   a. [Bug fix] #7791 - Created method "afterSave()" to be called in "onSubmit()" method when api calls return
   b. Added optional parameter "close: boolean = false" in method "updateAndFinalize".
6. i18n/:
   a. Added DATASET-WIZARD.ACTIONS.SAVE-AND-CONTINUE, DATASET-WIZARD.ACTIONS.SAVE-AND-CLOSE, DATASET-WIZARD.ACTIONS.UPDATE-AND-CONTINUE, DATASET-WIZARD.ACTIONS.UPDATE-AND-CLOSE.
   b. #7750 - Changed placeholder text in the prefilling search box (DATASET-CREATE-WIZARD.PREFIL-STEP.SEARCH).
This commit is contained in:
Konstantina Galouni 2022-05-31 16:49:15 +03:00
parent e8a87765ee
commit d7ee7b8d93
14 changed files with 99 additions and 32 deletions

View File

@ -31,7 +31,7 @@ export class DatasetProfileService extends BaseService {
}
createForm(data) {
return this.http.post<DatasetProfileEditorModel>(this.actionUrl + 'addDmp', data);
return this.httpClient.post<string>(this.actionUrl + 'addDmp', data);
}
updateForm(id, data): Observable<DatasetProfileEditorModel> {
@ -55,7 +55,7 @@ export class DatasetProfileService extends BaseService {
}
newVersion(id, data) {
return this.http.post<DatasetProfileEditorModel>(this.actionUrl + 'newVersion/' + id, data);
return this.httpClient.post<string>(this.actionUrl + 'newVersion/' + id, data);
}
delete(id: string, data): Observable<DatasetProfile> {

View File

@ -70,8 +70,8 @@
</mat-form-field>
<!-- [appearance]="titleControl.focused? 'legacy':'none'" floatLabel="never" -->
<mat-form-field class="col field-title" [appearance]="'none'" floatLabel="never">
<input matInput type="text" [placeholder]="('DATASET-PROFILE-EDITOR.STEPS.GENERAL-INFO.UNTITLED' |translate)+' '+('DATASET-PROFILE-EDITOR.STEPS.GENERAL-INFO.QUESTION'| translate)" #titleControl="matInput"
[formControl]="this.form.get('title')">
<textarea matInput type="text" [placeholder]="('DATASET-PROFILE-EDITOR.STEPS.GENERAL-INFO.UNTITLED' |translate)+' '+('DATASET-PROFILE-EDITOR.STEPS.GENERAL-INFO.QUESTION'| translate)" #titleControl="matInput"
[formControl]="this.form.get('title')"></textarea>
</mat-form-field>
</div>
</div>

View File

@ -12,7 +12,7 @@ import {DatasetProfileComboBoxType} from '@app/core/common/enum/dataset-profile-
import {ErrorStateMatcher} from '@angular/material/core';
import {MatDialog} from '@angular/material/dialog';
import {MatSlideToggleChange} from '@angular/material/slide-toggle';
import {Field} from '@app/core/model/admin/dataset-profile/dataset-profile';
import {DefaultValue, Field} from '@app/core/model/admin/dataset-profile/dataset-profile';
import {DatasetProfileInternalDmpEntitiesType} from '@app/core/common/enum/dataset-profile-internal-dmp-entities-type';
import {FieldEditorModel} from '../../../admin/field-editor-model';
import {
@ -510,9 +510,14 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
const data: CheckBoxFieldData = {
label:''
}
const defaultValue: DefaultValue = {
type: '',
value: 'false'
}
field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.CheckBox;
field.data = data;
field.defaultValue = defaultValue;
break;
}

View File

@ -468,27 +468,30 @@
<ng-template #actions>
<div>
<button mat-raised-button class="template_action_btn mr-3" (click)="discardChanges()">{{'DATASET-WIZARD.ACTIONS.CLOSE' | translate}}</button>
<button *ngIf="!viewOnly" mat-raised-button class="template_action_btn save-btn" (click)="onSubmit()" [disabled]="!form.valid">
<button *ngIf="!viewOnly && form.get('status').value!=1" mat-raised-button class="template_action_btn save-btn" (click)="onSubmit()" [disabled]="!form.valid">
{{'DATASET-PROFILE-EDITOR.ACTIONS.SAVE' |translate}}
<mat-icon (click)="$event.stopPropagation();" style="width: 14px;" [matMenuTriggerFor]="menuSave">expand_more</mat-icon>
</button>
<mat-menu #menuSave="matMenu">
<button [disabled]="!form.valid" mat-menu-item (click)="onSubmit(true)" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-CLOSE' | translate }}</button>
<button [disabled]="!form.valid" mat-menu-item (click)="onSubmit()" type="button">{{ 'DATASET-WIZARD.ACTIONS.SAVE-AND-CONTINUE' | translate }}</button>
<button [disabled]="!form.valid" mat-menu-item (click)="onSubmit(true)" type="button">{{ 'DATASET-PROFILE-EDITOR.ACTIONS.SAVE-AND-CLOSE' | translate }}</button>
<button [disabled]="!form.valid" mat-menu-item (click)="onSubmit()" type="button">{{ 'DATASET-PROFILE-EDITOR.ACTIONS.SAVE-AND-CONTINUE' | translate }}</button>
</mat-menu>
<button *ngIf="viewOnly" [@finalize_btn] mat-raised-button class="template_action_btn save-btn" [disabled]="!form.valid" (click)="updateAndFinalize()">
<button *ngIf="viewOnly || form.get('status').value==1" [@finalize_btn] mat-raised-button class="template_action_btn save-btn" [disabled]="!form.valid" (click)="updateAndFinalize()">
{{'DATASET-PROFILE-EDITOR.ACTIONS.UPDATE' |translate}}
<mat-icon (click)="$event.stopPropagation();" style="width: 14px;" [matMenuTriggerFor]="menuUpdate">expand_more</mat-icon>
</button>
<mat-menu #menuUpdate="matMenu">
<button [disabled]="!form.valid" mat-menu-item (click)="updateAndFinalize(true)" type="button">{{ 'DATASET-PROFILE-EDITOR.ACTIONS.UPDATE-AND-CLOSE' | translate }}</button>
<button [disabled]="!form.valid" mat-menu-item (click)="updateAndFinalize()" type="button">{{ 'DATASET-PROFILE-EDITOR.ACTIONS.UPDATE-AND-CONTINUE' | translate }}</button>
</mat-menu>
<button *ngIf="!viewOnly && steps?.length-1 === stepper?.selectedIndex"
<button *ngIf="!viewOnly && form.get('status').value!=1 && steps?.length-1 === stepper?.selectedIndex"
[@finalize_btn] mat-button class="finalize-btn ml-3"
[disabled]="!form.valid"
[class.invisible]="steps?.length-1 !== stepper?.selectedIndex"
(click)="updateAndFinalize()">
<ng-container *ngIf="form.get('status').value!=1">
{{'DATASET-PROFILE-EDITOR.ACTIONS.FINALIZE' |translate}}
</ng-container>
(click)="updateAndFinalize(true)">
{{'DATASET-PROFILE-EDITOR.ACTIONS.FINALIZE' |translate}}
</button>
</div>
</ng-template>

View File

@ -431,6 +431,7 @@ export class DatasetProfileEditorComponent extends CheckDeactivateBaseComponent
this.datasetProfileService.updateForm(this.datasetProfileId, data)
.pipe(takeUntil(this._destroyed))
.subscribe(() => {
this.afterSave();
this.form.markAsPristine();//deactivate guard
if(close) {
this.router.navigate(['/dataset-profiles']);
@ -442,8 +443,9 @@ export class DatasetProfileEditorComponent extends CheckDeactivateBaseComponent
data.description = this.form.get('description').value;
this.datasetProfileService.newVersion(this.newVersionId, data)
.pipe(takeUntil(this._destroyed))
.subscribe(() => {
this.form.markAsPristine();//deactivate guard
.subscribe((newVersionTemplateId: string) => {
this.afterSave(newVersionTemplateId);
this.form.markAsPristine();//deactivate guard
if(close) {
this.router.navigate(['/dataset-profiles']);
}
@ -458,7 +460,8 @@ export class DatasetProfileEditorComponent extends CheckDeactivateBaseComponent
data = this.form.value;
this.datasetProfileService.createForm(data)
.pipe(takeUntil(this._destroyed))
.subscribe(() => {
.subscribe(newTemplateId => {
this.afterSave(newTemplateId);
this.form.markAsPristine();//deactivate guard
if(close) {
this.router.navigate(['/dataset-profiles']);
@ -468,19 +471,39 @@ export class DatasetProfileEditorComponent extends CheckDeactivateBaseComponent
}
}
afterSave(newId: string = null) {
if(newId) {
this.datasetProfileId = newId;
this.form.value.id = newId;
}
this.isNew = false;
this.newVersionId = null;
// this.dataModel.fromModel(this.form.value);
// if (this.dataModel.status === DatasetProfileEnum.FINALIZED) {
// this.form = this.dataModel.buildForm(true, skipDisable);
// this.viewOnly = true;
// } else {
// this.form = this.dataModel.buildForm();
// }
// this.prepareForm();
}
finalize() {
//const data = this.form.value;
this.form.get('status').setValue(DatasetProfileEnum.FINALIZED);
this.onSubmit();
this.onSubmit(true);
}
updateFinalized() {
updateFinalized(close: boolean = false) {
this.datasetProfileService.updateForm(this.datasetProfileId, this.form.getRawValue())
.pipe(takeUntil(this._destroyed))
.subscribe(() => {
this.form.markAsPristine();//deactivate guard
this.router.navigate(['/dataset-profiles']);
if(close) {
this.router.navigate(['/dataset-profiles']);
}
this.uiNotificationService.snackBarNotification(this.language.instant('DATASET-PROFILE-EDITOR.FEEDBACK-MESSAGES.SAVE-SUCCESS'), SnackBarNotificationLevel.Success)
},error=>this.onCallbackError(error));
}
@ -2081,13 +2104,13 @@ export class DatasetProfileEditorComponent extends CheckDeactivateBaseComponent
}
}
updateAndFinalize(){
updateAndFinalize(close: boolean = false){
if(this.form.get('status').value == DatasetProfileEnum.FINALIZED ){
//UPDATE FORM
if(this.newVersionId){
this.onSubmit();
this.onSubmit(close);
}else{
this.updateFinalized();
this.updateFinalized(close);
}
}else{
//finalize

View File

@ -545,8 +545,12 @@
},
"ACTIONS": {
"SAVE": "Save",
"SAVE-AND-CONTINUE": "Save & Continue",
"SAVE-AND-CLOSE": "Save & Close",
"FINALIZE": "Finalize",
"UPDATE": "Update",
"UPDATE-AND-CONTINUE": "Update & Continue",
"UPDATE-AND-CLOSE": "Update & Close",
"CANCEL": "Cancel",
"DELETE": "Delete",
"ADD-PAGE": "Add Page +",
@ -1306,7 +1310,7 @@
"MANUALLY": "Manually",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next"
}
},

View File

@ -545,8 +545,12 @@
},
"ACTIONS": {
"SAVE": "Save",
"SAVE-AND-CONTINUE": "Save & Continue",
"SAVE-AND-CLOSE": "Save & Close",
"FINALIZE": "Finalize",
"UPDATE": "Update",
"UPDATE-AND-CONTINUE": "Update & Continue",
"UPDATE-AND-CLOSE": "Update & Close",
"CANCEL": "Cancel",
"DELETE": "Delete",
"ADD-PAGE": "Add Page +",
@ -1306,7 +1310,7 @@
"MANUALLY": "Manually",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next"
}
},

View File

@ -545,8 +545,12 @@
},
"ACTIONS": {
"SAVE": "Grabar",
"SAVE-AND-CONTINUE": "Save & Continue",
"SAVE-AND-CLOSE": "Save & Close",
"FINALIZE": "Finalizar",
"UPDATE": "Actualizar",
"UPDATE-AND-CONTINUE": "Update & Continue",
"UPDATE-AND-CLOSE": "Update & Close",
"CANCEL": "Cancelar",
"DELETE": "Borrar",
"ADD-PAGE": "Añadir página +",
@ -1306,7 +1310,7 @@
"MANUALLY": "Manually",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next"
}
},

View File

@ -545,8 +545,12 @@
},
"ACTIONS": {
"SAVE": "Αποθήκευση",
"SAVE-AND-CONTINUE": "Αποθήκευση & Συνέχεια",
"SAVE-AND-CLOSE": "Αποθήκευση & Κλείσιμο",
"FINALIZE": "Οριστικοποίηση",
"UPDATE": "Ενημέρωση",
"UPDATE-AND-CONTINUE": "Ενημέρωση & Συνέχεια",
"UPDATE-AND-CLOSE": "Ενημέρωση & Κλείσιμο",
"CANCEL": "Ακύρωση",
"DELETE": "Διαγραφή",
"ADD-PAGE": "Προσθήκη Σελίδας +",
@ -1306,7 +1310,7 @@
"MANUALLY": "Manually",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next"
}
},

View File

@ -545,8 +545,12 @@
},
"ACTIONS": {
"SAVE": "Snimi",
"SAVE-AND-CONTINUE": "Save & Continue",
"SAVE-AND-CLOSE": "Save & Close",
"FINALIZE": "Završi",
"UPDATE": "Dopuni",
"UPDATE-AND-CONTINUE": "Update & Continue",
"UPDATE-AND-CLOSE": "Update & Close",
"CANCEL": "Poništi",
"DELETE": "Obriši",
"ADD-PAGE": "Dodaj stranicu +",
@ -1306,7 +1310,7 @@
"MANUALLY": "Ručno",
"PROFILE": "Predložak za skup podataka",
"PREFILLED-DATASET": "Prethodno uneseni skup podataka",
"SEARCH": "Pretraživanje skupova podataka",
"SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Sljedeće"
}
},

View File

@ -545,8 +545,12 @@
},
"ACTIONS": {
"SAVE": "Guardar",
"SAVE-AND-CONTINUE": "Save & Continue",
"SAVE-AND-CLOSE": "Save & Close",
"FINALIZE": "Concluir",
"UPDATE": "Atualizar",
"UPDATE-AND-CONTINUE": "Update & Continue",
"UPDATE-AND-CLOSE": "Update & Close",
"CANCEL": "Cancelar",
"DELETE": "Eliminar",
"ADD-PAGE": "Adicionar Página +",
@ -1306,7 +1310,7 @@
"MANUALLY": "Manually",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next"
}
},

View File

@ -545,8 +545,12 @@
},
"ACTIONS": {
"SAVE": "Uložiť",
"SAVE-AND-CONTINUE": "Save & Continue",
"SAVE-AND-CLOSE": "Save & Close",
"FINALIZE": "Dokončiť",
"UPDATE": "Aktualizovať",
"UPDATE-AND-CONTINUE": "Update & Continue",
"UPDATE-AND-CLOSE": "Update & Close",
"CANCEL": "Zrušiť",
"DELETE": "Vymazať",
"ADD-PAGE": "Pridať stránku +",
@ -1306,7 +1310,7 @@
"MANUALLY": "Manually",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next"
}
},

View File

@ -545,8 +545,12 @@
},
"ACTIONS": {
"SAVE": "Sačuvajte",
"SAVE-AND-CONTINUE": "Save & Continue",
"SAVE-AND-CLOSE": "Save & Close",
"FINALIZE": "Završite",
"UPDATE": "Ažurirajte",
"UPDATE-AND-CONTINUE": "Update & Continue",
"UPDATE-AND-CLOSE": "Update & Close",
"CANCEL": "Otkažite",
"DELETE": "Obrišite",
"ADD-PAGE": "Dodajte stranu +",
@ -1306,7 +1310,7 @@
"MANUALLY": "Manually",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next"
}
},

View File

@ -545,8 +545,12 @@
},
"ACTIONS": {
"SAVE": "Kaydet",
"SAVE-AND-CONTINUE": "Save & Continue",
"SAVE-AND-CLOSE": "Save & Close",
"FINALIZE": "Tamamla",
"UPDATE": "Güncelle",
"UPDATE-AND-CONTINUE": "Update & Continue",
"UPDATE-AND-CLOSE": "Update & Close",
"CANCEL": "İptal",
"DELETE": "Sil",
"ADD-PAGE": "Sayfa Ekle +",
@ -1306,7 +1310,7 @@
"MANUALLY": "Manually",
"PROFILE": "Dataset Template",
"PREFILLED-DATASET": "Prefilled Dataset",
"SEARCH": "Search a Dataset",
"SEARCH": "Start typing to search for a dataset or software",
"NEXT": "Next"
}
},