Skip to content

Commit

Permalink
Merge branch 'next-35606/disable-compat-groups-s01' into 'trunk'
Browse files Browse the repository at this point in the history
NEXT-35606 - Disable compat groups S01

See merge request shopware/6/product/platform!14445
  • Loading branch information
seggewiss committed Aug 15, 2024
2 parents cb7beae + 8f5f527 commit a32b1fb
Show file tree
Hide file tree
Showing 46 changed files with 303 additions and 267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ Component.register('sw-url-field', {
this.$emit('update:modelValue', value);
},
},

listeners() {
if (!this.isCompatEnabled('INSTANCE_LISTENERS')) {
return {};
}

return this.$listeners;
},
},

methods: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
v-else
v-bind="$attrs"
v-model:value="realValue"
v-on="$listeners"
v-on="listeners"
>
<template
v-for="(index, name) in getSlots()"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import mitt from 'mitt';

const emitter = mitt();
/**
* The pattern for event names = component name in kebab case followed by the event
*/
interface Events extends Record<string|symbol, unknown>{
'sw-product-detail-save-finish': undefined,
}

const emitter = mitt<Events>();

/**
* @private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const { Criteria } = Shopware.Data;
export default {
template,

compatConfig: Shopware.compatConfig,

inject: ['repositoryFactory', 'acl', 'filterFactory', 'feature'],

mixins: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
}"
class="sw-customer-list__button-create"
variant="primary"
:disabled="!acl.can('customer.creator')"
:disabled="!acl.can('customer.creator') || undefined"
:router-link="{ name: 'sw.customer.create' }"
>
{{ $tc('sw-customer.list.buttonAddCustomer') }}
Expand Down Expand Up @@ -82,7 +82,7 @@
:sort-direction="sortDirection"
detail-route="sw.customer.detail"
:show-selection="acl.can('customer.deleter')"
:allow-inline-edit="acl.can('customer.editor')"
:allow-inline-edit="acl.can('customer.editor') || undefined"
:allow-bulk-edit="acl.can('customer.editor')"
:is-loading="isLoading"
:disable-data-fetching="true"
Expand Down Expand Up @@ -255,7 +255,7 @@
{% block sw_customer_list_grid_columns_actions_edit %}
<sw-context-menu-item
class="sw-customer-list__edit-action"
:disabled="!acl.can('customer.editor')"
:disabled="!acl.can('customer.editor') || undefined"
:router-link="{ name: 'sw.customer.detail.base', params: { id: item.id }, query: { edit: true } }"
>
{{ $tc('sw-customer.list.contextMenuEdit') }}
Expand All @@ -267,7 +267,7 @@
<sw-context-menu-item
class="sw-customer-list__delete-action"
variant="danger"
:disabled="!acl.can('customer.deleter')"
:disabled="!acl.can('customer.deleter') || undefined"
@click="onDelete(item.id)"
>
{{ $tc('sw-customer.list.contextMenuDelete') }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @package checkout
* @group disabledCompat
*/

