From 4662b6887cf52e335690d5219df1861e97ecd6b8 Mon Sep 17 00:00:00 2001 From: Roman Zaritskyi Date: Tue, 26 Nov 2024 13:14:06 +0200 Subject: [PATCH 1/3] fix/ add state resetting in obac`s and rbac`s popup [WTEL-5156] --- .../permissionsTabRolePopupMixin.js | 13 ++++++++++++- .../opened-object-permissions-rbac-role-popup.vue | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/app/mixins/objectPagesMixins/permissionsTabMixin/permissionsTabRolePopupMixin.js b/src/app/mixins/objectPagesMixins/permissionsTabMixin/permissionsTabRolePopupMixin.js index fed0427d5..59947db02 100644 --- a/src/app/mixins/objectPagesMixins/permissionsTabMixin/permissionsTabRolePopupMixin.js +++ b/src/app/mixins/objectPagesMixins/permissionsTabMixin/permissionsTabRolePopupMixin.js @@ -14,7 +14,7 @@ export default { }, }, data: () => ({ - newGrantee: '', + newGrantee: null, }), computed: { ...mapState({ @@ -53,8 +53,19 @@ export default { fields, }); }, + resetNewGrantee() { + this.newGrantee = null; + }, + resetNewGrantor() { + this.newGrantor = null; + }, + resetPopupState() { + if (this.newGrantor) this.resetNewGrantor(); + this.resetNewGrantee(); + }, close() { this.$emit('close'); + this.resetPopupState(); }, }, }; diff --git a/src/modules/permissions/modules/objects/modules/rbac/components/opened-object-permissions-rbac-role-popup.vue b/src/modules/permissions/modules/objects/modules/rbac/components/opened-object-permissions-rbac-role-popup.vue index 3dcfceff4..2459e672e 100644 --- a/src/modules/permissions/modules/objects/modules/rbac/components/opened-object-permissions-rbac-role-popup.vue +++ b/src/modules/permissions/modules/objects/modules/rbac/components/opened-object-permissions-rbac-role-popup.vue @@ -46,7 +46,7 @@ export default { components: { PermissionsRoleSelect }, mixins: [permissionsTabRolePopupMixins], data: () => ({ - newGrantor: '', + newGrantor: null, }), methods: { @@ -56,7 +56,7 @@ export default { grantee: this.newGrantee, grantor: this.newGrantor, }); - this.$emit('close'); + this.close(); } catch (err) { throw err; } From 1fd1e5349b6a27c329f0a8af499767b664f9fffd Mon Sep 17 00:00:00 2001 From: Roman Zaritskyi Date: Wed, 18 Dec 2024 23:51:35 +0200 Subject: [PATCH 2/3] communication-type itemInstance reset[WTEL-5156] --- ...pened-queue-member-communication-popup.vue | 52 +++++++++++-------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/src/modules/contact-center/modules/queues/modules/members/components/communications/opened-queue-member-communication-popup.vue b/src/modules/contact-center/modules/queues/modules/members/components/communications/opened-queue-member-communication-popup.vue index 9d983c50f..d6fdee5d8 100644 --- a/src/modules/contact-center/modules/queues/modules/members/components/communications/opened-queue-member-communication-popup.vue +++ b/src/modules/contact-center/modules/queues/modules/members/components/communications/opened-queue-member-communication-popup.vue @@ -72,12 +72,21 @@ import { required } from '@vuelidate/validators'; import getNamespacedState from '@webitel/ui-sdk/src/store/helpers/getNamespacedState'; import deepCopy from 'deep-copy'; import { mapActions, mapState } from 'vuex'; -import nestedObjectMixin - from '../../../../../../../../app/mixins/objectPagesMixins/openedObjectMixin/nestedObjectMixin'; +import nestedObjectMixin from '../../../../../../../../app/mixins/objectPagesMixins/openedObjectMixin/nestedObjectMixin'; import CommunicationsAPI from '../../../../../../../lookups/modules/communications/api/communications'; import ResourcesAPI from '../../../../../resources/api/resources'; import { digitsDtmfOnly } from '../../validation/dtmf'; +const getDefaultItemInstance = () => ({ + destination: '', + display: '', + priority: 0, + type: {}, + resource: {}, + description: '', + dtmf: '', +}); + export default { name: 'OpenedAgentSkillsPopup', mixins: [nestedObjectMixin], @@ -89,15 +98,7 @@ export default { }), data: () => ({ namespace: 'ccenter/queues/members', - itemInstanceValue: { - destination: '', - display: '', - priority: 0, - type: {}, - resource: {}, - description: '', - dtmf: '', - }, + itemInstanceValue: getDefaultItemInstance(), }), validations: { itemInstance: { @@ -110,7 +111,8 @@ export default { computed: { ...mapState({ commList(state) { - return getNamespacedState(state, `${this.namespace}`).itemInstance.communications; + return getNamespacedState(state, `${this.namespace}`).itemInstance + .communications; }, }), // override mixin map state @@ -127,7 +129,7 @@ export default { }, communicationIndex() { return this.$route.params.communicationIndex; - } + }, }, methods: { @@ -136,7 +138,10 @@ export default { return dispatch(`${this.namespace}/ADD_MEMBER_COMMUNICATION`, payload); }, updateItem(dispatch, payload) { - return dispatch(`${this.namespace}/UPDATE_MEMBER_COMMUNICATION`, payload); + return dispatch( + `${this.namespace}/UPDATE_MEMBER_COMMUNICATION`, + payload, + ); }, }), initEditedValue() { @@ -162,20 +167,25 @@ export default { return ResourcesAPI.getLookup(params); }, loadItem() {}, - resetState() {}, + resetItemInstance() { + this.itemInstance = getDefaultItemInstance(); + }, + resetState() { + this.resetItemInstance(); + }, }, watch: { communicationIndex: { - handler(index) { + handler(index) { if (index) { this.initEditedValue(); } - }, immediate: true, - } + this.resetState(); + }, + immediate: true, + }, }, }; - + From d58bcdd8b8d056004ada4445e16eb4944cf6a4a7 Mon Sep 17 00:00:00 2001 From: Roman Zaritskyi Date: Thu, 19 Dec 2024 00:15:35 +0200 Subject: [PATCH 3/3] teams agents popup resiting [WTEL-5156] --- .../agents/components/create-team-agent-popup.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/modules/contact-center/modules/teams/modules/agents/components/create-team-agent-popup.vue b/src/modules/contact-center/modules/teams/modules/agents/components/create-team-agent-popup.vue index 78669c45b..13d3add13 100644 --- a/src/modules/contact-center/modules/teams/modules/agents/components/create-team-agent-popup.vue +++ b/src/modules/contact-center/modules/teams/modules/agents/components/create-team-agent-popup.vue @@ -52,7 +52,7 @@ export default { setup: () => ({ // Reasons for use $stopPropagation // https://webitel.atlassian.net/browse/WTEL-4559?focusedCommentId=621761 - v$: useVuelidate({$stopPropagation: true}), + v$: useVuelidate({ $stopPropagation: true }), }), data: () => ({ @@ -73,8 +73,13 @@ export default { return AgentsAPI.getLookup(params); }, }, + + watch: { + agentId() { + this.resetState(); + }, + }, }; - +