TT#79757 CF Offline implement mutations, actions and Vue store related functions

Change-Id: I04aa842b1ea97f1c4750a30145dca439ae61dac9
changes/33/39633/4
Carlo Venusino 6 years ago
parent 7065b350da
commit 581e68225a

@ -10,12 +10,7 @@
class="col col-xs-12 col-md-4 text-right csc-cf-group-title" 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 :"" }} {{ !(groupsCount < 2 && (group.name.includes('timeout') || group.name.includes('unconditional'))) ? groupTitle :"" }}
<q-spinner-dots
v-if="toggleGroupInProgress"
class="csc-call-spinner"
color="primary"
:size="24"
/>
</div> </div>
<div class="col text-left col-xs-12 col-md-2 csc-cf-dest-number-cont"> <div class="col text-left col-xs-12 col-md-2 csc-cf-dest-number-cont">
<q-toggle <q-toggle
@ -24,6 +19,12 @@
/> />
</div> </div>
<div class="col col-xs-12 col-md-5 "> <div class="col col-xs-12 col-md-5 ">
<q-spinner-dots
v-if="toggleGroupInProgress || destinationInCreation"
class="csc-call-spinner"
color="primary"
:size="24"
/>
</div> </div>
</div> </div>
<div <div
@ -60,13 +61,6 @@
{{ $t('pages.newCallForward.addDestinationLabel') }} {{ $t('pages.newCallForward.addDestinationLabel') }}
<q-spinner-dots
v-if="destinationInCreation"
class="csc-call-spinner"
color="primary"
:size="24"
/>
</div> </div>
<q-popover <q-popover
ref="destTypeForm" ref="destTypeForm"
@ -197,8 +191,10 @@
this.$refs.numberForm.open(); this.$refs.numberForm.open();
break; break;
case 'voicemail': case 'voicemail':
await this.$store.dispatch('newCallForward/setDestinationInCreation', true);
await this.$store.dispatch('newCallForward/addVoiceMail', this.group.id); await this.$store.dispatch('newCallForward/addVoiceMail', this.group.id);
await this.$store.dispatch('newCallForward/loadForwardGroups'); await this.$store.dispatch('newCallForward/loadForwardGroups');
await this.$store.dispatch('newCallForward/setDestinationInCreation', false);
break; break;
} }
}, },

@ -26,6 +26,28 @@
@change="toggleChange" /> @change="toggleChange" />
</div> </div>
</div> </div>
<div
class="csc-cf-row row"
v-for="(forwardGroup, item) in forwardGroups"
:key="forwardGroup.id"
>
<csc-cf-group
v-if="!groupInCreation"
:group="forwardGroup"
/>
</div>
<div class="csc-cf-row row">
<div
class="column col col-xs-12 col-md-4"
>
<q-spinner-dots
v-if="groupsLoading"
class="csc-call-spinner"
color="primary"
:size="24"
/>
</div>
</div>
<div class="csc-cf-row row"> <div class="csc-cf-row row">
<div <div
class="column col col-xs-12 col-md-4 items-end" class="column col col-xs-12 col-md-4 items-end"
@ -62,29 +84,6 @@
</div> </div>
</div> </div>
<div
class="csc-cf-row row"
v-for="(forwardGroup, item) in forwardGroups"
:key="forwardGroup.id"
>
<csc-cf-group
v-if="!groupInCreation"
:group="forwardGroup"
/>
</div>
<div class="csc-cf-row row">
<div
class="column col col-xs-12 col-md-4"
>
<q-spinner-dots
v-if="groupsLoading"
class="csc-call-spinner"
color="primary"
:size="24"
/>
</div>
</div>
</csc-page> </csc-page>
</template> </template>
@ -183,11 +182,8 @@
} }
break; break;
case "offline":{ 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; break;
} }

@ -116,6 +116,7 @@
}); });
} }
else { // new destination else { // new destination
await this.$store.dispatch('newCallForward/setDestinationInCreation', true);
if(forwardGroup.id.toString().includes('temp-')){ // unexisting group if(forwardGroup.id.toString().includes('temp-')){ // unexisting group
forwardGroup.destinations[0].simple_destination = this.number; // optimistic UI update :) forwardGroup.destinations[0].simple_destination = this.number; // optimistic UI update :)
await this.$store.dispatch('newCallForward/addForwardGroup', { await this.$store.dispatch('newCallForward/addForwardGroup', {
@ -124,7 +125,7 @@
}); });
} }
else{ // existing group else{ // existing group
await this.$store.dispatch('newCallForward/setDestinationInCreation', true);
await this.$store.dispatch('newCallForward/addDestination', { await this.$store.dispatch('newCallForward/addDestination', {
forwardGroupId: forwardGroup.id, forwardGroupId: forwardGroup.id,
destination: this.number destination: this.number

@ -93,8 +93,13 @@ export default {
state.mappings = mappings; state.mappings = mappings;
}, },
loadForwardGroups(state, forwardGroups){ 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; state.forwardGroups = forwardGroups;
}, },

Loading…
Cancel
Save