SEVERAL updates and refactor for new Webpack and Vue loader compatibility. #696.

This commit is contained in:
mateuswetah 2022-04-04 17:37:43 -03:00
parent 5bc9ce4bb9
commit 62dc76e9a2
57 changed files with 10484 additions and 245 deletions

View File

@ -24,6 +24,7 @@ module.exports = {
'vue/prop-name-casing': 'off',
'vue/no-confusing-v-for-v-if': 'off',
'vue/no-use-v-if-with-v-for': 'off',
'vue/multi-word-component-names': 'off',
'vue/require-default-prop': 'off' // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-default-prop.md
},
globals: {

10268
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,7 @@
"webpack-bundle-analyzer": "^4.5.0",
"webpack-cli": "^4.9.2",
"webpack-dev-server": "^4.7.4",
"webpack-merge": "^5.8.0"
"webpack-merge": "^5.8.0",
"circular-dependency-plugin": "5.2.2"
}
}

View File

@ -254,13 +254,13 @@ export default {
},
beforeDestroy() {
if (this.closedByForm) {
this.editedFilter.saved = true;
this.$emit('onUpdateSavedState', true);
} else {
this.oldForm.saved = this.form.saved;
if (JSON.stringify(this.form) != JSON.stringify(this.oldForm))
this.editedFilter.saved = false;
this.$emit('onUpdateSavedState', false);
else
this.editedFilter.saved = true;
this.$emit('onUpdateSavedState', true);
}
},
methods: {

View File

@ -381,7 +381,7 @@
v-if="item != undefined && item.id != undefined"
:item="item"
:is-editable="true"
:is-loading.sync="isLoadingAttachments"
:is-loading="isLoadingAttachments"
@isLoadingAttachments="(isLoading) => isLoadingAttachments = isLoading"
@onDeleteAttachment="deleteAttachment($event)"/>
</div>
@ -965,6 +965,27 @@ export default {
ItemMetadatumErrorsTooltip
},
mixins: [ formHooks ],
beforeRouteLeave ( to, from, next ) {
if (this.item.status == 'auto-draft') {
this.$buefy.modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_item_not_saved'),
onConfirm: () => {
next();
},
},
trapFocus: true,
customClass: 'tainacan-modal',
closeButtonAriaLabel: this.$i18n.get('close')
});
} else {
next()
}
},
data(){
return {
swiper: {},
@ -1222,27 +1243,6 @@ export default {
if (typeof this.swiper.destroy == 'function')
this.swiper.destroy();
},
beforeRouteLeave ( to, from, next ) {
if (this.item.status == 'auto-draft') {
this.$buefy.modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_item_not_saved'),
onConfirm: () => {
next();
},
},
trapFocus: true,
customClass: 'tainacan-modal',
closeButtonAriaLabel: this.$i18n.get('close')
});
} else {
next()
}
},
methods: {
...mapActions('item', [
'sendItem',

View File

@ -440,15 +440,13 @@
if ( (metadatum.metadata_type_object && metadatum.metadata_type_object.form_component) || metadatum.edit_form == '') {
let repository = this.form.repository_level;
if (repository && repository === 'yes')
this.isRepositoryLevel = true;
this.fillExtraFormData(this.form);
this.isUpdating = true;
this.updateMetadatum({
collectionId: this.collectionId,
metadatumId: metadatum.id,
isRepositoryLevel: this.isRepositoryLevel,
isRepositoryLevel: this.isRepositoryLevel || (repository && repository === 'yes'),
index: this.index,
options: this.form,
includeOptionsAsHtml: true
@ -485,12 +483,14 @@
formObj[key] = value;
}
let repository = formObj['repository_level'];
this.fillExtraFormData(formObj);
this.isUpdating = true;
this.updateMetadatum({
collectionId: this.collectionId,
metadatumId: metadatum.id,
isRepositoryLevel: this.isRepositoryLevel,
isRepositoryLevel: this.isRepositoryLevel || (repository && repository === 'yes'),
index: this.index,
options: formObj,
includeOptionsAsHtml: true

View File

@ -245,30 +245,6 @@
TermsList
},
mixins: [ wpAjax, formHooks ],
data(){
return {
taxonomyId: String,
tabIndex: 0,
taxonomy: null,
isLoadingTaxonomy: false,
isUpdatingSlug: false,
isEditingTerm: false,
form: {
name: String,
status: String,
description: String,
slug: String,
allowInsert: String,
enabledPostTypes: Array
},
wpPostTypes: tainacan_plugin.wp_post_types,
editFormErrors: {},
formErrorMessage: '',
entityName: 'taxonomy',
updatedAt: undefined,
shouldReloadTermsList: false
}
},
beforeRouteLeave( to, from, next ) {
let formNotSaved = false;
@ -323,6 +299,30 @@
next();
}
},
data(){
return {
taxonomyId: String,
tabIndex: 0,
taxonomy: null,
isLoadingTaxonomy: false,
isUpdatingSlug: false,
isEditingTerm: false,
form: {
name: String,
status: String,
description: String,
slug: String,
allowInsert: String,
enabledPostTypes: Array
},
wpPostTypes: tainacan_plugin.wp_post_types,
editFormErrors: {},
formErrorMessage: '',
entityName: 'taxonomy',
updatedAt: undefined,
shouldReloadTermsList: false
}
},
mounted(){
if (this.$route.query.tab == 'terms')

View File

@ -232,7 +232,7 @@
name: 'TermEditionForm',
mixins: [ formHooks ],
props: {
form: Object,
originalForm: Object,
taxonomyId: '',
isModal: false
},
@ -250,9 +250,13 @@
entityName: 'term',
isLoading: false,
parentTermSearchQuery: '',
parentTermSearchOffset: 0
parentTermSearchOffset: 0,
form: {}
}
},
created() {
this.form = JSON.parse(JSON.stringify(this.originalForm));
},
mounted() {
// Fills hook forms with it's real values

View File

@ -43,6 +43,7 @@
:is-modal="false"
:filter="filter"
:selected="selected"
@input="(newSelected) => selected = newSelected"
:metadatum-id="metadatumId"
:collection-id="collectionId"
:metadatum_type="metadatumType"

View File

@ -47,7 +47,7 @@
:query="query"
:is-using-elastic-search="isUsingElasticSearch"
:is-repository-level="isRepositoryLevel"
:is-loading-items.sync="isLoadingItems"
:is-loading-items="isLoadingItems"
:current-collection-id="$eventBusSearch.collectionId"
@input="onInput"
@updateParentCollapse="onFilterUpdateParentCollapse"
@ -95,14 +95,14 @@
expandAll: true,
isLoadingItems: true,
filtersAsModal: Boolean,
isMobileScreen: false,
focusedElement: false
isMobileScreen: false
},
data() {
return {
isUsingElasticSearch: tainacan_plugin.wp_elasticpress == "1" ? true : false,
displayFilter: false,
singleCollapseOpen: this.expandAll
singleCollapseOpen: this.expandAll,
focusedElement: false
}
},
computed: {

View File

@ -51,6 +51,7 @@
:filter="filter"
:taxonomy_id="taxonomyId"
:selected="selected"
@input="(newSelected) => selected = newSelected"
:metadatum-id="metadatumId"
:taxonomy="taxonomy"
:collection-id="collectionId"

View File

@ -5,7 +5,7 @@
class="table-container">
<b-loading
is-full-page="false"
:active.sync="isLoading" />
:active="isLoading" />
<div
v-if="attachments.length > 0"
class="table-wrapper">
@ -159,7 +159,6 @@
return last > this.totalAttachments ? this.totalAttachments : last;
},
loadAttachments() {
this.isLoading = true;
this.$emit('isLoadingAttachments', true);
this.fetchAttachments({
@ -170,12 +169,10 @@
thumbnailId: this.item.thumbnail_id
})
.then((response) => {
this.isLoading = false;
this.$emit('isLoadingAttachments', false);
this.totalAttachments = response.total;
})
.catch((error) => {
this.isLoading = false;
this.$emit('isLoadingAttachments', false);
this.$console.error(error);
})

View File

@ -58,7 +58,7 @@ import { mapActions } from 'vuex';
import CustomDialog from '../other/custom-dialog.vue';
export default {
name: 'RecursiveTermItem',
name: 'BasicTermItem',
props: {
term: Object,
index: Number,
@ -88,8 +88,7 @@ export default {
'deleteTerm'
]),
editTerm() {
this.term.opened = !this.term.opened;
this.$emit('onUpdateTermOpenedState', !this.term.opened);
this.$eventBusTermsList.onEditTerm(this.term);
},
tryToRemoveTerm() {
@ -138,11 +137,11 @@ export default {
},
eventOnTermEditionSaved() {
this.isEditingTerm = false;
this.term.opened = false;
this.$emit('onUpdateTermOpenedState', false);
},
eventOnTermEditionCanceled() {
this.isEditingTerm = false;
this.term.opened = false;
this.$emit('onUpdateTermOpenedState', false);
}
}
}

View File

@ -1557,7 +1557,6 @@ export default {
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_remove_item_from_trash'),
onConfirm: () => {
this.isLoading = true;
this.$emit('updateIsLoading', this.isLoading);
this.createEditGroup({
@ -1589,7 +1588,6 @@ export default {
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_item_delete') : this.$i18n.get('info_warning_item_trash'),
onConfirm: () => {
this.isLoading = true;
this.$emit('updateIsLoading', this.isLoading);
this.deleteItem({
@ -1615,7 +1613,6 @@ export default {
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_selected_items_remove_from_trash'),
onConfirm: () => {
this.isLoading = true;
this.$emit('updateIsLoading', this.isLoading);
this.createEditGroup({
@ -1648,7 +1645,6 @@ export default {
title: this.$i18n.get('label_warning'),
message: this.isOnTrash ? this.$i18n.get('info_warning_selected_items_delete') : this.$i18n.get('info_warning_selected_items_trash'),
onConfirm: () => {
this.isLoading = true;
this.$emit('updateIsLoading', this.isLoading);
this.createEditGroup({

View File

@ -266,7 +266,7 @@ export default {
item.isCustom = false;
this.activeMetadatumList.forEach((metadatum) => {
if (
metadatum.exposer_mapping.hasOwnProperty(metadatumMapper.slug) &&
Object.prototype.hasOwnProperty.call(metadatum.exposer_mapping, metadatumMapper.slug) &&
metadatum.exposer_mapping[metadatumMapper.slug] == item.slug
) {
item.selected = metadatum.id;
@ -277,7 +277,7 @@ export default {
}
this.activeMetadatumList.forEach((metadatum) => {
if (
metadatum.exposer_mapping.hasOwnProperty(metadatumMapper.slug) &&
Object.prototype.hasOwnProperty.call(metadatum.exposer_mapping, metadatumMapper.slug) &&
typeof metadatum.exposer_mapping[metadatumMapper.slug] == 'object'
) {
this.newMapperMetadataList.push(Object.assign({},metadatum.exposer_mapping[metadatumMapper.slug]));

View File

@ -113,7 +113,8 @@
:index="childIndex"
:taxonomy-id="taxonomyId"
:order="order"
:current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"/>
:current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"
@onUpdateTermOpenedState="(state) => childTerm.opened = state"/>
</div>
</transition-group>
<a
@ -128,14 +129,10 @@
<script>
import { mapActions } from 'vuex';
import RecursiveTermItem from './recursive-term-item.vue';
import CustomDialog from '../other/custom-dialog.vue';
export default {
name: 'RecursiveTermItem',
components: {
RecursiveTermItem,
},
props: {
term: Object,
index: Number,
@ -217,7 +214,7 @@ export default {
},
editTerm() {
this.term.opened = !this.term.opened;
this.$emit('onUpdateTermOpenedState', !this.term.opened);
this.$eventBusTermsList.onEditTerm(this.term);
@ -316,11 +313,11 @@ export default {
}
this.isEditingTerm = false;
this.term.opened = false;
this.$emit('onUpdateTermOpenedState', false);
},
eventOnTermEditionCanceled() {
this.isEditingTerm = false;
this.term.opened = false;
this.$emit('onUpdateTermOpenedState', false);
}
}
}

View File

@ -97,7 +97,8 @@
:index="index"
:taxonomy-id="taxonomyId"
:order="order"
:current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"/>
:current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"
@onUpdateTermOpenedState="(state) => term.opened = state"/>
</div>
</template>
<a
@ -119,7 +120,8 @@
:index="index"
:taxonomy-id="taxonomyId"
:order="order"
:current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"/>
:current-user-can-edit-taxonomy="currentUserCanEditTaxonomy"
@onUpdateTermOpenedState="(state) => term.opened = state"/>
</div>
</template>
<a
@ -139,7 +141,7 @@
@onEditionFinished="onTermEditionFinished($event)"
@onEditionCanceled="onTermEditionCanceled($event)"
@onErrorFound="formWithErrors = editTerm.id"
:form="editTerm"/>
:original-form="editTerm"/>
</div>
</div>
<!-- Empty state image -->
@ -175,14 +177,12 @@
<script>
import { mapActions, mapGetters } from 'vuex';
import TermEditionForm from '../edition/term-edition-form.vue';
import RecursiveTermItem from './recursive-term-item.vue'
import BasicTermItem from './basic-term-item.vue'
import t from 't';
export default {
name: 'TermsList',
components: {
RecursiveTermItem,
BasicTermItem,
TermEditionForm
},

View File

@ -175,12 +175,12 @@
}
},
created() {
eventBusItemMetadata.$on('hasRemovedItemMetadataGroup', () => this.$nextTick(() => this.isRemovingGroup = false));
eventBusItemMetadata.$on('hasRemovedItemMetadataGroup', () => { this.$nextTick(() => this.isRemovingGroup = false) });
eventBusItemMetadata.$on('focusPreviousChildMetadatum', this.focusPreviousChildMetadatum);
eventBusItemMetadata.$on('focusNextChildMetadatum', this.focusNextChildMetadatum);
},
beforeDestroy() {
eventBusItemMetadata.$off('hasRemovedItemMetadataGroup', () => this.$nextTick(() => this.isRemovingGroup = false));
eventBusItemMetadata.$off('hasRemovedItemMetadataGroup', () => { this.$nextTick(() => this.isRemovingGroup = false) });
eventBusItemMetadata.$off('focusPreviousChildMetadatum', this.focusPreviousChildMetadatum);
eventBusItemMetadata.$off('focusNextChildMetadatum', this.focusNextChildMetadatum);
},

View File

@ -60,7 +60,7 @@
:close-button-aria-label="$i18n.get('close')">
<term-edition-form
:taxonomy-id="taxonomyId"
:form="{ id: 'new', name: newTermName ? newTermName : '' }"
:original-form="{ id: 'new', name: newTermName ? newTermName : '' }"
:is-modal="true"
@onEditionFinished="($event) => addRecentlyCreatedTerm($event.term)"
@onEditionCanceled="() => $console.log('Editing canceled')"
@ -72,7 +72,7 @@
<term-creation-panel
v-if="isTermCreationPanelOpen"
:taxonomy-id="taxonomyId"
:form="{ id: 'new', name: newTermName ? newTermName : '' }"
:original-form="{ id: 'new', name: newTermName ? newTermName : '' }"
@onEditionFinished="($event) => addTermToBeCreated($event)"
@onEditionCanceled="() => isTermCreationPanelOpen = false"
@onErrorFound="($event) => $console.log('Form with errors: ' + $event)" />

View File

@ -9,7 +9,7 @@
ref="availableExportersModal">
<div style="width: auto">
<header class="tainacan-modal-title">
<h2>{{ this.$i18n.get('exporters') }}</h2>
<h2>{{ $i18n.get('exporters') }}</h2>
<hr>
</header>

View File

@ -11,7 +11,7 @@
class="tainacan-modal-content"
style="width: auto">
<header class="tainacan-modal-title">
<h2>{{ this.$i18n.get('importers') }}</h2>
<h2>{{ $i18n.get('importers') }}</h2>
<hr>
</header>
<section class="tainacan-form">

View File

@ -11,7 +11,7 @@
class="tainacan-modal-content"
style="width: auto">
<header class="tainacan-modal-title">
<h2>{{ this.$i18n.get('collections') }}</h2>
<h2>{{ $i18n.get('collections') }}</h2>
<hr>
</header>
<section class="tainacan-form">

View File

@ -95,7 +95,7 @@
v-if="$userCaps.hasCapability('tnc_rep_edit_users') && !$adminOptions.hidePrimaryMenuCapabilitiesButton">
<router-link
tag="a"
:to="this.$routerHelper.getCapabilitiesPath()"
:to="$routerHelper.getCapabilitiesPath()"
:class="activeRoute == 'CapabilitiesPage' ? 'is-active':''">
<span class="icon">
<i class="tainacan-icon tainacan-icon-1-25em tainacan-icon-capability"/>

View File

@ -63,7 +63,7 @@
:key="key">
<label class="b-checkbox checkbox">
<input
v-model="selected"
@input="$emit('input', $event.target.value)"
:value="option.id ? (isNaN(Number(option.id)) ? option.id : Number(option.id)) : (isNaN(Number(option.value)) ? option.value : Number(option.value))"
type="checkbox">
<span class="check" />
@ -123,7 +123,7 @@
:key="key">
<label class="b-checkbox checkbox">
<input
v-model="selected"
@input="$emit('input', $event.target.value)"
:value="option.value"
type="checkbox">
<span class="check" />
@ -187,7 +187,7 @@
:key="index">
<label class="b-checkbox checkbox">
<input
v-model="selected"
@input="$emit('input', $event.target.value)"
:value="(isNaN(Number(option.value)) ? option.value : Number(option.value))"
type="checkbox">
<span class="check" />
@ -266,7 +266,7 @@
attached
closable
:class="isModal ? '' : 'is-small'"
@close="selected instanceof Array ? selected.splice(index, 1) : selected = ''">
@close="selected instanceof Array ? $emit('input', JSON.parse(JSON.stringify(selected)).splice(index, 1)) : $emit('input', '')">
<span v-html="(isTaxonomy || metadatum_type === 'Tainacan\\Metadata_Types\\Relationship') ? selectedTagsName[term] : term" />
</b-tag>
</div>

View File

@ -71,7 +71,7 @@
class="b-checkbox checkbox">
<input
:disabled="(Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length"
v-model="selected"
@input="$emit('input', $event.target.value)"
:value="option.id ? (isNaN(Number(option.id)) ? option.id : Number(option.id)) : (isNaN(Number(option.value)) ? option.value : Number(option.value))"
type="checkbox">
<span class="check" />
@ -83,7 +83,8 @@
</label>
<b-radio
v-else
v-model="selected"
:value="selected"
@input="$emit('input', $event.target.value)"
:native-value="option.id ? (isNaN(Number(option.id)) ? option.id : Number(option.value)) : (isNaN(Number(option.value)) ? option.value : Number(option.value))">
<span
class="checkbox-label-text"
@ -140,7 +141,7 @@
<label class="b-checkbox checkbox">
<input
:disabled="(Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length"
v-model="selected"
@input="$emit('input', $event.target.value)"
:value="option.value"
type="checkbox">
<span class="check" />
@ -195,7 +196,7 @@
:class="{ 'is-disabled': (Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length }">
<input
:disabled="(Array.isArray(selected) && selected.indexOf((isNaN(Number(option.value)) ? option.value : Number(option.value))) < 0) && maxMultipleValues !== undefined && maxMultipleValues - 1 < selected.length"
v-model="selected"
@input="$emit('input', $event.target.value)"
:value="(isNaN(Number(option.value)) ? option.value : Number(option.value))"
type="checkbox">
<span class="check" />
@ -205,7 +206,8 @@
</label>
<b-radio
v-else
v-model="selected"
:value="selected"
@input="$emit('input', $event.target.value)"
:native-value="(isNaN(Number(option.value)) ? option.value : Number(option.value))">
{{ `${option.label}` }}
</b-radio>
@ -281,7 +283,7 @@
attached
closable
class="is-small"
@close="selected instanceof Array ? selected.splice(index, 1) : selected = ''">
@close="selected instanceof Array ? $emit('input', JSON.parse(JSON.stringify(selected)).splice(index, 1)) : $emit('input', '')">
<span v-html="(isTaxonomy || metadatum_type === 'Tainacan\\Metadata_Types\\Relationship') ? selectedTagsName[term] : term" />
</b-tag>
</div>

View File

@ -41,7 +41,7 @@
</li>
<li
:key="index"
v-for="(bgProcess, index) of getAllProcesses">
v-for="(bgProcess, index) of bgProcesses">
<div class="process-item">
<div
@click="toggleDetails(index)"
@ -166,23 +166,16 @@ export default {
dateFormat: ''
}
},
computed: {
getAllProcesses(){
if (this.updatedProcesses.length !== 0) {
for (let updatedProcess of this.updatedProcesses) {
let updatedProcessIndex = this.bgProcesses.findIndex((aProcess) => aProcess.ID == updatedProcess.ID);
if (updatedProcessIndex >= 0) {
this.$set(this.bgProcesses, updatedProcessIndex, updatedProcess);
}
}
}
return this.bgProcesses;
}
},
watch: {
bgProcesses(newBG) {
this.hasAnyProcessExecuting = newBG.some((element) => element.done <= 0);
if (this.updatedProcesses.length !== 0) {
for (let updatedProcess of this.updatedProcesses) {
let updatedProcessIndex = this.bgProcesses.findIndex((aProcess) => aProcess.ID == updatedProcess.ID);
if (updatedProcessIndex >= 0)
this.$set(this.bgProcesses, updatedProcessIndex, updatedProcess);
}
}
}
},
created() {

View File

@ -328,8 +328,8 @@
for (let meta in metaquery) {
if (
this.metaqueryOperatorsRegular.hasOwnProperty(metaquery[meta]['compare']) ||
this.metaqueryOperatorsForInterval.hasOwnProperty(metaquery[meta]['compare'])
Object.prototype.hasOwnProperty.call(this.metaqueryOperatorsRegular, metaquery[meta]['compare']) ||
Object.prototype.hasOwnProperty.call(this.metaqueryOperatorsForInterval, metaquery[meta]['compare'])
)
this.$set(this.advancedSearchQuery.metaquery, `${meta}`, metaquery[meta]);
}
@ -349,7 +349,7 @@
let taxquery = this.$route.query.taxquery;
for (let tax in taxquery) {
if ( this.taxqueryOperators.hasOwnProperty(taxquery[tax]['operator']) )
if ( Object.prototype.hasOwnProperty.call(this.taxqueryOperators, taxquery[tax]['operator']) )
this.$set(this.advancedSearchQuery.taxquery, `${tax}`, taxquery[tax]);
}
@ -522,7 +522,7 @@
if ( Object.keys(this.advancedSearchQuery.taxquery).length > 1 )
this.$set(this.advancedSearchQuery.taxquery, 'relation', 'AND');
else if (this.advancedSearchQuery.taxquery.hasOwnProperty('relation'))
else if ( Object.prototype.hasOwnProperty.call(this.advancedSearchQuery.taxquery, 'relation') )
delete this.advancedSearchQuery.taxquery.relation;
// Convert date values to a format (ISO_8601) that will match in database
@ -540,10 +540,10 @@
if ( Object.keys(this.advancedSearchQuery.metaquery).length > 1 )
this.$set(this.advancedSearchQuery.metaquery, 'relation', 'AND');
else if (this.advancedSearchQuery.metaquery.hasOwnProperty('relation'))
else if ( Object.prototype.hasOwnProperty.call(this.advancedSearchQuery.metaquery, 'relation') )
delete this.advancedSearchQuery.metaquery.relation;
if (this.advancedSearchQuery.hasOwnProperty('relation') && Object.keys(this.advancedSearchQuery).length <= 3)
if ( Object.prototype.hasOwnProperty.call(this.advancedSearchQuery, 'relation') && Object.keys(this.advancedSearchQuery).length <= 3)
delete this.advancedSearchQuery.relation;
if (Object.keys(this.advancedSearchQuery.metaquery).length > 0) {

View File

@ -394,9 +394,8 @@
*/
this.prepareFilters();
});
if (this.isUsingElasticSearch) {
if (this.isUsingElasticSearch)
this.$eventBusSearch.$on('isLoadingItems', this.updateIsLoadingItems);
}
},
beforeDestroy() {
// Cancels previous collection name Request
@ -496,7 +495,7 @@
}
},
updateIsLoadingItems(isLoadingItems) {
this.isLoadingItems = isLoadingItems
this.$emit('updateIsLoadingItemsState', isLoadingItems);
}
}
}

View File

@ -69,6 +69,9 @@ import FilterTaxonomyTaginput from '../components/filter-types/taxonomy/Taginput
// Term edition form must be imported here so that it is not necessary on item-submission bundle
import TermEditionForm from '../components/edition/term-edition-form.vue';
// Term Recursive item component needs to be imported here, otherwise would cause ciruclar dependency
import RecursiveTermItem from '../components/lists/recursive-term-item.vue';
import FormFilterNumeric from '../components/filter-types/numeric/FormNumeric.vue';
import FormFilterNumericInterval from '../components/filter-types/numeric-interval/FormNumericInterval.vue';
import FormFilterNumericListInterval from '../components/filter-types/numeric-list-interval/FormNumericListInterval.vue';
@ -103,7 +106,7 @@ import {
export default (element) => {
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanAdminPage() {
@ -244,6 +247,7 @@ export default (element) => {
Vue.component('tainacan-filter-item', TainacanFiltersList);
/* Others */
Vue.component('recursive-term-item', RecursiveTermItem);
Vue.component('help-button', HelpButton);
Vue.component('draggable', draggable);
Vue.component('tainacan-title', TainacanTitle);

View File

@ -17,7 +17,7 @@ import capability from './modules/capability';
import report from './modules/report';
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
Vue.use(Vuex);
export default new Vuex.Store({
@ -28,7 +28,7 @@ export default new Vuex.Store({
on the state tree for detecting inappropriate mutations, and it can be quite expensive when you make
large amount of mutations to the state. Make sure to turn it off in production to avoid the performance cost.
*/
strict: process.env.NODE_ENV !== 'production',
strict: TAINACAN_ENV !== 'production',
modules: {
item,
collection,

View File

@ -7,7 +7,7 @@
}">
<tainacan-title
v-if="!isItemLevel"
:bread-crumb-items="[{ path: '', label: this.$i18n.get('activities') }]"/>
:bread-crumb-items="[{ path: '', label: $i18n.get('activities') }]"/>
<div :class="{ 'above-subheader': isRepositoryLevel }">
<div

View File

@ -5,7 +5,7 @@
'page-container': isRepositoryLevel
}">
<tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('capabilities') }]"/>
:bread-crumb-items="[{ path: '', label: $i18n.get('capabilities') }]"/>
<div class="sub-header">
<b-field

View File

@ -2,7 +2,7 @@
<div class="repository-level-page page-container">
<b-loading :active.sync="isLoading"/>
<tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('collections') }]"/>
:bread-crumb-items="[{ path: '', label: $i18n.get('collections') }]"/>
<div class="sub-header">
<!-- New Collection button -->

View File

@ -1,6 +1,6 @@
<template>
<div :class="{ 'repository-level-page page-container': isRepositoryLevel }">
<tainacan-title :bread-crumb-items="[{ path: '', label: this.$i18n.get('filters') }]"/>
<tainacan-title :bread-crumb-items="[{ path: '', label: $i18n.get('filters') }]"/>
<template v-if="isRepositoryLevel">
<p>{{ $i18n.get('info_repository_filters_inheritance') }}</p>
@ -179,6 +179,7 @@
@onEditionFinished="onEditionFinished()"
@onEditionCanceled="onEditionCanceled()"
@onErrorFound="formWithErrors = filter.id"
@onUpdateSavedState="(state) => editForms[openedFilterId].saved = state"
:index="index"
:original-filter="filter"
:edited-filter="editForms[openedFilterId]"/>
@ -327,7 +328,7 @@
class="tainacan-modal-content"
style="width: auto">
<header class="tainacan-modal-title">
<h2>{{ this.$i18n.get('label_available_filter_types') }}</h2>
<h2>{{ $i18n.get('label_available_filter_types') }}</h2>
<hr>
</header>
<section class="tainacan-form">
@ -404,6 +405,33 @@ export default {
components: {
FilterEditionForm
},
beforeRouteLeave ( to, from, next ) {
let hasUnsavedForms = false;
for (let editForm in this.editForms) {
if (!this.editForms[editForm].saved)
hasUnsavedForms = true;
}
if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) {
this.$buefy.modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_filters_not_saved'),
onConfirm: () => {
this.onEditionCanceled();
next();
},
},
trapFocus: true,
customClass: 'tainacan-modal',
closeButtonAriaLabel: this.$i18n.get('close')
});
} else {
next()
}
},
data(){
return {
isRepositoryLevel: false,
@ -457,33 +485,6 @@ export default {
immediate: true
}
},
beforeRouteLeave ( to, from, next ) {
let hasUnsavedForms = false;
for (let editForm in this.editForms) {
if (!this.editForms[editForm].saved)
hasUnsavedForms = true;
}
if ((this.openedFilterId != '' && this.openedFilterId != undefined) || hasUnsavedForms ) {
this.$buefy.modal.open({
parent: this,
component: CustomDialog,
props: {
icon: 'alert',
title: this.$i18n.get('label_warning'),
message: this.$i18n.get('info_warning_filters_not_saved'),
onConfirm: () => {
this.onEditionCanceled();
next();
},
},
trapFocus: true,
customClass: 'tainacan-modal',
closeButtonAriaLabel: this.$i18n.get('close')
});
} else {
next()
}
},
created() {
this.isRepositoryLevel = (this.$route.params.collectionId === undefined);
},

View File

@ -10,7 +10,7 @@
<!-- PAGE TITLE --------------------- -->
<tainacan-title
v-if="!$adminOptions.hideItemsListPageTitle"
:bread-crumb-items="[{ path: '', label: this.$i18n.get('items') }]"/>
:bread-crumb-items="[{ path: '', label: $i18n.get('items') }]"/>
<!-- SEARCH CONTROL ------------------------- -->
<div
@ -443,6 +443,7 @@
:close-button-aria-label="$i18n.get('close')">
<filters-items-list
:is-loading-items="isLoadingItems"
@updateIsLoadingItemsState="(state) => isLoadingItems = state"
autofocus="true"
tabindex="-1"
aria-modal

View File

@ -3,7 +3,7 @@
:class="{ 'repository-level-page page-container': isRepositoryLevel }"
style="padding-bottom: 0;">
<tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('metadata') }]"/>
:bread-crumb-items="[{ path: '', label: $i18n.get('metadata') }]"/>
<template v-if="isRepositoryLevel">
<p>{{ $i18n.get('info_repository_metadata_inheritance') }}</p>
@ -259,7 +259,7 @@
<child-metadata-list
v-if="metadatum.metadata_type_object && metadatum.metadata_type_object.component == 'tainacan-compound'"
:parent.sync="metadatum"
:parent.sync="activeMetadatumList[index]"
:metadata-name-filter-string="metadataNameFilterString"
:metadata-type-filter-options="metadataTypeFilterOptions"
:has-some-metadata-type-filter-applied="hasSomeMetadataTypeFilterApplied"

View File

@ -2,7 +2,7 @@
<div>
<div class="repository-level-page page-container">
<tainacan-title
:bread-crumb-items="[{ path: '', label: this.$i18n.get('taxonomies') }]"/>
:bread-crumb-items="[{ path: '', label: $i18n.get('taxonomies') }]"/>
<div class="sub-header">
<!-- New Taxonomy Button ---- -->

View File

@ -253,7 +253,7 @@
<attachments-list
v-if="item != undefined && item.id != undefined"
:item="item"
:is-loading.sync="isLoadingAttachments"
:is-loading="isLoadingAttachments"
@isLoadingAttachments="(isLoading) => isLoadingAttachments = isLoading" />
</b-tab-item>

View File

@ -6,7 +6,7 @@ import VueBlurHash from 'vue-blurhash';
export default (element) => {
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanCollectionsCarouselBlocks() {
@ -66,7 +66,7 @@ export default (element) => {
tainacanApiRoot: this.tainacanApiRoot,
tainacanBaseUrl: this.tainacanBaseUrl,
className: this.className,
style: this.style
customStyle: this.style
}
});
},

View File

@ -1,6 +1,6 @@
<template>
<div
:style="style"
:style="customStyle"
:class="className + ' has-mounted'">
<div
:class="'tainacan-carousel ' + (arrowsPosition ? ' has-arrows-' + arrowsPosition : '') + (largeArrows ? ' has-large-arrows' : '') "
@ -177,7 +177,7 @@ export default {
tainacanApiRoot: String,
tainacanBaseUrl: String,
className: String,
style: String
customStyle: String
},
data() {
return {

View File

@ -7,7 +7,7 @@ import VueBlurHash from 'vue-blurhash';
export default (element) => {
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanItemCarouselBlocks() {
@ -78,7 +78,7 @@ export default (element) => {
tainacanApiRoot: this.tainacanApiRoot,
tainacanBaseUrl: this.tainacanBaseUrl,
className: this.className,
style: this.style
customStyle: this.style
}
});
},

View File

@ -1,6 +1,6 @@
<template>
<div
:style="style"
:style="customStyle"
:class="className + ' has-mounted'">
<div v-if="showCollectionHeader">
<div
@ -186,7 +186,7 @@ export default {
tainacanApiRoot: String,
tainacanBaseUrl: String,
className: String,
style: String
customStyle: String
},
data() {
return {

View File

@ -6,7 +6,7 @@ import VueBlurHash from 'vue-blurhash';
export default (element) => {
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanTermsCarouselBlocks() {
@ -66,7 +66,7 @@ export default (element) => {
tainacanBaseUrl: this.tainacanBaseUrl,
className: this.className,
taxonomyId: this.taxonomyId,
style: this.style
customStyle: this.style
}
});
},
@ -88,7 +88,7 @@ export default (element) => {
this.showTermThumbnail = this.$el.attributes['show-term-thumbnail'] != undefined ? this.$el.attributes['show-term-thumbnail'].value == 'true' : false;
this.tainacanApiRoot = this.$el.attributes['tainacan-api-root'] != undefined ? this.$el.attributes['tainacan-api-root'].value : undefined;
this.tainacanBaseUrl = this.$el.attributes['tainacan-base-url'] != undefined ? this.$el.attributes['tainacan-base-url'].value : undefined;
this.style = this.$el.attributes.style != undefined ? this.$el.attributes.style.value : undefined;
this.customStyle = this.$el.attributes.style != undefined ? this.$el.attributes.style.value : undefined;
},
methods: {
__(text, domain) {

View File

@ -1,6 +1,6 @@
<template>
<div
:style="style"
:style="customStyle"
:class="className + ' has-mounted'">
<div
@ -157,7 +157,7 @@ export default {
tainacanBaseUrl: String,
className: String,
taxonomyId: String,
style: String
customStyle: String
},
data() {
return {

View File

@ -6,7 +6,7 @@ import VueBlurHash from 'vue-blurhash';
export default (element) => {
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanDynamicItemsBlocks() {
@ -83,7 +83,7 @@ export default (element) => {
tainacanApiRoot: this.tainacanApiRoot,
tainacanBaseUrl: this.tainacanBaseUrl,
className: this.className,
style: this.style
customStyle: this.style
}
});
},

View File

@ -1,6 +1,6 @@
<template>
<div
:style="style"
:style="customStyle"
:class="className + ' has-mounted'">
<div v-if="showCollectionHeader">
<div
@ -130,7 +130,7 @@
<button
:style="{ marginLeft: paged <= 1 ? 'auto' : '0' }"
class="next-button"
v-if="paged < totalItems/maxItemsNumber && items.length < totalItems"
v-if="paged < totalItems/localMaxItemsNumber && items.length < totalItems"
@click="paged++; fetchItems()"
:label="$root.__('Next page', 'tainacan')">
<span class="icon">
@ -160,7 +160,7 @@
:class="'items-layout-' + layout + (!showName ? ' items-list-without-margin' : '') + (maxColumnsCount ? ' max-columns-count-' + maxColumnsCount : '')">
<li
:key="item"
v-for="item in Number(maxItemsNumber)"
v-for="item in Number(localMaxItemsNumber)"
class="item-list-item skeleton"
:style="{
marginBottom: layout == 'grid' ? (showName ? gridMargin + 12 : gridMargin) + 'px' : '',
@ -307,7 +307,7 @@ export default {
tainacanApiRoot: String,
tainacanBaseUrl: String,
className: String,
style: String
customStyle: String
},
data() {
return {
@ -332,6 +332,7 @@ export default {
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce;
this.localOrder = this.order;
this.localMaxItemsNumber = this.maxItemsNumber;
if (this.showCollectionHeader)
this.fetchCollectionForHeader();
@ -370,9 +371,9 @@ export default {
} else if (this.loadStrategy == 'selection') {
this.maxItemsNumber = this.selectedItems.length;
this.localMaxItemsNumber = this.selectedItems.length;
let endpoint = '/collection/' + this.collectionId + '/items?' + qs.stringify({ postin: this.selectedItems, perpage: this.maxItemsNumber }) + '&fetch_only=title,url,thumbnail';
let endpoint = '/collection/' + this.collectionId + '/items?' + qs.stringify({ postin: this.selectedItems, perpage: this.localMaxItemsNumber }) + '&fetch_only=title,url,thumbnail';
this.tainacanAxios.get(endpoint, { cancelToken: this.itemsRequestSource.token })
.then(response => {
@ -395,8 +396,8 @@ export default {
let queryObject = qs.parse(query);
// Set up max items to be shown
if (this.maxItemsNumber != undefined && Number(this.maxItemsNumber) > 0)
queryObject.perpage = this.maxItemsNumber;
if (this.localMaxItemsNumber != undefined && Number(this.localMaxItemsNumber) > 0)
queryObject.perpage = this.localMaxItemsNumber;
else if (queryObject.perpage != undefined && queryObject.perpage > 0)
this.localMaxItemsNumber = queryObject.perpage;
else {

View File

@ -371,6 +371,7 @@
:close-button-aria-label="$i18n.get('close')">
<filters-items-list
:is-loading-items="isLoadingItems"
@updateIsLoadingItemsState="(state) => isLoadingItems = state"
:autofocus="filtersAsModal"
:tabindex="filtersAsModal ? -1 : 0"
:aria-modal="filtersAsModal"

View File

@ -70,7 +70,7 @@ import {
export default (element) => {
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanItemsListComponent() {

View File

@ -5,7 +5,7 @@ import FacetsListThemeUnit from './facet-unit.vue';
export default (element) => {
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
Vue.component('facets-list-theme-unit', FacetsListThemeUnit);
function renderTainacanFacetsListBlock() {
@ -75,7 +75,7 @@ export default (element) => {
tainacanBaseUrl: this.tainacanBaseUrl,
tainacanSiteUrl: this.tainacanSiteUrl,
className: this.className,
style: this.style
customStyle: this.style
}
});
},

View File

@ -1,6 +1,6 @@
<template>
<div
:style="style"
:style="customStyle"
:class="className + ' has-mounted'">
<div
v-if="showSearchBar"
@ -194,7 +194,7 @@ export default {
tainacanBaseUrl: String,
tainacanSiteUrl: String,
className: String,
style: String
customStyle: String
},
data() {
return {
@ -211,7 +211,8 @@ export default {
tainacanAxios: undefined,
offset: undefined,
totalFacets: 0,
lastTerm: undefined
lastTerm: undefined,
localParentTermId: ''
}
},
computed: {
@ -229,6 +230,7 @@ export default {
this.tainacanAxios.defaults.headers.common['X-WP-Nonce'] = tainacan_blocks.nonce;
this.offset = 0;
this.localParentTermId = this.parentTermId;
this.fetchFacets();
this.applySearchString = debounce(this.applySearchString, 750);
@ -301,11 +303,11 @@ export default {
queryObject.last_term = this.lastTerm;
// Set up parentTerm for taxonomies
if (this.parentTermId !== undefined && this.parentTermId !== null && this.parentTermId !== '' && this.isMetadatumTypeTaxonomy)
queryObject.parent = this.parentTermId;
if (this.localParentTermId !== undefined && this.localParentTermId !== null && this.localParentTermId !== '' && this.isMetadatumTypeTaxonomy)
queryObject.parent = this.localParentTermId;
else {
delete queryObject.parent;
this.parentTermId = null;
this.localParentTermId = null;
}
// Parameter fo tech entity object with image and url

View File

@ -113,7 +113,7 @@
name: 'TermEditionForm',
mixins: [ formHooks ],
props: {
form: Object,
originalForm: Object,
taxonomyId: ''
},
data() {
@ -128,11 +128,14 @@
entityName: 'term',
isLoading: false,
parentTermSearchQuery: '',
parentTermSearchOffset: 0
parentTermSearchOffset: 0,
form: {}
}
},
created() {
this.form = JSON.parse(JSON.stringify(this.originalForm));
},
mounted() {
this.hasParent = this.form.parent != undefined && this.form.parent > 0;
this.initialParentId = this.form.parent;
@ -175,9 +178,8 @@
},
clearErrors(attributes) {
if (attributes instanceof Object) {
for(let attribute in attributes){
for (let attribute in attributes)
this.formErrors[attribute] = undefined;
}
} else {
this.formErrors[attributes] = undefined;
}

View File

@ -50,7 +50,7 @@ export default (element) => {
function renderItemSubmissionForm() {
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
// Gets the div with the content of the block
let blockElement = element ? element : document.getElementById('tainacan-item-submission-form');

View File

@ -31,7 +31,7 @@ import ptBrLocaleConfig from 'apexcharts/dist/locales/pt-br.json';
export default (element) => {
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanReportsPage() {

View File

@ -11,7 +11,7 @@ import RolesPage from '../roles.vue';
export default (element) => {
// Vue Dev Tools!
Vue.config.devtools = process && process.env && process.env.NODE_ENV === 'development';
Vue.config.devtools = TAINACAN_ENV === 'development';
function renderTainacanRolePage() {

View File

@ -86,6 +86,9 @@ module.exports = {
hints: false
},
plugins: [
new webpack.DefinePlugin({
'TAINACAN_ENV': JSON.stringify(process.env.NODE_ENV)
}),
new VueLoaderPlugin({
prettify: false
}),

View File

@ -2,6 +2,7 @@ const { merge } = require('webpack-merge');
const common = require('./webpack.common.js');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const CircularDependencyPlugin = require('circular-dependency-plugin');
module.exports = merge(common, {
mode: 'development',
@ -10,6 +11,18 @@ module.exports = merge(common, {
new BundleAnalyzerPlugin({
openAnalyzer: false,
analyzerMode: 'static'
}),
new CircularDependencyPlugin({
// exclude detection of files based on a RegExp
exclude: /a\.js|node_modules/,
// include specific files based on a RegExp
// add errors to webpack instead of warnings
failOnError: true,
// allow import cycles that include an asyncronous import,
// e.g. via import(/* webpackMode: "weak" */ './file.js')
allowAsyncCycles: true,
// set the current working directory for displaying module paths
cwd: process.cwd(),
})
],
resolve: {

View File

@ -4,8 +4,6 @@ const TerserPlugin = require('terser-webpack-plugin');
const terserPlugin = new TerserPlugin({
parallel: true,
sourceMap: false,
cache: true,
extractComments: false,
terserOptions: {
output: {
@ -19,7 +17,7 @@ const terserPlugin = new TerserPlugin({
module.exports = merge(common, {
mode: 'production',
devtool: '',
devtool: undefined,
optimization: {
minimize: true,
minimizer: [terserPlugin]