From 581e68225a4d3966aaf90323ef48567bf4a17c5c Mon Sep 17 00:00:00 2001 From: Carlo Venusino Date: Fri, 24 Apr 2020 16:19:17 +0200 Subject: [PATCH] TT#79757 CF Offline implement mutations, actions and Vue store related functions Change-Id: I04aa842b1ea97f1c4750a30145dca439ae61dac9 --- .../NewCallForward/CscCallForwardGroup.vue | 22 ++++---- .../NewCallForward/CscNewCallForward.vue | 50 +++++++++---------- .../CscNewCallForwardAddDestinationForm.vue | 3 +- src/store/new-call-forward.js | 9 +++- 4 files changed, 41 insertions(+), 43 deletions(-) diff --git a/src/components/pages/NewCallForward/CscCallForwardGroup.vue b/src/components/pages/NewCallForward/CscCallForwardGroup.vue index de1867b6..74d315f9 100644 --- a/src/components/pages/NewCallForward/CscCallForwardGroup.vue +++ b/src/components/pages/NewCallForward/CscCallForwardGroup.vue @@ -10,12 +10,7 @@ class="col col-xs-12 col-md-4 text-right csc-cf-group-title" > {{ !(groupsCount < 2 && (group.name.includes('timeout') || group.name.includes('unconditional'))) ? groupTitle :"" }} - +
+
-
+
+ +
+
+
+ +
+
-
- -
-
-
- -
-
- @@ -183,10 +182,7 @@ } break; case "offline":{ - const offlineFwdGroup = await this.$store.dispatch('newCallForward/getForwardGroupByName', 'offline'); - if(!offlineFwdGroup){ - await this.$store.dispatch('newCallForward/addTempGroup','offline' ); - } + await this.$store.dispatch('newCallForward/addTempGroup','offline' ); } break; diff --git a/src/components/pages/NewCallForward/CscNewCallForwardAddDestinationForm.vue b/src/components/pages/NewCallForward/CscNewCallForwardAddDestinationForm.vue index b30a0a24..ce91ff5a 100644 --- a/src/components/pages/NewCallForward/CscNewCallForwardAddDestinationForm.vue +++ b/src/components/pages/NewCallForward/CscNewCallForwardAddDestinationForm.vue @@ -116,6 +116,7 @@ }); } else { // new destination + await this.$store.dispatch('newCallForward/setDestinationInCreation', true); if(forwardGroup.id.toString().includes('temp-')){ // unexisting group forwardGroup.destinations[0].simple_destination = this.number; // optimistic UI update :) await this.$store.dispatch('newCallForward/addForwardGroup', { @@ -124,7 +125,7 @@ }); } else{ // existing group - await this.$store.dispatch('newCallForward/setDestinationInCreation', true); + await this.$store.dispatch('newCallForward/addDestination', { forwardGroupId: forwardGroup.id, destination: this.number diff --git a/src/store/new-call-forward.js b/src/store/new-call-forward.js index 4d3ba434..59fa7ab3 100644 --- a/src/store/new-call-forward.js +++ b/src/store/new-call-forward.js @@ -93,8 +93,13 @@ export default { state.mappings = mappings; }, loadForwardGroups(state, forwardGroups){ - if(forwardGroups[0] && (forwardGroups[0].name.includes('unconditional') || forwardGroups[0].name.includes('timeout'))){ - forwardGroups.push(forwardGroups.shift()) + + for (let i = 0; i < forwardGroups.length; i++) { + const group = forwardGroups[i]; + if (!group.name.includes('unconditional') && !group.name.includes('timeout')){ + forwardGroups.splice(i, 1); + forwardGroups.unshift(group); + } } state.forwardGroups = forwardGroups; },