Admin template editor: reseachers multi auto-complete fix. Discard changes on dataset editor navigates back to dmp editor.
This commit is contained in:
parent
959479757a
commit
037e246262
|
@ -74,7 +74,7 @@ export class FieldEditorModel extends BaseFormModel {
|
|||
if (this.viewStyle.renderStyle === 'registries') { this.data = new RegistriesDataEditorModel().fromModel(item.data); }
|
||||
if (this.viewStyle.renderStyle === 'services') { this.data = new ServicesDataEditorModel().fromModel(item.data); }
|
||||
if (this.viewStyle.renderStyle === 'tags') { this.data = new TagsDataEditorModel().fromModel(item.data); }
|
||||
if (this.viewStyle.renderStyle === 'researchers') { this.data = new ResearchersDataEditorModel().fromModel(item.data); }
|
||||
if (this.viewStyle.renderStyle === 'researchers') { this.data = new ResearchersAutoCompleteFieldDataEditorModel().fromModel(item.data); }
|
||||
if (this.viewStyle.renderStyle === 'organizations') { this.data = new OrganizationsDataEditorModel().fromModel(item.data); }
|
||||
if (this.viewStyle.renderStyle === 'datasetIdentifier') { this.data = new DatasetIdentifierDataEditorModel().fromModel(item.data); }
|
||||
if (this.viewStyle.renderStyle === 'currency') { this.data = new CurrencyDataEditorModel().fromModel(item.data); }
|
||||
|
|
|
@ -735,14 +735,21 @@ export class DatasetProfileEditorCompositeFieldComponent implements OnInit, OnCh
|
|||
// fieldForm.addControl('data', new ResearchersAutoCompleteFieldDataEditorModel().buildForm());
|
||||
|
||||
// field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.Researchers;
|
||||
|
||||
const data : ResearchersAutoCompleteFieldData = {
|
||||
label:'',
|
||||
multiAutoComplete: false,
|
||||
type: DatasetProfileInternalDmpEntitiesType.Researchers
|
||||
}
|
||||
|
||||
field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.InternalDmpEntities;
|
||||
// field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.InternalDmpEntities;
|
||||
// field.data = {label:''}
|
||||
|
||||
field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.Researchers;
|
||||
field.data = data;
|
||||
|
||||
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -698,7 +698,7 @@ export class DatasetProfileEditorFieldComponent extends BaseComponent implements
|
|||
}
|
||||
|
||||
|
||||
field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.InternalDmpEntities;
|
||||
field.viewStyle.renderStyle = DatasetProfileFieldViewStyle.Researchers;
|
||||
field.data = data;
|
||||
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid
|
|||
import { ConfirmationDialogComponent } from '@common/modules/confirmation-dialog/confirmation-dialog.component';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import * as FileSaver from 'file-saver';
|
||||
import { Observable, of as observableOf, interval } from 'rxjs';
|
||||
import { catchError, map, takeUntil } from 'rxjs/operators';
|
||||
import { Observable, of as observableOf, interval, Subscription } from 'rxjs';
|
||||
import { catchError, debounceTime, 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';
|
||||
|
@ -95,6 +95,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
showtocentriesErrors = false;
|
||||
@ViewChild('table0fContents', {static: false}) table0fContents: TableOfContents;
|
||||
hintErrors: boolean = false;
|
||||
datasetIsOnceSaved = false;
|
||||
|
||||
fieldsetIdWithFocus:string;
|
||||
|
||||
|
@ -393,12 +394,15 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
// });
|
||||
}
|
||||
|
||||
// private _listenersSubscription:Subscription = new Subscription();
|
||||
registerFormListeners() {
|
||||
// const dmpSubscription =
|
||||
this.formGroup.get('dmp').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => {
|
||||
this.dmpValueChanged(x);
|
||||
});
|
||||
// const profileSubscription =
|
||||
this.formGroup.get('profile').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => {
|
||||
|
@ -407,34 +411,51 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
this.formChanged();
|
||||
}
|
||||
});
|
||||
// const labelSubscription =
|
||||
this.formGroup.get('label').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => {
|
||||
this.formChanged();
|
||||
});
|
||||
// const descriptionSubscription =
|
||||
this.formGroup.get('description').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => {
|
||||
this.formChanged();
|
||||
});
|
||||
// const uriSubscription =
|
||||
this.formGroup.get('uri').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => {
|
||||
this.formChanged();
|
||||
});
|
||||
// const tagsSubscription =
|
||||
this.formGroup.get('tags').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => {
|
||||
this.formChanged();
|
||||
});
|
||||
if (this.formGroup.get('datasetProfileDefinition')) {
|
||||
// const datasetProfileDefinitionSubscription =
|
||||
this.formGroup.get('datasetProfileDefinition').valueChanges
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => {
|
||||
this.formChanged();
|
||||
});
|
||||
// this._listenersSubscription.add(datasetProfileDefinitionSubscription);
|
||||
}
|
||||
|
||||
// this._listenersSubscription.add(dmpSubscription);
|
||||
// this._listenersSubscription.add(profileSubscription);
|
||||
// this._listenersSubscription.add(labelSubscription);
|
||||
// this._listenersSubscription.add(descriptionSubscription);
|
||||
// this._listenersSubscription.add(uriSubscription);
|
||||
// this._listenersSubscription.add(tagsSubscription);
|
||||
}
|
||||
// private _unregisterFormListeners(){
|
||||
// this._listenersSubscription.unsubscribe();
|
||||
// this._listenersSubscription = new Subscription();
|
||||
// }
|
||||
|
||||
dmpValueChanged(dmp: DmpListingModel) {
|
||||
if (dmp) {
|
||||
|
@ -519,6 +540,27 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
this.datasetWizardModel.datasetProfileDefinition = new DatasetDescriptionFormEditorModel().fromModel(item);
|
||||
this.datasetProfileDefinitionModel = this.datasetWizardModel.datasetProfileDefinition;
|
||||
this.formGroup.addControl('datasetProfileDefinition', this.datasetProfileDefinitionModel.buildForm());
|
||||
|
||||
// const datasetProfileDefinitionForm = this.datasetProfileDefinitionModel.buildForm();
|
||||
|
||||
// let profId = null;
|
||||
// try{
|
||||
// profId = this.formGroup.get('profile').value.id;
|
||||
// }catch{
|
||||
|
||||
// }
|
||||
// if(this.formGroupRawValue && this.formGroupRawValue.datasetProfileDefinition && (this.formGroupRawValue.profile.id === profId)){
|
||||
// // this.formGroup.get('datasetProfileDefinition').patchValue( this.formGroupRawValue.datasetProfileDefinition);
|
||||
// datasetProfileDefinitionForm.patchValue(this.formGroupRawValue.datasetProfileDefinition);
|
||||
// }
|
||||
|
||||
// this.formGroup.addControl('datasetProfileDefinition', datasetProfileDefinitionForm);
|
||||
this.formGroup.get('datasetProfileDefinition').valueChanges
|
||||
.pipe(debounceTime(600))
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(x => {
|
||||
this.formChanged();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -569,6 +611,7 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
.subscribe(
|
||||
data => {
|
||||
this.onCallbackSuccess(data, saveType);
|
||||
this.datasetIsOnceSaved = true;
|
||||
},
|
||||
error => this.onCallbackError(error));
|
||||
}
|
||||
|
@ -1039,24 +1082,74 @@ export class DatasetWizardComponent extends BaseComponent implements OnInit, IBr
|
|||
}
|
||||
|
||||
discardChanges() {
|
||||
this.isDiscarded = true;
|
||||
this.hasChanges = false;
|
||||
this.hintErrors = false;
|
||||
if (this.isNew) {
|
||||
Object.keys(this.formGroup['controls']).forEach((key: string) => {
|
||||
if (key !== 'dmp' && (key!== 'profile')) {
|
||||
if(key === 'datasetProfileDefinition'){
|
||||
this.formGroup.get(key).patchValue(this.datasetProfileDefinitionModel.buildForm().getRawValue);
|
||||
}else{
|
||||
this.formGroup.get(key).reset();
|
||||
}
|
||||
// this.isDiscarded = true;
|
||||
// this.hasChanges = false;
|
||||
// this.hintErrors = false;
|
||||
let messageText = "";
|
||||
let confirmButtonText ="";
|
||||
let cancelButtonText = "";
|
||||
let isDeleteConfirmation = false;
|
||||
|
||||
if (this.isNew && !this.datasetIsOnceSaved) {
|
||||
|
||||
messageText = this.language.instant('DATASET-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-MESSAGE');
|
||||
confirmButtonText = this.language.instant('DATASET-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-CONFIRM');
|
||||
cancelButtonText = this.language.instant('DATASET-EDITOR.ACTIONS.DISCARD.DISCARD-NEW-DENY');
|
||||
isDeleteConfirmation = true;
|
||||
|
||||
// Object.keys(this.formGroup['controls']).forEach((key: string) => {
|
||||
// if (key !== 'dmp' && (key!== 'profile')) {
|
||||
// if(key === 'datasetProfileDefinition'){
|
||||
// this.formGroup.get(key).patchValue(this.datasetProfileDefinitionModel.buildForm().getRawValue);
|
||||
// }else{
|
||||
// this.formGroup.get(key).reset();
|
||||
// }
|
||||
|
||||
}
|
||||
});
|
||||
// }
|
||||
// });
|
||||
} else {
|
||||
this.formGroup.patchValue(JSON.parse(JSON.stringify(this.formGroupRawValue)));
|
||||
|
||||
messageText = this.language.instant('DATASET-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-MESSAGE');
|
||||
confirmButtonText = this.language.instant('DATASET-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-CONFIRM');
|
||||
cancelButtonText = this.language.instant('DATASET-EDITOR.ACTIONS.DISCARD.DISCARD-EDITED-DENY');
|
||||
isDeleteConfirmation = false;
|
||||
|
||||
// this.isDiscarded = true;
|
||||
// this.hasChanges = false;
|
||||
// this.hintErrors = false;
|
||||
// // this._unregisterFormListeners();
|
||||
// this.formGroup.patchValue(JSON.parse(JSON.stringify(this.formGroupRawValue)));
|
||||
// // this.registerFormListeners();
|
||||
// this.isDiscarded = false;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
this.isDiscarded = false;
|
||||
|
||||
|
||||
|
||||
|
||||
const dialogRef = this.dialog.open(ConfirmationDialogComponent, {
|
||||
restoreFocus: false,
|
||||
data: {
|
||||
message: messageText,
|
||||
confirmButton: confirmButtonText,
|
||||
cancelButton: cancelButtonText,
|
||||
isDeleteConfirmation: true
|
||||
}
|
||||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (result) {
|
||||
this.backToDmp(this.formGroup.get('dmp').value.id)
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
// this.isDiscarded = false;
|
||||
}
|
||||
|
||||
addDataset(dmpId: string) {
|
||||
|
|
|
@ -73,7 +73,6 @@ export class TableOfContents extends BaseComponent implements OnInit, OnChanges
|
|||
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
if(this.formGroup){
|
||||
this.tocentries = this.getTocEntries(this.formGroup.get('datasetProfileDefinition'));
|
||||
const fg = this.formGroup.get('datasetProfileDefinition');
|
||||
|
|
|
@ -1140,7 +1140,15 @@
|
|||
"SAVE": "Speichern",
|
||||
"CANCEL": "Abbrechen",
|
||||
"DELETE": "Löschen",
|
||||
"UPDATE": "Update"
|
||||
"UPDATE": "Update",
|
||||
"DISCARD":{
|
||||
"DISCARD-NEW-MESSAGE":"All changes made will be discarded and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-NEW-CONFIRM":"Yes, discard and remove dataset.",
|
||||
"DISCARD-NEW-DENY":"No.",
|
||||
"DISCARD-EDITED-MESSAGE":"All unsaved changes will be reverted to their initial state and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-EDITED-CONFIRM":"Yes, revert changes and go back.",
|
||||
"DISCARD-EDITED-DENY":"No."
|
||||
}
|
||||
},
|
||||
"PLACEHOLDER": {
|
||||
"DESCRIPTION": "Fill with description",
|
||||
|
|
|
@ -1140,7 +1140,15 @@
|
|||
"SAVE": "Save",
|
||||
"CANCEL": "Cancel",
|
||||
"DELETE": "Delete",
|
||||
"UPDATE": "Update"
|
||||
"UPDATE": "Update",
|
||||
"DISCARD":{
|
||||
"DISCARD-NEW-MESSAGE":"All changes made will be discarded and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-NEW-CONFIRM":"Yes, discard and remove dataset.",
|
||||
"DISCARD-NEW-DENY":"No.",
|
||||
"DISCARD-EDITED-MESSAGE":"All unsaved changes will be reverted to their initial state and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-EDITED-CONFIRM":"Yes, revert changes and go back.",
|
||||
"DISCARD-EDITED-DENY":"No."
|
||||
}
|
||||
},
|
||||
"PLACEHOLDER": {
|
||||
"DESCRIPTION": "Fill with description",
|
||||
|
|
|
@ -1140,7 +1140,15 @@
|
|||
"SAVE": "Grabar",
|
||||
"CANCEL": "Cancelar",
|
||||
"DELETE": "Borrar",
|
||||
"UPDATE": "Actualizar"
|
||||
"UPDATE": "Actualizar",
|
||||
"DISCARD":{
|
||||
"DISCARD-NEW-MESSAGE":"All changes made will be discarded and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-NEW-CONFIRM":"Yes, discard and remove dataset.",
|
||||
"DISCARD-NEW-DENY":"No.",
|
||||
"DISCARD-EDITED-MESSAGE":"All unsaved changes will be reverted to their initial state and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-EDITED-CONFIRM":"Yes, revert changes and go back.",
|
||||
"DISCARD-EDITED-DENY":"No."
|
||||
}
|
||||
},
|
||||
"PLACEHOLDER": {
|
||||
"DESCRIPTION": "Rellenar con la descripción",
|
||||
|
|
|
@ -1140,7 +1140,15 @@
|
|||
"SAVE": "Αποθήκευση",
|
||||
"CANCEL": "Ακύρωση",
|
||||
"DELETE": "Διαγραφή",
|
||||
"UPDATE": "Ενημέρωση"
|
||||
"UPDATE": "Ενημέρωση",
|
||||
"DISCARD":{
|
||||
"DISCARD-NEW-MESSAGE":"All changes made will be discarded and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-NEW-CONFIRM":"Yes, discard and remove dataset.",
|
||||
"DISCARD-NEW-DENY":"No.",
|
||||
"DISCARD-EDITED-MESSAGE":"All unsaved changes will be reverted to their initial state and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-EDITED-CONFIRM":"Yes, revert changes and go back.",
|
||||
"DISCARD-EDITED-DENY":"No."
|
||||
}
|
||||
},
|
||||
"PLACEHOLDER": {
|
||||
"DESCRIPTION": "Συμπληρώστε με περιγραφή",
|
||||
|
|
|
@ -1140,7 +1140,15 @@
|
|||
"SAVE": "Guardar",
|
||||
"CANCEL": "Cancelar",
|
||||
"DELETE": "Eliminar",
|
||||
"UPDATE": "Atualizar"
|
||||
"UPDATE": "Atualizar",
|
||||
"DISCARD":{
|
||||
"DISCARD-NEW-MESSAGE":"All changes made will be discarded and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-NEW-CONFIRM":"Yes, discard and remove dataset.",
|
||||
"DISCARD-NEW-DENY":"No.",
|
||||
"DISCARD-EDITED-MESSAGE":"All unsaved changes will be reverted to their initial state and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-EDITED-CONFIRM":"Yes, revert changes and go back.",
|
||||
"DISCARD-EDITED-DENY":"No."
|
||||
}
|
||||
},
|
||||
"PLACEHOLDER": {
|
||||
"DESCRIPTION": "Preencher com descrição",
|
||||
|
|
|
@ -1140,7 +1140,15 @@
|
|||
"SAVE": "Uložiť",
|
||||
"CANCEL": "Zrušiť",
|
||||
"DELETE": "Vymazať",
|
||||
"UPDATE": "Aktualizovať"
|
||||
"UPDATE": "Aktualizovať",
|
||||
"DISCARD":{
|
||||
"DISCARD-NEW-MESSAGE":"All changes made will be discarded and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-NEW-CONFIRM":"Yes, discard and remove dataset.",
|
||||
"DISCARD-NEW-DENY":"No.",
|
||||
"DISCARD-EDITED-MESSAGE":"All unsaved changes will be reverted to their initial state and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-EDITED-CONFIRM":"Yes, revert changes and go back.",
|
||||
"DISCARD-EDITED-DENY":"No."
|
||||
}
|
||||
},
|
||||
"PLACEHOLDER": {
|
||||
"DESCRIPTION": "Doplniť opis",
|
||||
|
|
|
@ -1140,7 +1140,15 @@
|
|||
"SAVE": "Sačuvajte",
|
||||
"CANCEL": "Otkažite",
|
||||
"DELETE": "Obrišite",
|
||||
"UPDATE": "Ažurirajte"
|
||||
"UPDATE": "Ažurirajte",
|
||||
"DISCARD":{
|
||||
"DISCARD-NEW-MESSAGE":"All changes made will be discarded and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-NEW-CONFIRM":"Yes, discard and remove dataset.",
|
||||
"DISCARD-NEW-DENY":"No.",
|
||||
"DISCARD-EDITED-MESSAGE":"All unsaved changes will be reverted to their initial state and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-EDITED-CONFIRM":"Yes, revert changes and go back.",
|
||||
"DISCARD-EDITED-DENY":"No."
|
||||
}
|
||||
},
|
||||
"PLACEHOLDER": {
|
||||
"DESCRIPTION": "Dopunite opisom",
|
||||
|
|
|
@ -1140,7 +1140,15 @@
|
|||
"SAVE": "Kaydet",
|
||||
"CANCEL": "İptal",
|
||||
"DELETE": "Sil",
|
||||
"UPDATE": "Güncelle"
|
||||
"UPDATE": "Güncelle",
|
||||
"DISCARD":{
|
||||
"DISCARD-NEW-MESSAGE":"All changes made will be discarded and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-NEW-CONFIRM":"Yes, discard and remove dataset.",
|
||||
"DISCARD-NEW-DENY":"No.",
|
||||
"DISCARD-EDITED-MESSAGE":"All unsaved changes will be reverted to their initial state and you will be redirected back to DMP Editor. Would you like to proceed?",
|
||||
"DISCARD-EDITED-CONFIRM":"Yes, revert changes and go back.",
|
||||
"DISCARD-EDITED-DENY":"No."
|
||||
}
|
||||
},
|
||||
"PLACEHOLDER": {
|
||||
"DESCRIPTION": "Açıklamayla Doldur",
|
||||
|
|
Loading…
Reference in New Issue