Removes most of unecessary requests for metadata endpoint on filters creation hook.
This commit is contained in:
parent
45a09358ce
commit
1782f3b0ed
|
@ -301,7 +301,7 @@
|
|||
default: false,
|
||||
},
|
||||
metadatum_type: String,
|
||||
metadatum_object: Object,
|
||||
query: Object,
|
||||
isRepositoryLevel: Boolean,
|
||||
isCheckbox: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
results:'',
|
||||
selected:'',
|
||||
options: [],
|
||||
metadatum_object: {},
|
||||
label: ''
|
||||
}
|
||||
},
|
||||
|
|
|
@ -39,46 +39,27 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import { tainacan as axios, isCancel } from '../../../js/axios/axios';
|
||||
import { isCancel } from '../../../js/axios/axios';
|
||||
import { filterTypeMixin, dynamicFilterTypeMixin } from '../filter-types-mixin';
|
||||
import CheckboxRadioModal from '../../../admin/components/other/checkbox-radio-modal.vue';
|
||||
|
||||
export default {
|
||||
created(){
|
||||
let endpoint = '/collection/' + this.collectionId + '/metadata/' + this.metadatumId +'?nopaging=1';
|
||||
|
||||
if (this.isRepositoryLevel || this.collectionId == 'default')
|
||||
endpoint = '/metadata?nopaging=1';
|
||||
|
||||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
let result = res.data;
|
||||
if ( result && result.metadata_type ){
|
||||
this.metadatum_object = result;
|
||||
|
||||
if (!this.isUsingElasticSearch)
|
||||
this.loadOptions();
|
||||
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
},
|
||||
mixins: [filterTypeMixin, dynamicFilterTypeMixin],
|
||||
data(){
|
||||
return {
|
||||
options: [],
|
||||
selected: [],
|
||||
metadatum_object: {}
|
||||
selected: []
|
||||
}
|
||||
},
|
||||
mixins: [filterTypeMixin, dynamicFilterTypeMixin],
|
||||
watch: {
|
||||
selected: function(){
|
||||
//this.selected = val;
|
||||
this.onSelect();
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
if (!this.isUsingElasticSearch)
|
||||
this.loadOptions();
|
||||
},
|
||||
methods: {
|
||||
loadOptions(skipSelected) {
|
||||
let promise = null;
|
||||
|
@ -164,7 +145,6 @@
|
|||
//taxonomy: this.taxonomy,
|
||||
collectionId: this.collectionId,
|
||||
metadatum_type: this.metadatumType,
|
||||
metadatum_object: this.metadatum_object,
|
||||
isRepositoryLevel: this.isRepositoryLevel,
|
||||
query: this.query
|
||||
},
|
||||
|
|
|
@ -77,23 +77,8 @@
|
|||
dateInter,
|
||||
filterTypeMixin
|
||||
],
|
||||
created() {
|
||||
let endpoint = '/collection/' + this.collectionId + '/metadata/' + this.metadatumId;
|
||||
|
||||
if (this.isRepositoryLevel || this.collectionId == 'default')
|
||||
endpoint = '/metadata/'+ this.metadatumId;
|
||||
|
||||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
let result = res.data;
|
||||
if( result && result.metadata_type ){
|
||||
this.metadatum_object = result;
|
||||
this.selectedValues();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
mounted() {
|
||||
this.selectedValues();
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
|
@ -104,8 +89,7 @@
|
|||
isTouched: false,
|
||||
isValid: false,
|
||||
clear: false,
|
||||
type: 'numeric',
|
||||
metadatum_object: {}
|
||||
type: 'numeric'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
@ -121,31 +121,12 @@
|
|||
dateInter,
|
||||
filterTypeMixin
|
||||
],
|
||||
created() {
|
||||
let endpoint = '/collection/' + this.collectionId + '/metadata/' + this.metadatumId;
|
||||
|
||||
if (this.isRepositoryLevel || this.collectionId == 'default')
|
||||
endpoint = '/metadata/'+ this.metadatumId;
|
||||
|
||||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
let result = res.data;
|
||||
if ( result && result.metadata_type ){
|
||||
this.metadatum_object = result;
|
||||
this.selectedValues();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.selectedValues();
|
||||
},
|
||||
data(){
|
||||
return {
|
||||
value: null,
|
||||
metadatum_object: {},
|
||||
comparator: '=', // =, !=, >, >=, <, <=
|
||||
}
|
||||
},
|
||||
|
|
|
@ -79,26 +79,6 @@
|
|||
wpAjax,
|
||||
filterTypeMixin
|
||||
],
|
||||
created() {
|
||||
this.filterTypeOptions = this.filter.filter_type_options;
|
||||
|
||||
let endpoint = '/collection/' + this.collectionId + '/metadata/' + this.metadatumId;
|
||||
|
||||
if (this.isRepositoryLevel || this.collectionId == 'default')
|
||||
endpoint = '/metadata/'+ this.metadatumId;
|
||||
|
||||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
let result = res.data;
|
||||
if ( result && result.metadata_type ){
|
||||
this.metadatum_object = result;
|
||||
this.selectedValues();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$console.log(error);
|
||||
});
|
||||
},
|
||||
mounted() {
|
||||
this.selectedValues();
|
||||
},
|
||||
|
@ -106,7 +86,6 @@
|
|||
return {
|
||||
value: null,
|
||||
filterTypeOptions: [],
|
||||
metadatum_object: {},
|
||||
comparator: '=' // =, !=, >, >=, <, <=
|
||||
}
|
||||
},
|
||||
|
|
|
@ -29,32 +29,12 @@
|
|||
import { filterTypeMixin, dynamicFilterTypeMixin } from '../filter-types-mixin';
|
||||
|
||||
export default {
|
||||
created(){
|
||||
let endpoint = '/collection/' + this.collectionId + '/metadata/' + this.metadatumId;
|
||||
|
||||
if (this.isRepositoryLevel || this.collectionId == 'default')
|
||||
endpoint = '/metadata/'+ this.metadatumId;
|
||||
|
||||
axios.get(endpoint)
|
||||
.then( res => {
|
||||
let result = res.data;
|
||||
if( result && result.metadata_type ){
|
||||
this.metadatum_object = result;
|
||||
|
||||
if (!this.isUsingElasticSearch)
|
||||
this.loadOptions();
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
this.$console.error(error);
|
||||
});
|
||||
},
|
||||
mixins: [filterTypeMixin, dynamicFilterTypeMixin],
|
||||
data(){
|
||||
return {
|
||||
options: []
|
||||
}
|
||||
},
|
||||
mixins: [filterTypeMixin, dynamicFilterTypeMixin],
|
||||
watch: {
|
||||
selected(value) {
|
||||
if (value)
|
||||
|
@ -74,6 +54,10 @@
|
|||
return undefined;
|
||||
}
|
||||
},
|
||||
mounted(){
|
||||
if (!this.isUsingElasticSearch)
|
||||
this.loadOptions();
|
||||
},
|
||||
methods: {
|
||||
loadOptions(){
|
||||
// Cancels previous Request
|
||||
|
|
Loading…
Reference in New Issue