import { mount } from '@vue/test-utils';
import { searchRankingPoint } from 'src/app/service/search-ranking.service';
import Criteria from 'src/core/data/criteria.data';
Expand Down Expand Up @@ -84,6 +89,15 @@ async function createWrapper(privileges = []) {
'sw-empty-state': true,
'sw-context-menu-item': true,
'router-link': true,
'sw-avatar': true,
'sw-text-field': true,
'sw-label': true,
'sw-checkbox-field': true,
'sw-pagination': true,
'sw-bulk-edit-modal': true,
'sw-sidebar-item': true,
'sw-sidebar-filter-panel': true,
'sw-sidebar': true,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default {
inject: [
'repositoryFactory',
'mediaService',
'swProductDetailLoadAll',
],

emits: ['modal-close', 'variations-finish-generate'],
Expand Down Expand Up @@ -306,7 +307,7 @@ export default {
this.actualProgress = 0;
this.maxProgress = 0;

this.$root.$emit('product-reload');
this.swProductDetailLoadAll();
});
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ async function createWrapper() {
return Promise.resolve('defaultFolderId');
},
},
swProductDetailLoadAll: () => {},
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const type = Shopware.Utils.types;
export default {
template,

compatConfig: Shopware.compatConfig,

inject: [
'mediaService',
'repositoryFactory',
Expand All @@ -28,6 +30,12 @@ export default {
'entityValidationService',
],

provide() {
return {
swProductDetailLoadAll: this.loadAll,
};
},

mixins: [
Mixin.getByName('notification'),
Mixin.getByName('placeholder'),
Expand Down Expand Up @@ -373,7 +381,7 @@ export default {
Shopware.State.unregisterModule('swProductDetail');
},

destroyed() {
unmounted() {
this.destroyedComponent();
},

Expand Down Expand Up @@ -404,19 +412,25 @@ export default {
// initialize default state
this.initState();

this.$root.$on('media-remove', (mediaId) => {
this.removeMediaItem(mediaId);
});
this.$root.$on('product-reload', () => {
this.loadAll();
});
if (this.isCompatEnabled('INSTANCE_EVENT_EMITTER')) {
/**
* @deprecated tag:v6.7.0 - Unused event will be removed.
*/
this.$root.$on('media-remove', (mediaId) => {
this.removeMediaItem(mediaId);
});
}

this.initAdvancedModeSettings();
},

destroyedComponent() {
this.$root.$off('media-remove');
this.$root.$off('product-reload');
if (this.isCompatEnabled('INSTANCE_EVENT_EMITTER')) {
/**
* @deprecated tag:v6.7.0 - Unused event will be removed.
*/
this.$root.$off('media-remove');
}
},

initState() {
Expand Down Expand Up @@ -903,7 +917,11 @@ export default {
}

Promise.all(updatePromises).then(() => {
this.$root.$emit('seo-url-save-finish');
if (this.isCompatEnabled('INSTANCE_EVENT_EMITTER')) {
this.$root.$emit('seo-url-save-finish');
} else {
Shopware.Utils.EventBus.emit('sw-product-detail-save-finish');
}
}).then(() => {
switch (response) {
case 'empty': {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* @package inventory
* @group disabledCompat
*/

import { mount } from '@vue/test-utils';
Expand Down Expand Up @@ -149,6 +150,8 @@ describe('module/sw-product/page/sw-product-detail', () => {
'sw-inheritance-warning': true,
'router-link': true,
'sw-product-detail': await wrapTestComponent('sw-product-detail'),
'sw-extension-component-section': true,
'sw-product-clone-modal': true,
},
propsData: {
productId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const { cloneDeep } = Shopware.Utils.object;
export default {
template,

compatConfig: Shopware.compatConfig,

inject: [
'repositoryFactory',
'numberRangeService',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* @package inventory
* @group disabledCompat
*/

import { mount, config } from '@vue/test-utils';
Expand Down Expand Up @@ -219,7 +220,7 @@ async function createWrapper() {
routes: [{
name: 'sw.product.list',
path: '/sw/product/list',
component: await wrapTestComponent('sw-product-list'),
component: await wrapTestComponent('sw-product-list', { sync: true }),
meta: {
$module: {
entity: 'product',
Expand Down Expand Up @@ -331,6 +332,16 @@ async function createWrapper() {
'sw-color-badge': {
template: '<div></div>',
},
'sw-button-group': true,
'sw-text-field': true,
'sw-label': true,
'sw-number-field': true,
'sw-bulk-edit-modal': true,
'sw-product-clone-modal': true,
'sw-product-variant-modal': true,
'sw-sidebar-filter-panel': true,
'sw-data-grid-column-boolean': true,
'sw-data-grid-inline-edit': true,
},
},
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const { mapState, mapGetters } = Shopware.Component.getComponentHelper();
export default {
template,

compatConfig: Shopware.compatConfig,

inject: ['repositoryFactory', 'acl'],

props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* @package inventory
* @group disabledCompat
*/

import { mount } from '@vue/test-utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ const { cloneDeep, merge, get } = Utils.object;
export default {
template,

compatConfig: Shopware.compatConfig,

inject: ['repositoryFactory', 'cmsService', 'feature', 'acl'],

data() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/*
* @package inventory
* @group disabledCompat
*/

import { mount } from '@vue/test-utils';
import swProductDetailLayout from 'src/module/sw-product/view/sw-product-detail-layout';

Shopware.Component.register('sw-product-detail-layout', swProductDetailLayout);

const { State } = Shopware;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const { mapState, mapGetters } = Component.getComponentHelper();
export default {
template,

compatConfig: Shopware.compatConfig,

inject: ['repositoryFactory', 'acl'],

data() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
{% block sw_product_detail_reviews_data_action_edit %}
<sw-context-menu-item
class="sw-product-detail-reviews__action-edit"
:disabled="!acl.can('product.editor')"
:disabled="!acl.can('product.editor') || undefined"
:router-link="{ name: 'sw.review.detail', params: { id: item.id } }"
>
{{ $tc('sw-product.reviewForm.contextMenuEdit') }}
Expand All @@ -74,7 +74,7 @@
<sw-context-menu-item
class="sw-product-detail-reviews__action-delete"
variant="danger"
:disabled="!acl.can('product.editor')"
:disabled="!acl.can('product.editor') || undefined"
@click="onStartReviewDelete(item)"
>
{{ $tc('sw-product.reviewForm.contextMenuDelete') }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/*
* @package inventory
* @group disabledCompat
*/

import { mount } from '@vue/test-utils';
import swProductDetailReviews from 'src/module/sw-product/view/sw-product-detail-reviews';

Shopware.Component.register('sw-product-detail-reviews', swProductDetailReviews);

const { State } = Shopware;

Expand Down Expand Up @@ -66,6 +64,9 @@ async function createWrapper(privileges = []) {
},
'sw-skeleton': true,
'sw-button': true,
'sw-rating-stars': true,
'sw-data-grid-column-boolean': true,
'sw-pagination': true,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const { mapState, mapGetters } = Component.getComponentHelper();
export default {
template,

compatConfig: Shopware.compatConfig,

inject: ['feature', 'acl'],

data() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* @package inventory
* @group disabledCompat
*/

import { mount } from '@vue/test-utils';
Expand Down Expand Up @@ -140,6 +141,12 @@ async function createWrapper(privileges = []) {
'sw-loader': true,
'sw-field-error': await wrapTestComponent('sw-field-error'),
'sw-skeleton': true,
'sw-textarea-field': true,
'sw-switch-field': true,
'sw-product-variant-info': true,
'sw-text-field-deprecated': true,
'sw-button': true,
'sw-ai-copilot-badge': true,
},
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const { mapState, mapGetters } = Shopware.Component.getComponentHelper();
export default {
template,

compatConfig: Shopware.compatConfig,

inject: ['repositoryFactory', 'acl'],

data() {
Expand Down
Loading

0 comments on commit a32b1fb

Please sign in to comment.