Removes unecessary computed properties calling directly methods from vuex store. #496

This commit is contained in:
mateuswetah 2024-04-02 14:45:06 -03:00
parent bff3278fe4
commit 98b9e0a862
35 changed files with 212 additions and 454 deletions

View File

@ -423,9 +423,9 @@ export default {
}
},
computed: {
metadatumTypes() {
return this.getMetadatumTypes();
},
...mapGetters('metadata', {
'metadatumTypes': 'getMetadatumTypes'
}),
collectionNonChildMetadata() {
return Array.isArray(this.collectionMetadata) ? this.collectionMetadata.filter((metadatum) => !this.checkIfMetadatumIsChild(metadatum)) : [];
}
@ -476,12 +476,6 @@ export default {
'fetchMetadatumTypes',
'sendMetadatum'
]),
...mapGetters('metadata', [
'getMetadatumTypes'
]),
...mapGetters('bgprocess', [
'getProcess'
]),
...mapActions('collection', [
'fetchCollectionBasics'
]),

View File

@ -209,12 +209,9 @@ export default {
}
},
computed: {
uploadedFileList() {
return this.getFiles();
},
collection() {
return this.getCollection()
}
...mapGetters('collection', {
'collection': 'getCollection'
})
},
created() {
// Obtains collection ID
@ -233,10 +230,6 @@ export default {
'sendFile',
'cleanFiles',
'deleteItem'
]),
...mapGetters('collection', [
'getFiles',
'getCollection'
]),
...mapActions('item', [
'sendItem',

View File

@ -849,9 +849,9 @@ export default {
}
},
computed: {
collection() {
return this.getCollection()
},
...mapGetters('collection', {
'collection': 'getCollection'
}),
itemMetadata() {
const realItemMetadata = JSON.parse(JSON.stringify(this.getItemMetadata()));
@ -877,21 +877,17 @@ export default {
});
return tweakedItemMetadata;
},
metadataSections() {
return this.getMetadataSections();
},
lastUpdated() {
return this.getLastUpdated();
},
group() {
return this.getGroup();
},
itemIdInSequence() {
return this.getItemIdInSequence();
},
totalAttachments() {
return this.getTotalAttachments();
},
...mapGetters('metadata', {
'metadataSections': 'getMetadataSections'
}),
...mapGetters('item', {
'totalAttachments': 'getTotalAttachments',
'lastUpdated': 'getLastUpdated'
}),
...mapGetters('bulkedition', {
'itemIdInSequence': 'getItemIdInSequence',
'group': 'getGroup'
}),
totalRelatedItems() {
return (this.item && this.item.related_items) ? Object.values(this.item.related_items).reduce((totalItems, aRelatedItemsGroup) => totalItems + parseInt(aRelatedItemsGroup.total_items), 0) : false;
},
@ -1144,30 +1140,17 @@ export default {
]),
...mapGetters('item',[
'getItemMetadata',
'getTotalAttachments',
'getLastUpdated',
'getAttachments'
]),
...mapActions('collection', [
'deleteItem',
]),
...mapGetters('collection', [
'getCollection',
]),
...mapActions('bulkedition', [
'fetchItemIdInSequence',
'fetchSequenceGroup'
]),
...mapGetters('bulkedition', [
'getItemIdInSequence',
'getGroup'
]),
...mapActions('metadata',[
'fetchMetadataSections'
]),
...mapGetters('metadata',[
'getMetadataSections'
]),
onSubmit(status, sequenceDirection) {
// Puts loading on Item edition

View File

@ -268,7 +268,7 @@
<script>
import { nextTick } from 'vue';
import { permalinkGetter, formHooks } from "../../js/mixins";
import { mapActions, mapGetters } from 'vuex';
import { mapActions } from 'vuex';
import TermsList from '../lists/terms-list.vue';
import CustomDialog from '../other/custom-dialog.vue';
@ -389,9 +389,6 @@
'fetchTaxonomy',
'fetchOnlySlug'
]),
...mapGetters('taxonomy',[
'getTaxonomy',
]),
onChangeTab(tab) {
this.tabIndex = tab;
if (this.tabIndex == 1) {

View File

@ -92,9 +92,9 @@
}
},
computed: {
facetsFromItemSearch() {
return this.getFacets();
}
...mapGetters('search', {
'facetsFromItemSearch': 'getFacets'
}),
},
watch: {
selected: {
@ -147,9 +147,6 @@
this.$eventBusSearchEmitter.off('hasToReloadFacets', this.reloadOptions);
},
methods: {
...mapGetters('search', [
'getFacets'
]),
reloadOptions(shouldReload) {
if ( !this.isUsingElasticSearch && shouldReload )
this.loadOptions();

View File

@ -114,12 +114,10 @@
}
},
computed: {
attachments() {
return this.getAttachments();
},
totalAttachments() {
return this.getTotalAttachments();
}
...mapGetters('item', {
'attachments': 'getAttachments',
'totalAttachments': 'getTotalAttachments'
})
},
watch: {
shouldLoadAttachments() {
@ -134,10 +132,6 @@
...mapActions('item', [
'fetchAttachments',
]),
...mapGetters('item', [
'getAttachments',
'getTotalAttachments'
]),
onChangeAttachmentsPerPage(value) {
if (value != this.attachmentsPerPage) {

View File

@ -2045,12 +2045,16 @@ export default {
}
},
computed: {
collection() {
return this.getCollection();
},
highlightedItem () {
return this.getHighlightedItem();
},
...mapGetters('collection', {
'collection': 'getCollection',
}),
...mapGetters('bulkedition', {
'groupId': 'getGroupId'
}),
...mapGetters('search', {
'highlightedItem': 'getHighlightedItem',
'itemsPerPage': 'getItemsPerPage'
}),
selectedItems () {
if (this.$adminOptions.itemsSingleSelectionMode || this.$adminOptions.itemsMultipleSelectionMode)
this.$eventBusSearch.setSelectedItemsForIframe(this.getSelectedItems());
@ -2078,9 +2082,6 @@ export default {
}
return true;
},
itemsPerPage(){
return this.getItemsPerPage();
},
totalPages(){
return Math.ceil(Number(this.totalItems)/Number(this.itemsPerPage));
},
@ -2283,9 +2284,6 @@ export default {
...mapActions('collection', [
'deleteItem',
]),
...mapGetters('collection', [
'getCollection',
]),
...mapActions('bulkedition', [
'createEditGroup',
'createSequenceEditGroup',
@ -2293,9 +2291,6 @@ export default {
'deleteItemsInBulk',
'untrashItemsInBulk'
]),
...mapGetters('bulkedition', [
'getGroupId'
]),
...mapActions('search', [
'setSeletecItems',
'cleanSelectedItems',
@ -2303,12 +2298,8 @@ export default {
'removeSelectedItem'
]),
...mapGetters('search', [
'getOrder',
'getOrderBy',
'getStatus',
'getSelectedItems',
'getHighlightedItem',
'getItemsPerPage'
]),
setSelectedItemChecked(itemId) {
if (this.$adminOptions.itemsSingleSelectionMode) {
@ -2346,8 +2337,7 @@ export default {
object: Object.keys(this.queryAllItemsSelected).length ? this.queryAllItemsSelected : this.selectedItems,
collectionId: this.collectionId
}).then(() => {
let sequenceId = this.getGroupId();
this.$router.push(this.$routerHelper.getCollectionSequenceEditPath(this.collectionId, sequenceId, 1));
this.$router.push(this.$routerHelper.getCollectionSequenceEditPath(this.collectionId, this.groupId, 1));
});
},
selectAllItemsOnPage() {
@ -2397,11 +2387,9 @@ export default {
collectionId: this.collectionId,
object: [itemId]
}).then(() => {
let groupId = this.getGroupId();
this.untrashItemsInBulk({
collectionId: this.collectionId,
groupId: groupId
groupId: this.groupId
}).then(() => this.$eventBusSearch.loadItems() );
});
}
@ -2449,11 +2437,9 @@ export default {
collectionId: this.collectionId,
object: Object.keys(this.queryAllItemsSelected).length ? this.queryAllItemsSelected : this.selectedItems
}).then(() => {
let groupId = this.getGroupId();
this.untrashItemsInBulk({
collectionId: this.collectionId,
groupId: groupId
groupId: this.groupId
}).then(() => {
this.$eventBusSearch.loadItems();
this.$emitter.emit('openProcessesPopup');
@ -2481,12 +2467,10 @@ export default {
collectionId: this.collectionId,
object: Object.keys(this.queryAllItemsSelected).length ? this.queryAllItemsSelected : this.selectedItems
}).then(() => {
let groupId = this.getGroupId();
if (this.isOnTrash) {
this.deleteItemsInBulk({
collectionId: this.collectionId,
groupId: groupId
groupId: this.groupId
}).then(() => {
this.$eventBusSearch.loadItems();
this.$emitter.emit('openProcessesPopup');
@ -2494,7 +2478,7 @@ export default {
} else {
this.trashItemsInBulk({
collectionId: this.collectionId,
groupId: groupId
groupId: this.groupId
}).then(() => {
this.$eventBusSearch.loadItems();
this.$emitter.emit('openProcessesPopup');

View File

@ -230,14 +230,12 @@ export default {
}
},
computed: {
metadatumMappers() {
return this.getMetadatumMappers();
},
...mapGetters('metadata', {
'metadatumMappers': 'getMetadatumMappers',
'activeMetadatumList': 'getMetadata'
}),
isNewMetadataMapperMetadataDisabled() {
return !this.newMetadataLabel || !this.newMetadataUri;
},
activeMetadatumList() {
return this.getMetadata();
}
},
mounted() {
@ -277,10 +275,6 @@ export default {
'fetchMetadatumMappers',
'updateMetadataMapperMetadata',
]),
...mapGetters('metadata',[
'getMetadatumMappers',
'getMetadata'
]),
loadMetadataMappers() {
this.isLoadingMetadatumMappers = true;
this.fetchMetadatumMappers()

View File

@ -10,7 +10,7 @@
{{ $i18n.get('label_available_metadata_types') }}
</h3>
<sortable
:list="availableMetadatumList"
:list="availableMetadataTypes"
item-key="id"
:options="{
group: {
@ -166,14 +166,9 @@ export default {
}
},
computed: {
availableMetadatumList: {
get() {
return this.getMetadatumTypes();
},
set(value) {
return this.updateMetadatumTypes(value);
}
},
...mapGetters('metadata', {
'availableMetadataTypes': 'getMetadatumTypes'
}),
},
mounted() {
@ -192,9 +187,6 @@ export default {
...mapActions('metadata', [
'fetchMetadatumTypes'
]),
...mapGetters('metadata',[
'getMetadatumTypes'
]),
addMetadatumViaButton(metadatumType) {
this.$emitter.emit('addMetadatumViaButton', metadatumType);
},

View File

@ -175,9 +175,9 @@
}
},
computed: {
collection() {
return this.getCollection();
},
...mapGetters('collection', {
'collection': 'getCollection'
}),
maxMultipleValues() {
return (
this.itemMetadatum &&
@ -271,9 +271,6 @@
}
},
methods: {
...mapGetters('collection', [
'getCollection'
]),
onInput(newSelected) {
// First we reset the input
this.search('');

View File

@ -593,9 +593,9 @@
}
},
computed: {
activity() {
return this.getActivity();
},
...mapGetters('activity', {
'activity': 'getActivity'
}),
relatedToLink() {
switch(this.activity.object_type) {
case 'Tainacan\\Entities\\Collection':
@ -651,9 +651,6 @@
...mapActions('activity', [
'fetchActivity'
]),
...mapGetters('activity', [
'getActivity'
]),
approveActivity(){
this.$emit('approveActivity', this.activity.id);
},

View File

@ -367,9 +367,9 @@
}
},
computed: {
metadata() {
return this.getMetadata();
}
...mapGetters('metadata', {
'metadata': 'getMetadata'
})
},
created(){
if (this.collectionId) {
@ -436,9 +436,6 @@
...mapActions('metadata', [
'fetchMetadata'
]),
...mapGetters('metadata', [
'getMetadata'
]),
finalizeProcedure(criterion){
Object.assign(this.bulkEditionProcedures[criterion], { 'isDone': true });

View File

@ -110,9 +110,9 @@ export default {
}
},
computed: {
roles() {
return this.getRoles();
}
...mapGetters('capability', {
'roles': 'getRoles',
})
},
created() {
this.isLoading = true;
@ -126,9 +126,6 @@ export default {
'addCapabilityToRole',
'removeCapabilityFromRole'
]),
...mapGetters('capability', [
'getRoles',
]),
updateRole(role, value) {
if (value)
this.addCapabilityToRole({ capabilityKey: this.capabilityKey.replace('%d', 'all'), role: role })

View File

@ -130,9 +130,9 @@ export default {
}
},
computed: {
metadatumMappers() {
return this.getMetadatumMappers();
},
...mapGetters('metadata', {
'metadatumMappers': 'getMetadatumMappers'
}),
hasPresetsHook() {
if (wp !== undefined && wp.hooks !== undefined)
return wp.hooks.hasFilter(`tainacan_collections_presets`);
@ -172,9 +172,6 @@ export default {
...mapActions('metadata', [
'fetchMetadatumMappers'
]),
...mapGetters('metadata', [
'getMetadatumMappers'
]),
onNewCollectionPreset(collectionPreset) {
this.isCreatingCollectionPreset = true;
axios.post(collectionPreset.endpoint)

View File

@ -141,9 +141,9 @@ export default {
}
},
computed: {
collection() {
return this.getCollection();
}
...mapGetters('collection', {
'collection': 'getCollection'
})
},
watch: {
'$route': {
@ -160,11 +160,6 @@ export default {
this.activeRoute = this.$route.name;
this.pageTitle = this.$route.meta.title;
},
methods: {
...mapGetters('collection', [
'getCollection'
])
}
}
</script>

View File

@ -132,14 +132,11 @@ export default {
}
},
computed: {
collection() {
return this.getCollection();
}
...mapGetters('collection', {
'collection': 'getCollection'
})
},
methods: {
...mapGetters('collection', [
'getCollection'
]),
openAvailableExportersModal(){
this.$buefy.modal.open({

View File

@ -72,14 +72,14 @@ export default {
}
},
computed: {
...mapGetters('collection', {
'collection': 'getCollection'
}),
slotPassed() {
const slots = useSlots();
return !!slots['default'];
},
collection() {
return this.getCollection();
},
collectionBreadCrumbItem() {
collectionBreadCrumbItem() {
return {
url: this.collection && this.collection.id ? this.$routerHelper.getCollectionPath(this.collection.id) : '',
name: this.collection && this.collection.name ? this.collection.name : ''
@ -111,9 +111,6 @@ export default {
this.$emitter.on('onCollectionBreadCrumbUpdate', this.collectionBreadCrumbUpdate);
},
methods: {
...mapGetters('collection', [
'getCollection'
]),
collectionBreadCrumbUpdate(breadCrumbItems) {
this.childrenBreadCrumbItems = breadCrumbItems;
}

View File

@ -62,12 +62,12 @@ export default {
isRepositoryLevel: Boolean
},
computed: {
status() {
return this.getStatus();
},
collection() {
return this.getCollection();
},
...mapGetters('search', {
'status': 'getStatus'
}),
...mapGetters('collection', {
'collection': 'getCollection'
}),
repositoryTotalItems() {
if (!this.$adminOptions.hideItemsListStatusTabsTotalItems) {
@ -94,11 +94,7 @@ export default {
}
},
methods: {
...mapGetters('search', [
'getStatus'
]),
...mapGetters('collection', [
'getCollection',
'getCollections'
]),
onChangeTab(status) {

View File

@ -311,24 +311,20 @@
}
},
computed: {
filters() {
return this.getFilters();
},
repositoryCollectionFilters() {
return this.getRepositoryCollectionFilters();
},
taxonomyFilters() {
return this.getTaxonomyFilters();
},
getQuery() {
return this.getPostQuery();
},
...mapGetters('collection', {
'collection': 'getCollection'
}),
...mapGetters('search', {
'getQuery': 'getPostQuery'
}),
...mapGetters('filter', {
'filters': 'getFilters',
'taxonomyFilters': 'getTaxonomyFilters',
'repositoryCollectionFilters': 'getRepositoryCollectionFilters'
}),
taxonomyId () {
const taxonomyArray = this.taxonomy.split("_");
return taxonomyArray[taxonomyArray.length - 1];
},
collection() {
return this.getCollection();
}
},
watch: {
@ -394,11 +390,7 @@
},
methods: {
...mapGetters('search',[
'getPostQuery'
]),
...mapGetters('collection',[
'getCollection',
'getCollections'
]),
...mapActions('collection',[
@ -409,11 +401,6 @@
'fetchTaxonomyFilters',
'fetchRepositoryCollectionFilters'
]),
...mapGetters('filter', [
'getFilters',
'getTaxonomyFilters',
'getRepositoryCollectionFilters'
]),
prepareFilters() {
// Cancels previous Request
if (this.filtersSearchCancel != undefined)

View File

@ -95,6 +95,9 @@
}
},
computed: {
...mapGetters('search', {
'totalItems': 'getTotalItems'
}),
filterTags() {
let tags = this.getFilterTags();
let flattenTags = [];
@ -127,9 +130,6 @@
});
return flattenTags;
},
totalItems() {
return this.getTotalItems()
}
},
watch: {
@ -166,8 +166,7 @@
},
methods: {
...mapGetters('search',[
'getFilterTags',
'getTotalItems'
'getFilterTags'
]),
removeMetaQuery({ filterId, value, singleLabel, label, taxonomy, metadatumId, metadatumName, argType }) {
this.$eventBusSearch.resetPageOnStore();

View File

@ -123,15 +123,11 @@ export default {
}
},
computed: {
totalItems(){
return this.getTotalItems();
},
page(){
return this.getPage();
},
itemsPerPage(){
return this.getItemsPerPage();
},
...mapGetters('search', {
'totalItems': 'getTotalItems',
'page': 'getPage',
'itemsPerPage': 'getItemsPerPage'
}),
totalPages(){
return Math.ceil(Number(this.totalItems)/Number(this.itemsPerPage));
},
@ -150,20 +146,13 @@ export default {
}
},
methods: {
...mapGetters('search', [
'getTotalItems',
'getPage',
'getItemsPerPage',
'getPostQuery'
]),
onChangeItemsPerPage(value) {
if ( this.itemsPerPage == value){
if ( this.itemsPerPage == value )
return false;
} else if (Number(value) > Number(this.maxItemsPerPage)) {
else if ( Number(value) > Number(this.maxItemsPerPage) )
this.$eventBusSearch.setItemsPerPage(this.maxItemsPerPage);
} else {
else
this.$eventBusSearch.setItemsPerPage(value);
}
},
onPageChange(page) {
if(page == 0)

View File

@ -45,9 +45,9 @@ export const dynamicFilterTypeMixin = {
},
emits: ['update-parent-collapse'],
computed: {
facetsFromItemSearch() {
return this.getFacets();
}
...mapGetters('search', {
'facetsFromItemSearch': 'getFacets'
}),
},
watch: {
isLoadingItems: {
@ -59,9 +59,6 @@ export const dynamicFilterTypeMixin = {
}
},
methods: {
...mapGetters('search', [
'getFacets'
]),
getValuesPlainText({ metadatumId, search, isRepositoryLevel, valuesToIgnore, offset, number, isInCheckboxModal, getSelected = '0', countItems = true }) {
if (isInCheckboxModal || search || !this.isUsingElasticSearch) {

View File

@ -186,9 +186,9 @@ export default {
}
},
computed: {
collections() {
return this.getCollections();
}
...mapGetters('collection', {
'collections': 'getCollections'
}),
},
mounted() {
this.loadCollections();
@ -198,9 +198,6 @@ export default {
'fetchCollections',
'cleanCollections'
]),
...mapGetters('collection', [
'getCollections'
]),
loadCollections() {
this.cleanCollections();
this.isLoadingCollections = true;

View File

@ -391,6 +391,9 @@
}
},
computed: {
...mapGetters('bgprocess', {
'processes': 'getProcesses'
}),
activities(){
let activitiesList = this.getActivities();
@ -400,9 +403,6 @@
moment(activity['log_date'], 'YYYY-MM-DD h:mm:ss').format('DD/MM/YYYY, hh:mm:ss');
return activitiesList;
},
processes(){
return this.getProcesses();
}
},
created() {
@ -451,9 +451,6 @@
...mapActions('bgprocess', [
'fetchProcesses',
]),
...mapGetters('bgprocess', [
'getProcesses'
]),
onChangeTab(tab) {
this.tab = tab;
if (this.tab == 'processes') {

View File

@ -102,6 +102,9 @@
}
},
computed: {
...mapGetters('collection', {
'collection': 'getCollection'
}),
capabilities() {
const capabilities = this.getCapabilities()
@ -140,9 +143,6 @@
} else {
return []
}
},
collection() {
return this.getCollection();
}
},
mounted() {
@ -160,9 +160,6 @@
...mapGetters('capability', [
'getCapabilities'
]),
...mapGetters('collection', [
'getCollection'
]),
loadCapabilities() {
this.isLoading = true;

View File

@ -433,12 +433,10 @@ export default {
}
},
computed: {
collections() {
return this.getCollections();
},
repositoryTotalCollections(){
return this.getRepositoryTotalCollections();
},
...mapGetters('collection', {
'collections': 'getCollections',
'repositoryTotalCollections': 'getRepositoryTotalCollections'
}),
collectionTaxonomies() {
let collectionTaxonomies = this.getCollectionTaxonomies();
@ -510,8 +508,6 @@ export default {
'fetchMetadatumMappers'
]),
...mapGetters('collection', [
'getCollections',
'getRepositoryTotalCollections',
'getCollectionTaxonomies'
]),
onChangeTab(status) {

View File

@ -537,6 +537,9 @@ export default {
}
},
computed: {
...mapGetters('collection', {
'collection': 'getCollection',
}),
activeFiltersList: {
get() {
return this.getFilters();
@ -545,9 +548,6 @@ export default {
this.updateFilters(value);
}
},
collection() {
return this.getCollection();
}
},
watch: {
'$route.query': {
@ -624,8 +624,7 @@ export default {
'moveFilterDown'
]),
...mapGetters('filter',[
'getFilters',
'getFilterTypes'
'getFilters'
]),
...mapActions('metadata', [
'fetchMetadata',
@ -633,9 +632,6 @@ export default {
...mapGetters('metadata', [
'getMetadata',
]),
...mapGetters('collection', [
'getCollection',
]),
handleChangeOnFilter($event) {
switch( $event.type ) {
case 'add':

View File

@ -748,46 +748,32 @@
}
},
computed: {
...mapGetters('collection', {
'items': 'getItems',
'collection': 'getCollection'
}),
...mapGetters('metadata', {
'metadata': 'getMetadata'
}),
...mapGetters('search', {
'searchQuery': 'getSearchQuery',
'sentenceMode': 'getSentenceMode',
'status': 'getStatus',
'orderBy': 'getOrderBy',
'order': 'getOrder',
'totalItems': 'getTotalItems',
'adminViewMode': 'getAdminViewMode',
'metaKey': 'getMetaKey'
}),
isSortingByCustomMetadata() {
return (this.orderBy != undefined && this.orderBy != '' && this.orderBy != 'title' && this.orderBy != 'date' && this.orderBy != 'modified');
},
items() {
return this.getItems();
},
totalItems() {
this.updateCollectionInfo();
return this.getTotalItems();
},
metadata() {
return this.getMetadata();
},
collection() {
return this.getCollection();
},
searchQuery() {
return this.getSearchQuery();
},
status() {
return this.getStatus();
},
sentenceMode() {
return this.getSentenceMode();
},
adminViewMode() {
const currentAdminViewMode = this.getAdminViewMode();
return ['table', 'cards', 'records', 'grid', 'masonry', 'list', 'map'].indexOf(currentAdminViewMode) >= 0 ? currentAdminViewMode : 'table';
},
orderBy() {
return this.getOrderBy();
},
order() {
return this.getOrder();
},
showLoading() {
return this.isLoadingItems || this.isLoadingMetadata;
},
metaKey() {
return this.getMetaKey();
adminViewMode() {
const currentAdminViewMode = this.getAdminViewMode();
return ['table', 'cards', 'records', 'grid', 'masonry', 'list', 'map'].indexOf(currentAdminViewMode) >= 0 ? currentAdminViewMode : 'table';
},
orderByName() {
const metadatumName = this.$orderByHelper.getOrderByMetadatumName({
@ -949,6 +935,9 @@
this.$refs['filters-modal'].focus();
}, 800);
}
},
totalItems() {
this.updateCollectionInfo();
}
},
created() {
@ -1030,28 +1019,14 @@
},
methods: {
...mapGetters('collection', [
'getItems',
'getCollection'
]),
...mapActions('collection', [
'fetchCollectionBasics'
]),
...mapActions('metadata', [
'fetchMetadata'
]),
...mapGetters('metadata', [
'getMetadata'
]),
...mapGetters('search', [
'getSearchQuery',
'getSentenceMode',
'getStatus',
'getOrderBy',
'getOrder',
'getTotalItems',
'getAdminViewMode',
'getMetaKey'
]),
onOpenImportersModal() {
this.$buefy.modal.open({

View File

@ -83,9 +83,9 @@ export default {
}
},
computed: {
collection() {
return this.getCollection();
},
...mapGetters('collection', {
'collection': 'getCollection'
}),
repositoryTabLabel() {
let label = this.$i18n.get('metadata');
const metadata = this.getMetadata();
@ -115,9 +115,6 @@ export default {
this.$emitter.emit('onCollectionBreadCrumbUpdate', [{ path: '', label: this.$i18n.get('metadata') }]);
},
methods: {
...mapGetters('collection',[
'getCollection'
]),
...mapGetters('metadata',[
'getMetadatumTypes',
'getMetadata',

View File

@ -283,12 +283,10 @@
}
},
computed: {
taxonomies(){
return this.get();
},
repositoryTotalTaxonomies(){
return this.getRepositoryTotalTaxonomies();
},
...mapGetters('taxonomy', {
'taxonomies': 'get',
'repositoryTotalTaxonomies': 'getRepositoryTotalTaxonomies'
}),
statusOptionsForTaxonomies() {
return this.$statusHelper.getStatuses().filter((status) => status.slug != 'draft' && (status.slug != 'private' || (status.slug == 'private' && this.$userCaps.hasCapability('tnc_rep_read_private_taxonomies'))));
}
@ -325,10 +323,6 @@
...mapActions('taxonomy', [
'fetch',
]),
...mapGetters('taxonomy', [
'get',
'getRepositoryTotalTaxonomies'
]),
onChangeTab(status) {
this.page = 1;
this.status = status;

View File

@ -476,18 +476,16 @@
}
},
computed: {
collection() {
return this.getCollection();
},
metadataSections() {
return this.getMetadataSections();
},
item() {
// Fills hook forms with it's real values
this.updateExtraFormData(this.getItem());
return this.getItem();
},
...mapGetters('collection', {
'collection': 'getCollection'
}),
...mapGetters('metadata', {
'metadataSections': 'getMetadataSections'
}),
...mapGetters('item', {
'item': 'getItem',
'totalAttachments': 'getTotalAttachments'
}),
itemMetadata() {
const realItemMetadata = JSON.parse(JSON.stringify(this.getItemMetadata()));
const tweakedItemMetadata = realItemMetadata.map((anItemMetadatum) => {
@ -515,9 +513,6 @@
totalRelatedItems() {
return (this.item && this.item.related_items) ? Object.values(this.item.related_items).reduce((totalItems, aRelatedItemsGroup) => totalItems + parseInt(aRelatedItemsGroup.total_items), 0) : false;
},
totalAttachments() {
return this.getTotalAttachments();
},
itemVisibility() {
return (this.collection && this.collection.status == 'publish' && this.item && this.item.status == 'publish') ? 'open_access' : 'restrict_access'
},
@ -554,6 +549,12 @@
return !this.$adminOptions.hideItemSingleAttachments && (this.collection && this.collection.item_enable_attachments === 'yes');
}
},
watch: {
item() {
// Fills hook forms with it's real values
this.updateExtraFormData(this.item);
}
},
created() {
// Obtains item and collection ID
this.collectionId = this.$route.params.collectionId;
@ -609,19 +610,11 @@
'fetchItemMetadata',
]),
...mapGetters('item', [
'getItem',
'getItemMetadata',
'getTotalAttachments'
]),
...mapGetters('collection', [
'getCollection'
'getItemMetadata'
]),
...mapActions('metadata',[
'fetchMetadataSections'
]),
...mapGetters('metadata',[
'getMetadataSections'
]),
loadMetadata() {
// Obtains Item Metadatum
this.fetchItemMetadata(this.itemId).then(() => {

View File

@ -402,18 +402,18 @@ export default {
}
},
computed: {
item() {
return this.getItem();
},
page() {
this.setMaxAndMinPages();
return this.getPage();
},
totalPages() {
return this.getTotalPages();
}
...mapGetters('item', {
'item': 'getItem'
}),
...mapGetters('search', {
'totalPages': 'getTotalPages',
'page': 'getPage',
})
},
watch: {
page() {
this.setMaxAndMinPages();
},
isLoading: {
handler(val, oldValue) {
if (val === false && oldValue === true && this.swiper && this.items && this.items.length) {
@ -540,14 +540,6 @@ export default {
'fetchItem',
'replaceItem'
]),
...mapGetters('item', [
'getItem'
]),
...mapGetters('search', [
'getTotalPages',
'getPage',
'getItemsPerPage'
]),
setMaxAndMinPages () {
this.minPage = JSON.parse(JSON.stringify(this.getPage() < this.minPage ? this.getPage() : this.minPage));
this.maxPage = JSON.parse(JSON.stringify(this.getPage() > this.maxPage ? this.getPage() : this.maxPage));

View File

@ -770,6 +770,24 @@
}
},
computed: {
...mapGetters('collection', {
'items': 'getItems',
'itemsListTemplate': 'getItemsListTemplate'
}),
...mapGetters('metadata', {
'metadata': 'getMetadata'
}),
...mapGetters('search', {
'searchQuery': 'getSearchQuery',
'orderBy': 'getOrderBy',
'order': 'getOrder',
'viewMode': 'getViewMode',
'totalItems': 'getTotalItems',
'sentenceMode': 'getSentenceMode',
'metaKey': 'getMetaKey',
'page': 'getPage',
'itemsPerPage': 'getItemsPerPage'
}),
wrapperClasses() {
return {
'is-filters-menu-open': !this.hideFilters && this.isFiltersModalActive && !this.openAdvancedSearch,
@ -782,39 +800,9 @@
isSortingByCustomMetadata() {
return (this.orderBy != undefined && this.orderBy != '' && this.orderBy != 'title' && this.orderBy != 'creation_date' && this.orderBy != 'date' && this.orderBy != 'modified');
},
items() {
return this.getItems();
},
itemsListTemplate() {
return this.getItemsListTemplate();
},
totalItems() {
return this.getTotalItems();
},
metadata() {
return this.getMetadata();
},
searchQuery() {
return this.getSearchQuery();
},
sentenceMode() {
return this.getSentenceMode();
},
viewMode() {
return this.getViewMode();
},
orderBy() {
return this.getOrderBy();
},
order() {
return this.getOrder();
},
showLoading() {
return this.isLoadingItems || this.isLoadingMetadata;
},
metaKey() {
return this.getMetaKey();
},
orderByName() {
const metadatumName = this.$orderByHelper.getOrderByMetadatumName({
orderby: this.$route.query.orderby,
@ -1128,8 +1116,8 @@
let existingViewModeIndex = Object.keys(this.registeredViewModes).findIndex(viewMode => viewMode == this.$userPrefs.get(prefsViewMode));
if (existingViewModeIndex >= 0) {
if (!this.registeredViewModes[Object.keys(this.registeredViewModes)[existingViewModeIndex]].show_pagination) {
this.latestPerPageAfterViewModeWithoutPagination = this.getItemsPerPage();
this.latestPageAfterViewModeWithoutPagination = this.getPage();
this.latestPerPageAfterViewModeWithoutPagination = this.itemsPerPage;
this.latestPageAfterViewModeWithoutPagination = this.page;
this.$eventBusSearch.setItemsPerPage(24, true);
}
@ -1191,28 +1179,9 @@
},
methods: {
...mapGetters('collection', [
'getCollection',
'getItems',
'getItemsListTemplate'
]),
...mapActions('metadata', [
'fetchMetadata'
]),
...mapGetters('metadata', [
'getMetadata'
]),
...mapGetters('search', [
'getSearchQuery',
'getOrderBy',
'getOrder',
'getViewMode',
'getTotalItems',
'getSentenceMode',
'getMetaKey',
'getPage',
'getItemsPerPage'
]),
parseHooks() {
if (wp !== undefined && wp.hooks !== undefined) {
@ -1324,8 +1293,8 @@
let existingViewModeIndex = Object.keys(this.registeredViewModes).findIndex(aViewMode => aViewMode == viewMode);
if (existingViewModeIndex >= 0) {
if (!this.registeredViewModes[Object.keys(this.registeredViewModes)[existingViewModeIndex]].show_pagination) {
this.latestPerPageAfterViewModeWithoutPagination = this.getItemsPerPage();
this.latestPageAfterViewModeWithoutPagination = this.getPage();
this.latestPerPageAfterViewModeWithoutPagination = this.itemsPerPage;
this.latestPageAfterViewModeWithoutPagination = this.page;
this.$eventBusSearch.setItemsPerPage(24, true);
}

View File

@ -830,15 +830,13 @@ export default {
}
},
computed: {
...mapGetters('item', {
'itemSubmission': 'getItemSubmission',
'itemSubmissionMetadata': 'getItemSubmissionMetadata',
}),
showSteppedLayout() {
return this.isLayoutSteps;
},
itemSubmission() {
return this.getItemSubmission();
},
itemSubmissionMetadata() {
return this.getItemSubmissionMetadata();
},
itemMetadata() {
if ( !this.itemSubmissionMetadata || !this.itemSubmissionMetadata.length)
@ -977,10 +975,6 @@ export default {
'finishItemSubmission',
'clearItemSubmission'
]),
...mapGetters('item',[
'getItemSubmission',
'getItemSubmissionMetadata',
]),
...mapActions('metadata',[
'fetchMetadata',
'fetchMetadataSections'

View File

@ -320,12 +320,10 @@
}
},
computed: {
originalRole() {
return this.getRole()
},
capabilities() {
return this.getCapabilities();
},
...mapGetters('capability', {
'originalRole': 'getRole',
'capabilities': 'getCapabilities'
}),
collectionCapabilities() {
let collectionCapabilities = {}
@ -424,13 +422,6 @@
'fetchRole',
'fetchCapabilities'
]),
...mapGetters('collection', [
'getCollections'
]),
...mapGetters('capability', [
'getRole',
'getCapabilities'
]),
onUpdateCapability(value, capabilityKey) {
this.showNotice = false;
const capabilities = this.form.capabilities && Object.keys(this.form.capabilities).length ? this.form.capabilities : {};