diff --git a/src/classes/filter-types/autocomplete/Autocomplete.vue b/src/classes/filter-types/autocomplete/Autocomplete.vue index 884d7b3a5..a037b8ace 100644 --- a/src/classes/filter-types/autocomplete/Autocomplete.vue +++ b/src/classes/filter-types/autocomplete/Autocomplete.vue @@ -9,7 +9,6 @@ expanded :clear-on-select="true" @input="search" - :loading="isLoading" field="label" @select="option => setResults(option) " :placeholder="$i18n.get('info_type_to_search')"> @@ -72,7 +71,6 @@ results:'', selected:'', options: [], - isLoading: false, type: '', collection: '', metadatum: '', @@ -102,27 +100,22 @@ this.selectedValues(); }, search( query ){ - if (query == '') { - this.cleanSearch(); + + let promise = null; + this.options = []; + if ( this.type === 'Tainacan\\Metadata_Types\\Relationship' ) { + let collectionTarget = ( this.metadatum_object && this.metadatum_object.metadata_type_options.collection_id ) ? + this.metadatum_object.metadata_type_options.collection_id : this.collection_id; + promise = this.getValuesRelationship( collectionTarget, query ); + } else { - let promise = null; - this.options = []; - if ( this.type === 'Tainacan\\Metadata_Types\\Relationship' ) { - let collectionTarget = ( this.metadatum_object && this.metadatum_object.metadata_type_options.collection_id ) ? - this.metadatum_object.metadata_type_options.collection_id : this.collection_id; - promise = this.getValuesRelationship( collectionTarget, query ); - - } else { - promise = this.getValuesPlainText( this.metadatum, query, this.isRepositoryLevel ); - } - - promise.then( () => { - this.isLoading = false; - }).catch( error => { - this.$console.log('error select', error ); - this.isLoading = false; - }); + promise = this.getValuesPlainText( this.metadatum, query, this.isRepositoryLevel ); } + + promise.catch( error => { + this.$console.log('error select', error ); + }); + }, selectedValues(){ const instance = this; @@ -138,7 +131,7 @@ if ( this.type === 'Tainacan\\Metadata_Types\\Relationship' ) { // let query = qs.stringify({ postin: metadata.value }); - + axios.get('/items/' + metadata.value) .then( res => { diff --git a/src/classes/filter-types/taginput/Taginput.vue b/src/classes/filter-types/taginput/Taginput.vue index 0ca6b9956..85aa0a062 100644 --- a/src/classes/filter-types/taginput/Taginput.vue +++ b/src/classes/filter-types/taginput/Taginput.vue @@ -81,7 +81,6 @@ results:'', selected:[], options: [], - isLoading: false, type: '', collection: '', metadatum: '', @@ -130,12 +129,10 @@ } else { promise = this.getValuesPlainText( this.metadatum, query, this.isRepositoryLevel ); } - this.isLoading = true; - promise.then(() => { - this.isLoading = false; - }).catch( error => { + + promise + .catch( error => { this.$console.log('error select', error ); - this.isLoading = false; }); }, selectedValues(){ @@ -143,7 +140,7 @@ if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) ) return false; - let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key === this.metadatum ); + let index = this.query.metaquery.findIndex(newMetadatum => newMetadatum.key == this.metadatum ); if ( index >= 0){ let metadata = this.query.metaquery[ index ]; let collectionTarget = ( this.metadatum_object && this.metadatum_object.metadata_type_options.collection_id ) ? diff --git a/src/classes/filter-types/taxonomy/Taginput.vue b/src/classes/filter-types/taxonomy/Taginput.vue index 08e178dd0..b7376dd06 100644 --- a/src/classes/filter-types/taxonomy/Taginput.vue +++ b/src/classes/filter-types/taxonomy/Taginput.vue @@ -2,14 +2,16 @@
+ @typing="search" + :placeholder="$i18n.get('info_type_to_search')" />
@@ -160,7 +162,7 @@ if ( !this.query || !this.query.taxquery || !Array.isArray( this.query.taxquery ) ) return false; - let index = this.query.taxquery.findIndex(newMetadatum => newMetadatum.taxonomy === this.taxonomy ); + let index = this.query.taxquery.findIndex(newMetadatum => newMetadatum.taxonomy == 'tnc_tax_' + taxonomy ); if ( index >= 0){ let metadata = this.query.taxquery[ index ]; for ( let id of metadata.terms ){ @@ -171,8 +173,9 @@ } }, getTerm( taxonomy, id ){ - return axios.get('/taxonomy/' + taxonomy + '/terms/' + id + '?order=asc&hideempty=0' ).then( res => { - this.$console.log(res); + return axios.get('/taxonomy/' + taxonomy + '/terms/' + id + '?order=asc&hideempty=0' ) + .then( res => { + this.selected.push({ label: res.data.name, value: res.data.id }) }) .catch(error => { this.$console.log(error);