Fixes event and error handling of geocoordinate metadata.

This commit is contained in:
mateuswetah 2024-04-09 10:56:23 -03:00
parent 459cc1baff
commit 79e216c3bf
2 changed files with 7 additions and 7 deletions

View File

@ -213,8 +213,8 @@
this.$emitter.off('itemEditionFormResize', () => this.handleWindowResize(mapComponentRef)); this.$emitter.off('itemEditionFormResize', () => this.handleWindowResize(mapComponentRef));
}, },
methods: { methods: {
onUpdateFromLatitudeInput: _.debounce( function($event) { onUpdateFromLatitudeInput: _.debounce( function(value) {
let newLatitude = $event.target.value; let newLatitude = value;
if ( !isNaN(newLatitude) ) { if ( !isNaN(newLatitude) ) {
this.latitude = newLatitude; this.latitude = newLatitude;
this.onUpdateFromLatitudeAndLongitude(); this.onUpdateFromLatitudeAndLongitude();
@ -232,8 +232,8 @@
} }
} }
}, 250), }, 250),
onUpdateFromLongitudeInput: _.debounce( function($event) { onUpdateFromLongitudeInput: _.debounce( function(value) {
let newLongitude = $event.target.value; let newLongitude = value;
if ( !isNaN(newLongitude) ) { if ( !isNaN(newLongitude) ) {
this.longitude = newLongitude; this.longitude = newLongitude;

View File

@ -22,7 +22,7 @@ export const itemMetadataMixin = {
if (this.errors.length > 0 && this.errors[0].errors && this.errors[0].errors.length) { if (this.errors.length > 0 && this.errors[0].errors && this.errors[0].errors.length) {
for (let error of this.errors) for (let error of this.errors)
this.$emitter.on('updateErrorMessageOf#' + (error.metadatum_id + (error.parent_meta_id ? '-' + error.parent_meta_id : '')), error); this.$emitter.emit('updateErrorMessageOf#' + (error.metadatum_id + (error.parent_meta_id ? '-' + error.parent_meta_id : '')), error);
} }
}, },
deep: true deep: true
@ -61,13 +61,13 @@ export const itemMetadataMixin = {
this.$emitter.emit('updateErrorMessageOf#' + (parentMetaId ? metadatumId + '-' + parentMetaId : metadatumId), this.errors[index]); this.$emitter.emit('updateErrorMessageOf#' + (parentMetaId ? metadatumId + '-' + parentMetaId : metadatumId), this.errors[index]);
}) })
.catch(({ error_message, error, item_metadata }) => { .catch(({ error_message, error, item_metadata }) => {
this.isUpdatingValues = false;; this.isUpdatingValues = false;
let index = this.errors.findIndex( errorItem => errorItem.metadatum_id == metadatumId && (parentMetaId ? errorItem.parent_meta_id == parentMetaId : true )); let index = this.errors.findIndex( errorItem => errorItem.metadatum_id == metadatumId && (parentMetaId ? errorItem.parent_meta_id == parentMetaId : true ));
let messages = []; let messages = [];
for (let index in error) for (let index in error)
messages.push(error[index]); messages.push(error[index]);
if ( index >= 0) { if ( index >= 0) {
Object.assign( this.errors, { [index]: { metadatum_id: metadatumId, parent_meta_id: parentMetaId, errors: messages } }); Object.assign( this.errors, { [index]: { metadatum_id: metadatumId, parent_meta_id: parentMetaId, errors: messages } });
this.$emitter.emit('updateErrorMessageOf#' + (parentMetaId ? metadatumId + '-' + parentMetaId : metadatumId), this.errors[index]); this.$emitter.emit('updateErrorMessageOf#' + (parentMetaId ? metadatumId + '-' + parentMetaId : metadatumId), this.errors[index]);