Fixes repository level request for relationship type filters. Passes false repository level to fiter items list when in term items list.

This commit is contained in:
Mateus Machado Luna 2018-11-14 16:16:48 -02:00
parent af60b15b90
commit e8bdc94c85
7 changed files with 29 additions and 22 deletions

View File

@ -412,7 +412,7 @@
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, this.optionName, [], offset, this.maxNumOptionsCheckboxList, true);
promise = this.getValuesRelationship( collectionTarget, this.optionName, this.isRepositoryLevel, [], offset, this.maxNumOptionsCheckboxList, true);
promise.request
.then(() => {

View File

@ -30,7 +30,7 @@
:key="filterIndex"
:filter="filter"
:open="collapsed"
:is-repository-level="isRepositoryLevel"/>
:is-repository-level="false"/>
<p
class="has-text-gray is-size-7"
v-if="taxonomyFilter.length <= 0">

View File

@ -112,7 +112,7 @@
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 );
promise = this.getValuesRelationship( collectionTarget, query, this.isRepositoryLevel );
} else {
promise = this.getValuesPlainText( this.metadatum, query, this.isRepositoryLevel );

View File

@ -115,7 +115,7 @@
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, null, [], 0, this.filter.max_options, false, '1');
promise = this.getValuesRelationship( collectionTarget, null, this.isRepositoryLevel, [], 0, this.filter.max_options, false, '1');
promise.request
.then(() => {
if(this.options.length > this.filter.max_options){

View File

@ -41,16 +41,16 @@ export const filter_type_mixin = {
}
let query_items = { 'current_query': currentQuery };
let url = `/collection/${this.collection}/facets/${metadatumId}?getSelected=${getSelected}&`;
let url = '';
if (isRepositoryLevel)
url = `/facets/${metadatumId}?getSelected=${getSelected}&`;
else
url = `/collection/${this.collection}/facets/${metadatumId}?getSelected=${getSelected}&`;
if(offset != undefined && number != undefined){
url += `offset=${offset}&number=${number}&`;
}
if(isRepositoryLevel){
url = `/facets/${metadatumId}?`;
}
if(search && offset != undefined && number != undefined){
url += `search=${search}&` + qs.stringify(query_items);
} else if(search){
@ -139,7 +139,7 @@ export const filter_type_mixin = {
source: source
});
},
getValuesRelationship(collectionTarget, search, valuesToIgnore, offset, number, isInCheckboxModal, getSelected = '0') {
getValuesRelationship(collectionTarget, search, isRepositoryLevel, valuesToIgnore, offset, number, isInCheckboxModal, getSelected = '0') {
const source = axios.CancelToken.source();
@ -151,8 +151,13 @@ export const filter_type_mixin = {
}
}
let query_items = { 'current_query': currentQuery };
let url = '/collection/' + this.filter.collection_id + '/facets/' + this.filter.metadatum.metadatum_id + `?getSelected=${getSelected}&`;
let url = '';
if (isRepositoryLevel)
url = '/facets/' + this.filter.metadatum.metadatum_id + `?getSelected=${getSelected}&`;
else
url = '/collection/' + this.filter.collection_id + '/facets/' + this.filter.metadatum.metadatum_id + `?getSelected=${getSelected}&`;
if(offset != undefined && number != undefined){
url += `offset=${offset}&number=${number}`;
} else {

View File

@ -124,7 +124,7 @@
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, valuesToIgnore );
promise = this.getValuesRelationship( collectionTarget, query, this.isRepositoryLevel, valuesToIgnore );
} else {
promise = this.getValuesPlainText( this.metadatum, query, this.isRepositoryLevel, valuesToIgnore );

View File

@ -98,11 +98,12 @@
this.isLoading = true;
let query_items = { 'current_query': this.query };
let route = `/collection/${this.collection}/facets/${this.metadatum}?getSelected=1&order=asc&parent=0&number=${this.filter.max_options}&` + qs.stringify(query_items);
if(this.collection == 'filter_in_repository'){
let route = '';
if(this.collection == 'filter_in_repository')
route = `/facets/${this.metadatum}?getSelected=1&order=asc&parent=0&number=${this.filter.max_options}&` + qs.stringify(query_items);
}
else
route = `/collection/${this.collection}/facets/${this.metadatum}?getSelected=1&order=asc&parent=0&number=${this.filter.max_options}&` + qs.stringify(query_items);
this.options = [];
@ -193,11 +194,12 @@
} else {
let route = '/collection/'+ this.collection +'/facets/' + this.metadatum +`?term_id=${selected}&fetch_only[0]=name&fetch_only[1]=id`;
if(this.collection == 'filter_in_repository'){
route = '/facets/' + this.metadatum +`?term_id=${selected}&fetch_only[0]=name&fetch_only[1]=id`
}
let route = '';
if(this.collection == 'filter_in_repository')
route = '/facets/' + this.metadatum +`?term_id=${selected}&fetch_only[0]=name&fetch_only[1]=id`;
else
route = '/collection/'+ this.collection +'/facets/' + this.metadatum +`?term_id=${selected}&fetch_only[0]=name&fetch_only[1]=id`;
axios.get(route)
.then( res => {