TT#33814 CodeQuality: Introduce ESLint for syntax and semantic checks

Change-Id: I4199699ad40871e7f1c8aeca0339637dff6f86a0
changes/28/19528/2
Hans-Peter Herzog 8 years ago
parent bb61dc59f3
commit 831e322815

@ -6,26 +6,23 @@ module.exports = {
}, },
env: { env: {
browser: true, browser: true,
{ "es6": true } es6: true
}, },
// https://github.com/feross/standard/blob/master/RULES.md#javascript-standard-style
extends: [ extends: [
'eslint:recommended' 'eslint:recommended'
], ],
// required to lint *.vue files
plugins: [ plugins: [
'html', 'html',
'import' 'import'
], ],
globals: { globals: {
'cdk': true,
'cordova': true, 'cordova': true,
'DEV': true, 'DEV': true,
'PROD': true, 'PROD': true,
'__THEME': true '__THEME': true
}, },
// add your custom rules here rules: {
'rules': {
// allow paren-less arrow functions
'arrow-parens': 0, 'arrow-parens': 0,
'one-var': 0, 'one-var': 0,
'import/first': 0, 'import/first': 0,
@ -33,9 +30,9 @@ module.exports = {
'import/namespace': 2, 'import/namespace': 2,
'import/default': 2, 'import/default': 2,
'import/export': 2, 'import/export': 2,
// allow debugger during development
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'brace-style': [2, 'stroustrup', { 'allowSingleLine': true }], 'brace-style': [2, 'stroustrup', {'allowSingleLine': true}],
"no-console": 0 "no-console": 0
} }
} };

@ -35,6 +35,16 @@ module.exports = {
}, },
module: { module: {
rules: [ rules: [
{
enforce: 'pre',
test: /\.(vue|js)$/,
loader: 'eslint-loader',
include: projectRoot,
exclude: /node_modules/,
options: {
formatter: require('eslint-friendly-formatter')
}
},
{ {
test: /\.js$/, test: /\.js$/,
loader: 'babel-loader', loader: 'babel-loader',

@ -13,7 +13,6 @@
} }
</script> </script>
<style> <style>
.q-field-icon, .q-field-icon,
.q-item-icon { .q-item-icon {

@ -1,5 +1,6 @@
import Vue from 'vue'; import _ from 'lodash';
import { enableBlockIn, disableBlockIn, import { enableBlockIn, disableBlockIn,
getPreferences, addToBlockInList, getPreferences, addToBlockInList,
editBlockInList, removeFromBlockInList, editBlockInList, removeFromBlockInList,
@ -34,7 +35,8 @@ export function addNumberToIncomingList(id, number) {
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
if(_.isEmpty(number)) { if(_.isEmpty(number)) {
reject(new Error('Number may not be empty')); reject(new Error('Number may not be empty'));
} else { }
else {
addToBlockInList(id, number).then(()=>{ addToBlockInList(id, number).then(()=>{
resolve(); resolve();
}).catch((err)=>{ }).catch((err)=>{
@ -89,7 +91,8 @@ export function addNumberToOutgoingList(id, number) {
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
if(_.isEmpty(number)) { if(_.isEmpty(number)) {
reject(new Error('Number may not be empty')); reject(new Error('Number may not be empty'));
} else { }
else {
addToBlockOutList(id, number).then(()=>{ addToBlockOutList(id, number).then(()=>{
resolve(); resolve();
}).catch((err)=>{ }).catch((err)=>{

@ -30,7 +30,8 @@ export function getSourcesets(id) {
return Vue.http.get('/api/cfsourcesets/', return Vue.http.get('/api/cfsourcesets/',
{ params: { subscriber_id: id, page: 1, { params: { subscriber_id: id, page: 1,
rows: totalCount } }) rows: totalCount } })
} else { }
else {
return Promise.resolve(result); return Promise.resolve(result);
} }
}).then(result => { }).then(result => {
@ -52,7 +53,8 @@ export function getTimesets(id) {
return Vue.http.get('/api/cftimesets/', return Vue.http.get('/api/cftimesets/',
{ params: { subscriber_id: id, page: 1, { params: { subscriber_id: id, page: 1,
rows: totalCount } }) rows: totalCount } })
} else { }
else {
return Promise.resolve(result); return Promise.resolve(result);
} }
}).then((result) => { }).then((result) => {
@ -76,7 +78,8 @@ export function getDestinationsets(id) {
return Vue.http.get('/api/cfdestinationsets/', return Vue.http.get('/api/cfdestinationsets/',
{ params: { subscriber_id: id, page: 1, { params: { subscriber_id: id, page: 1,
rows: totalCount } }) rows: totalCount } })
} else { }
else {
return Promise.resolve(result); return Promise.resolve(result);
} }
}).then(result => { }).then(result => {
@ -181,9 +184,10 @@ export function deleteDestinationFromDestinationset(options) {
}).catch((err) => { }).catch((err) => {
console.log(err); console.log(err);
}); });
} else { }
else {
resolve(result); resolve(result);
}; }
}).catch(err => { }).catch(err => {
reject(err); reject(err);
}); });
@ -395,7 +399,7 @@ export function getDaysFromRange(options) {
while (fromDay < toDay) { while (fromDay < toDay) {
days.push({ name: wdayMap[fromDay], number: fromDay.toString() }); days.push({ name: wdayMap[fromDay], number: fromDay.toString() });
fromDay++; fromDay++;
}; }
return days; return days;
} }
@ -413,8 +417,9 @@ export function getHoursFromRange(options) {
hour: options.fromHour.toString() hour: options.fromHour.toString()
}); });
options.fromHour++; options.fromHour++;
}; }
} else { }
else {
hours.push({ hours.push({
from: `${options.fromHour}:${fromMinute}`, from: `${options.fromHour}:${fromMinute}`,
to: `${toHour}:${toMinute}` to: `${toHour}:${toMinute}`
@ -439,7 +444,8 @@ export function convertTimesetToWeekdays(options) {
if (isIncompatible) { if (isIncompatible) {
timesetIsCompatible = false; timesetIsCompatible = false;
return; return;
} else { }
else {
let days = []; let days = [];
let hours = []; let hours = [];
let fromDay = parseInt(time.wday.split('-')[0]); let fromDay = parseInt(time.wday.split('-')[0]);
@ -453,7 +459,8 @@ export function convertTimesetToWeekdays(options) {
if (isReverse) { if (isReverse) {
timesetHasReverse = true; timesetHasReverse = true;
return; return;
} else { }
else {
hours = getHoursFromRange({ hasMinute: !!time.minute, hours = getHoursFromRange({ hasMinute: !!time.minute,
fromHour: fromHour, toHour: toHour, fromHour: fromHour, toHour: toHour,
fromMinute: fromMinute, toMinute: toMinute }); fromMinute: fromMinute, toMinute: toMinute });
@ -478,7 +485,8 @@ export function convertTimesetToWeekdays(options) {
}); });
timesetExists = true; timesetExists = true;
counter++; counter++;
} else if (timesetNameMatches) { }
else if (timesetNameMatches) {
timesetHasDuplicate = true; timesetHasDuplicate = true;
return; return;
} }

@ -20,18 +20,19 @@ export function getConversations(id, page, rows) {
item._id = id; item._id = id;
if (item._links['ngcp:voicemailrecordings']) { if (item._links['ngcp:voicemailrecordings']) {
item.voicemail = item._links['ngcp:voicemailrecordings'].href; item.voicemail = item._links['ngcp:voicemailrecordings'].href;
}; }
delete item._links; delete item._links;
if (item.type == 'call') { if (item.type == 'call') {
item.type = item.call_type != 'call' ? 'callforward' item.type = item.call_type != 'call' ? 'callforward'
: item.type; : item.type;
}; }
list.push(item); list.push(item);
}); });
resolve(list); resolve(list);
} else { }
else {
reject(new Error('No items returned for this page.')) reject(new Error('No items returned for this page.'))
}; }
}).catch(err => { }).catch(err => {
reject(err); reject(err);
}); });

@ -1,7 +1,8 @@
import _ from 'lodash';
import Vue from 'vue'; import Vue from 'vue';
import { getJsonBody } from './utils'; import { getJsonBody } from './utils';
import { getNumbers, assignNumber, assignNumbers } from './user'; import { getNumbers, assignNumbers } from './user';
import { createSubscriber, deleteSubscriber } from './subscriber'; import { createSubscriber, deleteSubscriber } from './subscriber';
import uuid from 'uuid'; import uuid from 'uuid';
@ -27,7 +28,8 @@ export function getAllPbxSubscribers() {
rows: body.total_count, rows: body.total_count,
}) })
}); });
} else { }
else {
return Promise.resolve(body); return Promise.resolve(body);
} }
}).then(($subscribers)=>{ }).then(($subscribers)=>{
@ -38,9 +40,11 @@ export function getAllPbxSubscribers() {
subscribers.forEach((subscriber)=>{ subscribers.forEach((subscriber)=>{
if(_.has(subscriber, 'is_pbx_pilot') && subscriber.is_pbx_pilot === true) { if(_.has(subscriber, 'is_pbx_pilot') && subscriber.is_pbx_pilot === true) {
pilot = subscriber; pilot = subscriber;
} else if(_.has(subscriber, 'is_pbx_group') && subscriber.is_pbx_group === true) { }
else if(_.has(subscriber, 'is_pbx_group') && subscriber.is_pbx_group === true) {
groups.push(subscriber); groups.push(subscriber);
} else if (_.has(subscriber, 'pbx_extension') && subscriber.pbx_extension !== null) { }
else if (_.has(subscriber, 'pbx_extension') && subscriber.pbx_extension !== null) {
seats.push(subscriber); seats.push(subscriber);
} }
}); });

@ -59,7 +59,7 @@ function patchReminder(id, field, value) {
'Content-Type': 'application/json-patch+json' 'Content-Type': 'application/json-patch+json'
} }
}; };
Vue.http.patch('/api/reminders/' + id, data, patchHeaders).then((result) => { Vue.http.patch('/api/reminders/' + id, data, patchHeaders).then(() => {
resolve(); resolve();
}).catch((err) => { }).catch((err) => {
reject(err); reject(err);

@ -17,7 +17,7 @@ export function setPreference(id, field, value) {
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
var headers = {}; var headers = {};
headers['Content-Type'] = 'application/json-patch+json'; headers['Content-Type'] = 'application/json-patch+json';
Promise.resolve().then((result)=>{ Promise.resolve().then(()=>{
return Vue.http.patch('/api/subscriberpreferences/' + id, [{ return Vue.http.patch('/api/subscriberpreferences/' + id, [{
op: 'replace', op: 'replace',
path: '/'+ field, path: '/'+ field,
@ -36,7 +36,8 @@ export function setPreference(id, field, value) {
}).catch((err)=>{ }).catch((err)=>{
reject(err); reject(err);
}); });
} else { }
else {
reject(err); reject(err);
} }
}); });
@ -74,7 +75,7 @@ export function appendItemToArrayPreference(id, field, value) {
}).then(()=>{ }).then(()=>{
resolve(); resolve();
}).catch((err)=>{ }).catch((err)=>{
reject(); reject(err);
}); });
}); });
} }
@ -89,7 +90,8 @@ export function editItemInArrayPreference(id, field, itemIndex, value) {
if(_.isArray(prefs[field]) && itemIndex < prefs[field].length) { if(_.isArray(prefs[field]) && itemIndex < prefs[field].length) {
prefs[field][itemIndex] = value; prefs[field][itemIndex] = value;
return Vue.http.put('/api/subscriberpreferences/' + id, prefs); return Vue.http.put('/api/subscriberpreferences/' + id, prefs);
} else { }
else {
return Promise.reject(new Error('Array index does not exists')); return Promise.reject(new Error('Array index does not exists'));
} }
}).then(()=>{ }).then(()=>{
@ -115,7 +117,7 @@ export function removeItemFromArrayPreference(id, field, itemIndex) {
}).then(()=>{ }).then(()=>{
resolve(); resolve();
}).catch((err)=>{ }).catch((err)=>{
reject(); reject(err);
}); });
}); });
} }
@ -191,7 +193,8 @@ export function createSubscriber(subscriber) {
}).catch((err)=>{ }).catch((err)=>{
if(err.status >= 400) { if(err.status >= 400) {
reject(new Error(err.body.message)); reject(new Error(err.body.message));
} else { }
else {
reject(err); reject(err);
} }
}); });
@ -200,12 +203,13 @@ export function createSubscriber(subscriber) {
export function deleteSubscriber(id) { export function deleteSubscriber(id) {
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
Vue.http.delete('/api/subscribers/' + id).then((res)=>{ Vue.http.delete('/api/subscribers/' + id).then(()=>{
resolve(); resolve();
}).catch((err)=>{ }).catch((err)=>{
if(err.status >= 400) { if(err.status >= 400) {
reject(new Error(err.body.message)); reject(new Error(err.body.message));
} else { }
else {
reject(err); reject(err);
} }
}); });

@ -21,7 +21,8 @@ export function login(username, password) {
}).catch((err)=>{ }).catch((err)=>{
if(err.status && err.status >= 400) { if(err.status && err.status >= 400) {
reject(new Error(err.body.message)); reject(new Error(err.body.message));
} else { }
else {
reject(err); reject(err);
} }
}); });
@ -76,7 +77,7 @@ export function assignNumber(numberId, subscriberId) {
return new Promise((resolve, reject)=>{ return new Promise((resolve, reject)=>{
var headers = {}; var headers = {};
headers['Content-Type'] = 'application/json-patch+json'; headers['Content-Type'] = 'application/json-patch+json';
Promise.resolve().then((result)=>{ Promise.resolve().then(() => {
return Vue.http.patch('/api/numbers/' + numberId, [{ return Vue.http.patch('/api/numbers/' + numberId, [{
op: 'replace', op: 'replace',
path: '/subscriber_id', path: '/subscriber_id',
@ -104,7 +105,8 @@ export function assignNumbers(numberIds, subscriberId) {
}).catch((err)=>{ }).catch((err)=>{
reject(err); reject(err);
}); });
} else { }
else {
resolve(); resolve();
} }
}); });
@ -130,7 +132,8 @@ export function getNumbers() {
rows: body.total_count, rows: body.total_count,
}) })
}); });
} else { }
else {
return Promise.resolve(res); return Promise.resolve(res);
} }
}).then((res)=>{ }).then((res)=>{

@ -6,7 +6,8 @@ export function getJsonBody(body) {
if(_.isString(body)) { if(_.isString(body)) {
try { try {
return JSON.parse(body); return JSON.parse(body);
} catch(err) { }
catch(err) {
return body; return body;
} }
} }

@ -80,10 +80,10 @@
<script> <script>
import Vue from 'vue'; import Vue from 'vue';
import _ from 'lodash'; import _ from 'lodash';
import { mapState, mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import CscMedia from './CscMedia' import CscMedia from './CscMedia'
import { QLayout, QCard, QCardTitle, QCardSeparator, QCardMain, QField, QInput, import { QLayout, QCard, QCardTitle, QCardSeparator, QCardMain, QField, QInput,
QCardActions, QBtn, QIcon, Loading, Alert, QSpinnerRings, Dialog, Platform, QAlert } from 'quasar-framework' QCardActions, QBtn, QIcon, QSpinnerRings, Dialog, Platform, QAlert } from 'quasar-framework'
import { normalizeNumber, rawNumber } from '../filters/number-format' import { normalizeNumber, rawNumber } from '../filters/number-format'
import numberFormat from '../filters/number-format' import numberFormat from '../filters/number-format'
import { showCallNotification } from '../helpers/ui' import { showCallNotification } from '../helpers/ui'
@ -143,7 +143,8 @@
number: this.phoneNumber, number: this.phoneNumber,
localMedia: localMedia localMedia: localMedia
}); });
} else { }
else {
this.phoneNumberError = true; this.phoneNumberError = true;
} }
}, },
@ -161,7 +162,8 @@
if(this.isPreparing || this.isEnded) { if(this.isPreparing || this.isEnded) {
this.init(); this.init();
this.$emit('close'); this.$emit('close');
} else { }
else {
Dialog.create({ Dialog.create({
title: this.$t('call.endCall'), title: this.$t('call.endCall'),
message: this.$t('call.endCallDialog'), message: this.$t('call.endCallDialog'),
@ -188,21 +190,24 @@
toggleAudio() { toggleAudio() {
if(this.isAudioEnabled) { if(this.isAudioEnabled) {
this.$store.dispatch('call/disableAudio'); this.$store.dispatch('call/disableAudio');
} else { }
else {
this.$store.dispatch('call/enableAudio'); this.$store.dispatch('call/enableAudio');
} }
}, },
toggleVideo() { toggleVideo() {
if(this.isVideoEnabled) { if(this.isVideoEnabled) {
this.$store.dispatch('call/disableVideo'); this.$store.dispatch('call/disableVideo');
} else { }
else {
this.$store.dispatch('call/enableVideo'); this.$store.dispatch('call/enableVideo');
} }
}, },
toggleMute() { toggleMute() {
if(this.isMuted) { if(this.isMuted) {
this.$store.commit('call/unmute'); this.$store.commit('call/unmute');
} else { }
else {
this.$store.commit('call/mute'); this.$store.commit('call/mute');
} }
}, },
@ -217,21 +222,24 @@
toggleAudioIcon() { toggleAudioIcon() {
if(this.isAudioEnabled) { if(this.isAudioEnabled) {
return 'mic' return 'mic'
} else { }
else {
return 'mic off'; return 'mic off';
} }
}, },
toggleVideoIcon() { toggleVideoIcon() {
if(this.isVideoEnabled) { if(this.isVideoEnabled) {
return 'videocam' return 'videocam'
} else { }
else {
return 'videocam off'; return 'videocam off';
} }
}, },
toggleMuteIcon() { toggleMuteIcon() {
if(this.isMuted) { if(this.isMuted) {
return 'volume off' return 'volume off'
} else { }
else {
return 'volume up'; return 'volume up';
} }
}, },
@ -255,14 +263,16 @@
localMediaStream() { localMediaStream() {
if(this.$store.state.call.localMediaStream !== null) { if(this.$store.state.call.localMediaStream !== null) {
return this.$store.state.call.localMediaStream.getStream(); return this.$store.state.call.localMediaStream.getStream();
} else { }
else {
return null; return null;
} }
}, },
remoteMediaStream() { remoteMediaStream() {
if(this.$store.state.call.remoteMediaStream !== null) { if(this.$store.state.call.remoteMediaStream !== null) {
return this.$store.state.call.remoteMediaStream.getStream(); return this.$store.state.call.remoteMediaStream.getStream();
} else { }
else {
return null; return null;
} }
}, },
@ -316,12 +326,15 @@
if(state === 'incoming') { if(state === 'incoming') {
showCallNotification(numberFormat(this.getNumber)); showCallNotification(numberFormat(this.getNumber));
this.$refs.incomingSound.play(); this.$refs.incomingSound.play();
} else if (state === 'input') { }
else if (state === 'input') {
this.focusNumberInput(); this.focusNumberInput();
this.$refs.incomingSound.pause(); this.$refs.incomingSound.pause();
} else if (state === 'ringing') { }
else if (state === 'ringing') {
this.$refs.incomingSound.play(); this.$refs.incomingSound.play();
} else { }
else {
this.$refs.incomingSound.pause(); this.$refs.incomingSound.pause();
} }
} }
@ -330,8 +343,7 @@
</script> </script>
<style lang="stylus"> <style lang="stylus">
@import '../../src/themes/app.variables.styl'; @import '../themes/quasar.variables.styl';
@import '../../src/themes/quasar.variables.styl';
.csc-call { .csc-call {
width: inherit; width: inherit;

@ -58,11 +58,10 @@
</q-btn> </q-btn>
</q-card-actions> </q-card-actions>
</div> </div>
</csc-collapsible-card> </csc-card-collapsible>
</template> </template>
<script> <script>
import Vue from 'vue'
import CscCardCollapsible from './card/CscCardCollapsible' import CscCardCollapsible from './card/CscCardCollapsible'
import { QBtn, QPopover, QItem, QList, QCardActions, import { QBtn, QPopover, QItem, QList, QCardActions,
QChip, QCardSeparator } from 'quasar-framework' QChip, QCardSeparator } from 'quasar-framework'
@ -103,32 +102,27 @@
switch (conversation.type) { switch (conversation.type) {
case 'call': case 'call':
return 'phone'; return 'phone';
break;
case 'callforward': case 'callforward':
return 'call_merge'; return 'call_merge';
break;
case 'voicemail': case 'voicemail':
return 'voicemail'; return 'voicemail';
break;
case 'fax': case 'fax':
return 'insert_drive_file'; return 'insert_drive_file';
break; case 'sms': case 'sms':
return 'txtsms'; return 'txtsms';
break; }
};
}, },
getSecondIcon() { getSecondIcon() {
let conversation = this.conversation; let conversation = this.conversation;
let directionIcon = conversation.direction == 'out' ? return conversation.direction == 'out' ? 'call_made' : 'call_received';
'call_made' : 'call_received';
return directionIcon;
}, },
getTitle() { getTitle() {
let conversation = this.conversation; let conversation = this.conversation;
let prefix; let prefix;
if (!conversation.status || ['ok', 'SUCCESS'].indexOf(conversation.status) > -1) { if (!conversation.status || ['ok', 'SUCCESS'].indexOf(conversation.status) > -1) {
prefix = this.$t('pages.conversations.labels.successful'); prefix = this.$t('pages.conversations.labels.successful');
} else { }
else {
prefix = this.$t('pages.conversations.labels.unsuccessful'); prefix = this.$t('pages.conversations.labels.unsuccessful');
} }
let direction = conversation.direction == 'in' ? let direction = conversation.direction == 'in' ?
@ -147,5 +141,5 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -27,7 +27,7 @@
this.$store.dispatch('conversations/loadConversations') this.$store.dispatch('conversations/loadConversations')
.then(() => { .then(() => {
done(); done();
}).catch((err) => { }).catch(() => {
done(); done();
this.$refs.infinite.stop(); this.$refs.infinite.stop();
}); });
@ -36,5 +36,5 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -32,10 +32,12 @@
if(_.isObject(this.currentStream) && _.isObject(this.$refs.media) && if(_.isObject(this.currentStream) && _.isObject(this.$refs.media) &&
!_.isUndefined(this.$refs.media.srcObject)) { !_.isUndefined(this.$refs.media.srcObject)) {
this.$refs.media.srcObject = this.currentStream; this.$refs.media.srcObject = this.currentStream;
} else if(_.isObject(this.currentStream) && _.isObject(this.$refs.media) && }
else if(_.isObject(this.currentStream) && _.isObject(this.$refs.media) &&
!_.isUndefined(this.$refs.media.mozSrcObject)) { !_.isUndefined(this.$refs.media.mozSrcObject)) {
this.$refs.media.mozSrcObject = this.currentStream; this.$refs.media.mozSrcObject = this.currentStream;
} else if(_.isObject(this.currentStream) && _.isObject(this.$refs.media) && }
else if(_.isObject(this.currentStream) && _.isObject(this.$refs.media) &&
_.isObject(URL) && _.isFunction(URL.createObjectURL)) { _.isObject(URL) && _.isFunction(URL.createObjectURL)) {
this.$refs.media.src = URL.createObjectURL(this.currentStream); this.$refs.media.src = URL.createObjectURL(this.currentStream);
} }
@ -67,7 +69,7 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
.csc-media { .csc-media {
position: relative; position: relative;
} }

@ -12,7 +12,7 @@
<script> <script>
import { QIcon, QFixedPosition, QFab, QFabAction, QTooltip } from 'quasar-framework' import { QIcon, QFixedPosition, QFab, QFabAction, QTooltip } from 'quasar-framework'
import { mapState, mapGetters } from 'vuex' import { mapGetters } from 'vuex'
export default { export default {
name: 'csc-page', name: 'csc-page',
@ -42,9 +42,9 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '../../src/themes/app.variables.styl'; @import '../themes/quasar.variables.styl';
@import '../../src/themes/quasar.variables.styl';
.page { .page {
position: relative; position: relative;
padding: 60px; padding: 60px;

@ -12,5 +12,5 @@
export default {} export default {}
</script> </script>
<style> <style rel="stylesheet/stylus">
</style> </style>

@ -36,7 +36,7 @@
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import { startLoading, stopLoading, showGlobalError } from '../helpers/ui' import { startLoading, stopLoading, showGlobalError } from '../helpers/ui'
import { QLayout, QCard, QCardTitle, QCardSeparator, QCardMain, QField, QInput, import { QLayout, QCard, QCardTitle, QCardSeparator, QCardMain, QField, QInput,
QCardActions, QBtn, QIcon, Loading, Alert, Platform } from 'quasar-framework' QCardActions, QBtn, QIcon, Platform } from 'quasar-framework'
export default { export default {
name: 'login', name: 'login',
@ -104,8 +104,9 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '../../src/themes/app.variables.styl'; @import '../themes/app.variables.styl';
#csc-login { #csc-login {
padding-top: 12%; padding-top: 12%;
} }

@ -8,7 +8,7 @@
</q-item-side> </q-item-side>
<q-item-main> <q-item-main>
<q-item-tile label> <q-item-tile label>
<slot name="title"> <slot name="title" />
</q-item-tile> </q-item-tile>
<q-item-tile sublabel> <q-item-tile sublabel>
{{ sublabel }} {{ sublabel }}
@ -72,9 +72,10 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '~variables' @import '../../themes/quasar.variables.styl'
.csc-card-collapsible
.csc-card-collapsible
.q-btn .q-btn
margin-bottom 5px margin-bottom 5px
ul ul
@ -93,8 +94,10 @@
font-weight 400 font-weight 400
div.q-item-sublabel div.q-item-sublabel
margin-top 5px margin-top 5px
.csc-card-left-icons
.csc-card-left-icons
margin-left 15px margin-left 15px
.csc-card-title
.csc-card-title
padding 16px padding 16px
</style> </style>

@ -19,7 +19,7 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
.csc-number-chip .number-ext { .csc-number-chip .number-ext {
font-weight: bold; font-weight: bold;
} }

@ -32,5 +32,5 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -110,8 +110,7 @@
<script> <script>
import _ from 'lodash'; import _ from 'lodash';
import { startLoading, stopLoading, showGlobalError, import { startLoading, stopLoading, showToast, enableIncomingCallNotifications} from '../../helpers/ui'
showToast, showGlobalWarning, enableIncomingCallNotifications} from '../../helpers/ui'
import { mapState, mapGetters } from 'vuex' import { mapState, mapGetters } from 'vuex'
import CscCall from '../CscCall' import CscCall from '../CscCall'
import { import {
@ -142,7 +141,8 @@
if(Platform.is.mobile) { if(Platform.is.mobile) {
this.$store.commit('layout/hideLeft'); this.$store.commit('layout/hideLeft');
this.$store.commit('layout/enableFullscreen'); this.$store.commit('layout/enableFullscreen');
} else { }
else {
this.$store.commit('layout/showLeft'); this.$store.commit('layout/showLeft');
} }
this.applyLayout(); this.applyLayout();
@ -216,14 +216,16 @@
layoutView() { layoutView() {
if(this.isFullscreenEnabled) { if(this.isFullscreenEnabled) {
return 'lHr LpR lFr'; return 'lHr LpR lFr';
} else { }
else {
return 'lHh LpR lFf'; return 'lHh LpR lFf';
} }
}, },
fabOffset() { fabOffset() {
if(Platform.is.mobile) { if(Platform.is.mobile) {
return [16, 17]; return [16, 17];
} else { }
else {
return [48, 17]; return [48, 17];
} }
}, },
@ -251,7 +253,8 @@
if(this.right) { if(this.right) {
this.$store.commit('layout/showRight'); this.$store.commit('layout/showRight');
this.$store.commit('layout/hideLeft'); this.$store.commit('layout/hideLeft');
} else { }
else {
this.$store.commit('layout/hideRight'); this.$store.commit('layout/hideRight');
} }
}, },
@ -262,13 +265,15 @@
if(this.right) { if(this.right) {
this.$refs.layout.showRight(); this.$refs.layout.showRight();
this.$refs.cscCall.focusNumberInput(); this.$refs.cscCall.focusNumberInput();
} else { }
else {
this.$refs.layout.hideRight(); this.$refs.layout.hideRight();
this.$refs.cscCall.blurNumberInput(); this.$refs.cscCall.blurNumberInput();
} }
if(this.left) { if(this.left) {
this.$refs.layout.showLeft(); this.$refs.layout.showLeft();
} else { }
else {
this.$refs.layout.hideLeft(); this.$refs.layout.hideLeft();
} }
} }
@ -278,7 +283,8 @@
if(value) { if(value) {
this.$refs.layout.showRight(); this.$refs.layout.showRight();
this.$refs.cscCall.focusNumberInput(); this.$refs.cscCall.focusNumberInput();
} else { }
else {
this.$refs.layout.hideRight(); this.$refs.layout.hideRight();
this.$refs.cscCall.blurNumberInput(); this.$refs.cscCall.blurNumberInput();
} }
@ -286,7 +292,8 @@
left(value) { left(value) {
if(value) { if(value) {
this.$refs.layout.showLeft(); this.$refs.layout.showLeft();
} else { }
else {
this.$refs.layout.hideLeft(); this.$refs.layout.hideLeft();
} }
}, },
@ -315,9 +322,8 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '../../../src/themes/app.variables.styl'; @import '../../themes/quasar.variables.styl';
@import '../../../src/themes/quasar.variables.styl';
#main-menu { #main-menu {
padding-top:60px; padding-top:60px;

@ -64,7 +64,7 @@
<script> <script>
import _ from 'lodash'; import _ from 'lodash';
import { startLoading, stopLoading, showGlobalError, showToast } from '../../../helpers/ui' import { showToast } from '../../../helpers/ui'
import CscPage from '../../CscPage' import CscPage from '../../CscPage'
import CscToggle from '../../form/CscToggle' import CscToggle from '../../form/CscToggle'
import { QInput, QCard, QBtn, QField, QIcon, QCardTitle, QCardActions, Dialog, QSpinnerMat, QToggle, import { QInput, QCard, QBtn, QField, QIcon, QCardTitle, QCardActions, Dialog, QSpinnerMat, QToggle,
@ -96,7 +96,7 @@
this.listLoading = true; this.listLoading = true;
this.$store.dispatch('callBlocking/load' + this.suffix).then(() => { this.$store.dispatch('callBlocking/load' + this.suffix).then(() => {
this.listLoading = false; this.listLoading = false;
}).catch((err) => { }).catch(() => {
this.listLoading = false; this.listLoading = false;
}); });
}, },
@ -133,14 +133,16 @@
var enabled = this.$store.state.callBlocking[this.pageName + 'Enabled']; var enabled = this.$store.state.callBlocking[this.pageName + 'Enabled'];
if(enabled) { if(enabled) {
return 'whitelist'; return 'whitelist';
} else { }
else {
return 'blacklist'; return 'blacklist';
} }
}, },
set(value) { set(value) {
if(value === 'blacklist') { if(value === 'blacklist') {
this.mode = false; this.mode = false;
} else { }
else {
this.mode = true; this.mode = true;
} }
} }
@ -148,14 +150,16 @@
toggleButtonLabel() { toggleButtonLabel() {
if(!this.enabled) { if(!this.enabled) {
return this.$i18n.t('pages.callBlocking' + this.suffix + '.toggleEnableLabel'); return this.$i18n.t('pages.callBlocking' + this.suffix + '.toggleEnableLabel');
} else { }
else {
return this.$i18n.t('pages.callBlocking' + this.suffix + '.toggleDisableLabel'); return this.$i18n.t('pages.callBlocking' + this.suffix + '.toggleDisableLabel');
} }
}, },
toggleToastMessage() { toggleToastMessage() {
if(this.mode) { if(this.mode) {
return this.$i18n.t('pages.callBlocking' + this.suffix + '.toggleEnabledToast'); return this.$i18n.t('pages.callBlocking' + this.suffix + '.toggleEnabledToast');
} else { }
else {
return this.$i18n.t('pages.callBlocking' + this.suffix + '.toggleDisabledToast'); return this.$i18n.t('pages.callBlocking' + this.suffix + '.toggleDisabledToast');
} }
}, },
@ -185,7 +189,7 @@
number:this.newNumber number:this.newNumber
})); }));
this.listLoading = false; this.listLoading = false;
}).catch((err)=>{ }).catch(()=>{
this.listLoading = false; this.listLoading = false;
this.addFormError = true; this.addFormError = true;
}); });
@ -205,10 +209,11 @@
number: this.editingNumber number: this.editingNumber
}).then(()=>{ }).then(()=>{
this.listLoading = false; this.listLoading = false;
}).catch((err)=>{ }).catch(()=>{
this.listLoading = false; this.listLoading = false;
}); });
} else { }
else {
this.listLoading = false; this.listLoading = false;
} }
}, },
@ -233,7 +238,7 @@
showToast(i18n.t('pages.callBlocking' + state.suffix + '.removedToast', { showToast(i18n.t('pages.callBlocking' + state.suffix + '.removedToast', {
number: state.numbers[index] number: state.numbers[index]
})); }));
}).catch((err)=>{ }).catch(()=>{
state.listLoading = false; state.listLoading = false;
}); });
} }
@ -252,7 +257,7 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
#toggle-call-blocking { #toggle-call-blocking {
margin-bottom: 60px; margin-bottom: 60px;
} }

@ -14,5 +14,5 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -14,5 +14,5 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -41,5 +41,5 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -28,5 +28,5 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -31,5 +31,5 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -79,5 +79,5 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -42,9 +42,7 @@
<script> <script>
import _ from 'lodash' import _ from 'lodash'
import { startLoading, stopLoading, import { startLoading } from '../../../helpers/ui'
showGlobalError, showToast } from '../../../helpers/ui'
import { normalizeTerminationInput } from '../../../filters/number-format'
import { mapGetters, mapState } from 'vuex' import { mapGetters, mapState } from 'vuex'
import { QItem, Toast, QBtn, QSelect, QPopover, QList, import { QItem, Toast, QBtn, QSelect, QPopover, QList,
QField, QInput, QSlider } from 'quasar-framework' QField, QInput, QSlider } from 'quasar-framework'
@ -126,9 +124,11 @@
this.$store.dispatch('callForward/setPriority', lastDestination.priority || 1); this.$store.dispatch('callForward/setPriority', lastDestination.priority || 1);
if (type === 'voicebox') { if (type === 'voicebox') {
this.destinationForm.destination = 'Voicemail'; this.destinationForm.destination = 'Voicemail';
} else if (type === 'fax2mail') { }
else if (type === 'fax2mail') {
this.destinationForm.destination = 'Fax2Mail'; this.destinationForm.destination = 'Fax2Mail';
} else { }
else {
this.destinationForm.destination = ''; this.destinationForm.destination = '';
} }
}, },
@ -152,9 +152,10 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '~variables' @import '../../../themes/quasar.variables.styl'
.add-destination-form
.add-destination-form
margin 0 15px margin 0 15px
.q-slider.label-always .q-slider.label-always
padding 15px 0 5px padding 15px 0 5px

@ -22,7 +22,6 @@
</template> </template>
<script> <script>
import numberFormat from '../../../filters/number-format'
import { mapState, mapGetters } from 'vuex' import { mapState, mapGetters } from 'vuex'
import { startLoading, stopLoading, import { startLoading, stopLoading,
showGlobalError, showToast } from '../../../helpers/ui' showGlobalError, showToast } from '../../../helpers/ui'
@ -68,13 +67,15 @@
reloadDestinations(timeset) { reloadDestinations(timeset) {
if (timeset === null) { if (timeset === null) {
this.$store.dispatch('callForward/loadAlwaysEverybodyDestinations'); this.$store.dispatch('callForward/loadAlwaysEverybodyDestinations');
} else if (timeset === 'Company Hours') { }
else if (timeset === 'Company Hours') {
this.$store.dispatch('callForward/loadCompanyHoursEverybodyDestinations'); this.$store.dispatch('callForward/loadCompanyHoursEverybodyDestinations');
} else if (timeset === 'After Hours') { }
else if (timeset === 'After Hours') {
this.$store.dispatch('callForward/loadAfterHoursEverybodyDestinations'); this.$store.dispatch('callForward/loadAfterHoursEverybodyDestinations');
}; }
}, },
reloadTimes(timeset) { reloadTimes() {
this.$store.dispatch('callForward/loadTimesetTimes', { this.$store.dispatch('callForward/loadTimesetTimes', {
timeset: this.timeset timeset: this.timeset
}); });
@ -84,10 +85,12 @@
removeDestinationState(state) { removeDestinationState(state) {
if (state === 'requesting') { if (state === 'requesting') {
startLoading(); startLoading();
} else if (state === 'failed') { }
else if (state === 'failed') {
stopLoading(); stopLoading();
showGlobalError(this.removeDestinationError); showGlobalError(this.removeDestinationError);
} else if (state === 'succeeded') { }
else if (state === 'succeeded') {
stopLoading(); stopLoading();
showToast(this.$t('pages.callForward.removeSuccessMessage', { showToast(this.$t('pages.callForward.removeSuccessMessage', {
destination: this.lastRemovedDestination destination: this.lastRemovedDestination
@ -98,10 +101,12 @@
addDestinationState(state) { addDestinationState(state) {
if (state === 'requesting') { if (state === 'requesting') {
startLoading(); startLoading();
} else if (state === 'failed') { }
else if (state === 'failed') {
stopLoading(); stopLoading();
showGlobalError(this.addDestinationError); showGlobalError(this.addDestinationError);
} else if (state === 'succeeded') { }
else if (state === 'succeeded') {
stopLoading(); stopLoading();
showToast(this.$t('pages.callForward.addDestinationSuccessMessage', { showToast(this.$t('pages.callForward.addDestinationSuccessMessage', {
destination: this.lastAddedDestination destination: this.lastAddedDestination
@ -112,10 +117,12 @@
changeDestinationState(state) { changeDestinationState(state) {
if (state === 'requesting') { if (state === 'requesting') {
startLoading(); startLoading();
} else if (state === 'failed') { }
else if (state === 'failed') {
stopLoading(); stopLoading();
showGlobalError(this.changeDestinationError); showGlobalError(this.changeDestinationError);
} else if (state === 'succeeded') { }
else if (state === 'succeeded') {
stopLoading(); stopLoading();
this.reloadDestinations(this.timeset); this.reloadDestinations(this.timeset);
} }
@ -123,14 +130,17 @@
removeTimeState(state) { removeTimeState(state) {
if (state === 'requesting') { if (state === 'requesting') {
startLoading(); startLoading();
} else if (state === 'failed') { }
else if (state === 'failed') {
stopLoading(); stopLoading();
showGlobalError(this.removeTimeError); showGlobalError(this.removeTimeError);
} else if (state === 'succeeded') { }
else if (state === 'succeeded') {
stopLoading(); stopLoading();
if (this.timesLength <= 1) { if (this.timesLength <= 1) {
showToast(this.$t('pages.callForward.times.removeTimesetSuccessMessage')); showToast(this.$t('pages.callForward.times.removeTimesetSuccessMessage'));
} else { }
else {
showToast(this.$t('pages.callForward.times.removeSuccessMessage', { showToast(this.$t('pages.callForward.times.removeSuccessMessage', {
day: this.lastRemovedDay day: this.lastRemovedDay
})); }));
@ -142,5 +152,5 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -96,7 +96,8 @@
} }
] ]
}); });
} else { }
else {
Dialog.create({ Dialog.create({
title: self.$t('pages.callForward.times.removeDialogTitle'), title: self.$t('pages.callForward.times.removeDialogTitle'),
message: self.$t('pages.callForward.times.removeDialogText', { message: self.$t('pages.callForward.times.removeDialogText', {
@ -122,5 +123,5 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -19,7 +19,6 @@
</template> </template>
<script> <script>
import numberFormat from '../../../filters/number-format'
import CscCallForwardTime from './CscCallForwardTime' import CscCallForwardTime from './CscCallForwardTime'
import { QCard, QCardTitle, QCardMain, QCardActions, import { QCard, QCardTitle, QCardMain, QCardActions,
QField, QBtn } from 'quasar-framework' QField, QBtn } from 'quasar-framework'
@ -51,13 +50,15 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '~variables' @import '../../../themes/quasar.variables.styl'
.times-title
.times-title
color $primary color $primary
padding-left 5px padding-left 5px
padding-bottom 8px padding-bottom 8px
.times-card
.times-card
padding 0 15px padding 0 15px
.q-field .q-field
margin 5px 0 margin 5px 0

@ -85,7 +85,8 @@
if (state === 'failed') { if (state === 'failed') {
stopLoading(); stopLoading();
showGlobalError(this.changeDestinationError); showGlobalError(this.changeDestinationError);
} else if (state === 'succeeded') { }
else if (state === 'succeeded') {
stopLoading(); stopLoading();
} }
} }
@ -112,9 +113,10 @@
let dest = destination.split(/:|@/); let dest = destination.split(/:|@/);
if (dest[2] === 'fax2mail.local') { if (dest[2] === 'fax2mail.local') {
return false; return false;
} else { }
else {
return !isNaN(dest[1]); return !isNaN(dest[1]);
}; }
}, },
deleteDestination(index) { deleteDestination(index) {
let clonedDestinations = _.cloneDeep(this.destinations); let clonedDestinations = _.cloneDeep(this.destinations);
@ -151,15 +153,19 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '~variables' @import '../../../themes/quasar.variables.styl'
.dest-row
.dest-row
.dest-values .dest-values
font-weight 500 font-weight 500
.dest-btns
.dest-btns
display inline-block display inline-block
.btnhidden
.btnhidden
opacity 0 opacity 0
.btnvisible
.btnvisible
opacity 1 opacity 1
</style> </style>

@ -30,7 +30,6 @@
import _ from 'lodash' import _ from 'lodash'
import CscDestination from './CscDestination' import CscDestination from './CscDestination'
import CscAddDestinationForm from './CscAddDestinationForm' import CscAddDestinationForm from './CscAddDestinationForm'
import { showToast } from '../../../helpers/ui'
import { QCardTitle, QCardMain, QCardSeparator, import { QCardTitle, QCardMain, QCardSeparator,
QItem, QList } from 'quasar-framework' QItem, QList } from 'quasar-framework'
export default { export default {
@ -73,9 +72,10 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '~variables' @import '../../../themes/quasar.variables.styl'
.dest-section
.dest-section
.dest-title .dest-title
padding 0 15px padding 0 15px
.dest-title:first-child .dest-title:first-child
@ -84,10 +84,13 @@
padding 0 15px padding 0 15px
.q-list .q-list
margin-bottom 0 margin-bottom 0
.dest-row
.dest-row
inline-block inline-block
.dest-title
.dest-title
color $primary color $primary
.dest-icon
.dest-icon
margin-right 5px margin-right 5px
</style> </style>

@ -1,6 +1,6 @@
<template> <template>
<csc-page :title="$t('pages.conversations.title')"> <csc-page :title="$t('pages.conversations.title')">
<csc-conversations :conversations="conversations"></csc-conversation> <csc-conversations :conversations="conversations" />
</csc-page> </csc-page>
</template> </template>
@ -24,8 +24,7 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '~variables' .q-infinite-scroll-message
.q-infinite-scroll-message
margin-bottom 50px margin-bottom 50px
</style> </style>

@ -128,14 +128,16 @@
call() { call() {
if(this.isCallAvailable) { if(this.isCallAvailable) {
this.$store.dispatch('call/showCall'); this.$store.dispatch('call/showCall');
} else { }
else {
showGlobalWarning(this.$i18n.t('pages.home.featureNotAvailable')); showGlobalWarning(this.$i18n.t('pages.home.featureNotAvailable'));
} }
}, },
screenShare() { screenShare() {
if(this.isCallAvailable && !this.isMobile) { if(this.isCallAvailable && !this.isMobile) {
this.$store.dispatch('call/showCall'); this.$store.dispatch('call/showCall');
} else { }
else {
showGlobalWarning(this.$i18n.t('pages.home.featureNotAvailable')); showGlobalWarning(this.$i18n.t('pages.home.featureNotAvailable'));
} }
}, },
@ -146,14 +148,17 @@
} }
</script> </script>
<style lang="stylus" scoped> <style lang="stylus" scoped rel="stylesheet/stylus">
@import '~variables' @import '../../themes/quasar.variables.styl'
.q-card-actions .q-card-actions
font-size 22px font-size 22px
padding 0 10px 35px 10px padding 0 10px 35px 10px
.q-card-main .q-card-main
font-size 22px font-size 22px
padding-top 35px padding-top 35px
.home-card-active .home-card-active
cursor pointer cursor pointer
border solid 2px $primary border solid 2px $primary
@ -162,6 +167,7 @@
color $primary color $primary
.q-card-actions .q-card-actions
color $primary color $primary
.home-card-inactive .home-card-inactive
cursor not-allowed cursor not-allowed
border solid 2px $grey border solid 2px $grey
@ -170,6 +176,7 @@
color $grey color $grey
.q-card-actions .q-card-actions
color $grey color $grey
@media (max-width: $breakpoint-sm) @media (max-width: $breakpoint-sm)
.q-card-actions .q-card-actions
font-size 16px font-size 16px

@ -111,7 +111,7 @@
aliasNumbers() { aliasNumbers() {
let numbers = []; let numbers = [];
if(_.isArray(this.group.alias_numbers)) { if(_.isArray(this.group.alias_numbers)) {
this.group.alias_numbers.forEach((number)=>{ this.group.alias_numbers.forEach((number) => {
numbers.push(number.number_id); numbers.push(number.number_id);
}); });
} }
@ -120,7 +120,7 @@
seats() { seats() {
let seats = []; let seats = [];
if(_.isArray(this.group.seats)) { if(_.isArray(this.group.seats)) {
this.group.seats.forEach((seat)=>{ this.group.seats.forEach((seat) => {
seats.push(seat.id); seats.push(seat.id);
}); });
} }
@ -151,7 +151,8 @@
titleIcon() { titleIcon() {
if(this.expanded) { if(this.expanded) {
return 'keyboard arrow down'; return 'keyboard arrow down';
} else { }
else {
return 'keyboard arrow up'; return 'keyboard arrow up';
} }
}, },
@ -163,7 +164,8 @@
toggleMain() { toggleMain() {
if(this.expanded) { if(this.expanded) {
this.expanded = false; this.expanded = false;
} else { }
else {
this.expanded = true; this.expanded = true;
} }
}, },
@ -174,7 +176,7 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
.csc-pbx-group { .csc-pbx-group {
position: relative; position: relative;
} }

@ -120,8 +120,8 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '../../../../src/themes/app.variables.styl'; @import '../../../themes/quasar.variables.styl';
.add-form { .add-form {
position: relative; position: relative;
} }

@ -137,7 +137,8 @@
titleIcon() { titleIcon() {
if(this.expanded) { if(this.expanded) {
return 'keyboard arrow down'; return 'keyboard arrow down';
} else { }
else {
return 'keyboard arrow up'; return 'keyboard arrow up';
} }
}, },
@ -150,7 +151,6 @@
this.expanded = !this.expanded this.expanded = !this.expanded
}, },
remove() { remove() {
var store = this.$store;
var state = this; var state = this;
var i18n = this.$i18n; var i18n = this.$i18n;
Dialog.create({ Dialog.create({
@ -173,7 +173,7 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
.csc-pbx-seat { .csc-pbx-seat {
position: relative; position: relative;
} }

@ -141,8 +141,9 @@
} }
</script> </script>
<style lang="stylus"> <style lang="stylus" rel="stylesheet/stylus">
@import '../../../../src/themes/app.variables.styl'; @import '../../../themes/quasar.variables.styl';
.csc-pbx-seat-add-form .q-card { .csc-pbx-seat-add-form .q-card {
position: relative; position: relative;
} }

@ -49,5 +49,5 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -14,5 +14,5 @@
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

@ -58,7 +58,7 @@
<script> <script>
import { startLoading, stopLoading, showGlobalError, showToast } from '../../../helpers/ui' import { showGlobalError } from '../../../helpers/ui'
import CscPage from '../../CscPage' import CscPage from '../../CscPage'
import CscPbxGroup from './CscPbxGroup' import CscPbxGroup from './CscPbxGroup'
import { import {
@ -82,7 +82,6 @@
QSpinnerMat, QSpinnerMat,
Dialog Dialog
} from 'quasar-framework' } from 'quasar-framework'
import { mapState } from 'vuex'
import numberFilter from '../../../filters/number' import numberFilter from '../../../filters/number'
export default { export default {
@ -165,7 +164,8 @@
type: this.$t('pbxConfig.group'), type: this.$t('pbxConfig.group'),
name: number.subscriber.display_name name: number.subscriber.display_name
}); });
} else if (number.subscriber !== null && number.subscriber.display_name !== null) { }
else if (number.subscriber !== null && number.subscriber.display_name !== null) {
owner = this.$t('pbxConfig.allocatedBy', { owner = this.$t('pbxConfig.allocatedBy', {
type: this.$t('pbxConfig.seat'), type: this.$t('pbxConfig.seat'),
name: number.subscriber.display_name name: number.subscriber.display_name
@ -258,7 +258,6 @@
}, },
removeGroup(group) { removeGroup(group) {
var store = this.$store; var store = this.$store;
var state = this;
var i18n = this.$i18n; var i18n = this.$i18n;
Dialog.create({ Dialog.create({
title: i18n.t('pbxConfig.removeGroupTitle'), title: i18n.t('pbxConfig.removeGroupTitle'),
@ -280,7 +279,7 @@
</script> </script>
<style lang="stylus"> <style lang="stylus">
@import '../../../../src/themes/app.variables.styl'; @import '../../../themes/quasar.variables.styl';
.add-form { .add-form {
position: relative; position: relative;
} }

@ -14,7 +14,7 @@
import { QChip, QCard, QCardSeparator, QCardTitle, QCardMain, import { QChip, QCard, QCardSeparator, QCardTitle, QCardMain,
QIcon, QPopover, QList, QItem, QItemMain } from 'quasar-framework' QIcon, QPopover, QList, QItem, QItemMain } from 'quasar-framework'
import aliasNumberOptions from '../../../mixins/alias-number-options' import aliasNumberOptions from '../../../mixins/alias-number-options'
import { startLoading, stopLoading, showGlobalError, showToast } from '../../../helpers/ui' import { showGlobalError } from '../../../helpers/ui'
export default { export default {
mixins: [aliasNumberOptions], mixins: [aliasNumberOptions],

@ -17,11 +17,6 @@
</template> </template>
<script> <script>
import {
startLoading,
stopLoading,
showGlobalError
} from '../../helpers/ui'
import CscPage from '../CscPage' import CscPage from '../CscPage'
import { import {
QField, QField,
@ -66,7 +61,8 @@ export default {
minutes: this.time.split(':')[1], minutes: this.time.split(':')[1],
seconds: '00' seconds: '00'
}); });
} else { }
else {
computedTime = date.buildDate({ computedTime = date.buildDate({
hours: '00', hours: '00',
minutes: '00', minutes: '00',
@ -118,8 +114,8 @@ export default {
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
.reminder-field { .reminder-field {
margin-bottom: 40px; margin-bottom: 40px;
} }
</style> </style>

@ -1,5 +1,6 @@
import { date } from 'quasar'
const { formatDate } = date import { date } from 'quasar-framework'
const { formatDate } = date;
export default function(value) { export default function(value) {
var timeStamp = new Date(value); var timeStamp = new Date(value);

@ -2,8 +2,7 @@
import _ from 'lodash'; import _ from 'lodash';
import url from 'url'; import url from 'url';
import { PhoneNumberUtil, PhoneNumberFormat } from 'google-libphonenumber'; import { PhoneNumberUtil, PhoneNumberFormat } from 'google-libphonenumber';
import { format } from 'quasar-framework'
const { capitalize } = format;
var phoneUtil = PhoneNumberUtil.getInstance(); var phoneUtil = PhoneNumberUtil.getInstance();
export default function numberFormat(number) { export default function numberFormat(number) {
@ -13,10 +12,12 @@ export default function numberFormat(number) {
let normalizedNumber = normalizeNumber(extractedNumber); let normalizedNumber = normalizeNumber(extractedNumber);
if(normalizedNumber !== extractedNumber) { if(normalizedNumber !== extractedNumber) {
return normalizedNumber; return normalizedNumber;
} else { }
else {
return extractedNumber; return extractedNumber;
} }
} catch(err) { }
catch(err) {
return normalizeNumber(number); return normalizeNumber(number);
} }
} }
@ -30,13 +31,16 @@ export function normalizeNumber(number) {
} }
try { try {
return phoneUtil.format(phoneUtil.parse(normalizedNumber, 'DE'), PhoneNumberFormat.INTERNATIONAL); return phoneUtil.format(phoneUtil.parse(normalizedNumber, 'DE'), PhoneNumberFormat.INTERNATIONAL);
} catch(err) { }
catch(err) {
return normalizedNumber; return normalizedNumber;
} }
} else { }
else {
return number; return number;
} }
} else { }
else {
return number; return number;
} }
} }
@ -57,20 +61,27 @@ export function normalizeDestination(destination) {
let isNumber = normalizedNumber !== authParts[0]; let isNumber = normalizedNumber !== authParts[0];
if (host === 'voicebox.local') { if (host === 'voicebox.local') {
return 'Voicemail'; return 'Voicemail';
} else if (host === 'fax2mail.local') { }
else if (host === 'fax2mail.local') {
return 'Fax2Mail'; return 'Fax2Mail';
} else if (host === 'managersecretary.local') { }
else if (host === 'managersecretary.local') {
return 'Manager Secretary'; return 'Manager Secretary';
} else if (authParts[0] === 'custom-hours') { }
else if (authParts[0] === 'custom-hours') {
return 'Custom Announcement'; return 'Custom Announcement';
} else if (host === 'app.local') { }
else if (host === 'app.local') {
return _.capitalize(authParts[0]); return _.capitalize(authParts[0]);
} else if (!isNumber) { }
else if (!isNumber) {
return _.capitalize(host.split('.')[0]); return _.capitalize(host.split('.')[0]);
} else { }
else {
return normalizedNumber; return normalizedNumber;
} }
} catch(err) { }
catch(err) {
return normalizeNumber(destination); return normalizeNumber(destination);
} }
} }
@ -78,9 +89,11 @@ export function normalizeDestination(destination) {
export function normalizeTerminationInput(destination) { export function normalizeTerminationInput(destination) {
if (destination === 'Voicemail') { if (destination === 'Voicemail') {
return 'voicebox'; return 'voicebox';
} else if (destination = 'Fax2Mail') { }
else if (destination === 'Fax2Mail') {
return 'fax2mail'; return 'fax2mail';
} else { }
else {
return destination; return destination;
} }
} }

@ -8,12 +8,14 @@ export default function(number, extension) {
let finalNumber; let finalNumber;
if(_.isString(normalizedNumber)) { if(_.isString(normalizedNumber)) {
finalNumber = normalizedNumber; finalNumber = normalizedNumber;
} else { }
else {
finalNumber = constructedNumber; finalNumber = constructedNumber;
} }
if(extension) { if(extension) {
return finalNumber.replace(new RegExp(extension + '$'), ''); return finalNumber.replace(new RegExp(extension + '$'), '');
} else { }
else {
return finalNumber; return finalNumber;
} }

@ -16,11 +16,13 @@ export function loadCdkLib() {
}, function(err, script){ }, function(err, script){
if(err) { if(err) {
reject(err); reject(err);
} else { }
else {
resolve(script); resolve(script);
} }
}); });
} else { }
else {
resolve(); resolve();
} }
}); });

@ -1,4 +1,5 @@
import _ from 'lodash'
import { Loading, Alert, Toast } from 'quasar-framework' import { Loading, Alert, Toast } from 'quasar-framework'
import { i18n } from '../i18n'; import { i18n } from '../i18n';
@ -33,7 +34,7 @@ export function showGlobalWarning(message) {
} }
export function showPermanentGlobalWarning(message) { export function showPermanentGlobalWarning(message) {
const alert = Alert.create({ Alert.create({
html: message, html: message,
position: 'top-center', position: 'top-center',
enter: 'bounceIn', enter: 'bounceIn',
@ -62,7 +63,8 @@ export function askForNotificationPermission() {
}).catch((err)=>{ }).catch((err)=>{
reject(err); reject(err);
}); });
} else { }
else {
showPermanentGlobalWarning(i18n.t('call.notificationNotSupported')); showPermanentGlobalWarning(i18n.t('call.notificationNotSupported'));
resolve(); resolve();
} }
@ -71,11 +73,12 @@ export function askForNotificationPermission() {
var serviceWorkerPath = '/csc/statics/service-worker.js'; var serviceWorkerPath = '/csc/statics/service-worker.js';
export function enableIncomingCallNotifications() { export function enableIncomingCallNotifications() {
return new Promise((resolve, reject)=>{ return new Promise((resolve)=>{
Promise.resolve().then(()=>{ Promise.resolve().then(()=>{
if(navigator.serviceWorker) { if(navigator.serviceWorker) {
return navigator.serviceWorker.register(serviceWorkerPath); return navigator.serviceWorker.register(serviceWorkerPath);
} else { }
else {
showPermanentGlobalWarning(i18n.t('call.notificationNotSupported')); showPermanentGlobalWarning(i18n.t('call.notificationNotSupported'));
resolve(); resolve();
} }

@ -1,11 +1,12 @@
import Vue from 'vue' import Vue from 'vue'
import VueI18n from 'vue-i18n' import VueI18n from 'vue-i18n'
import localeEn from './locales/en'
Vue.use(VueI18n); Vue.use(VueI18n);
export const locales = { export const locales = {
en: require('./locales/en') en: localeEn
}; };
export const i18n = new VueI18n({ export const i18n = new VueI18n({

@ -1,40 +1,27 @@
// === DEFAULT / CUSTOM STYLE ===
// WARNING! always comment out ONE of the two require() calls below.
// 1. use next line to activate CUSTOM STYLE (./src/themes)
require(`./themes/app.${__THEME}.styl`)
// 2. or, use next line to activate DEFAULT QUASAR STYLE
// require(`quasar/dist/quasar.${__THEME}.css`)
// ==============================
// Uncomment the following lines if you need IE11/Edge support import './themes/app.mat.styl'
// require(`quasar/dist/quasar.ie`) import 'quasar-extras/roboto-font';
// require(`quasar/dist/quasar.ie.${__THEME}.css`) import 'quasar-extras/material-icons'
import 'quasar-extras/fontawesome'
import 'quasar-extras/animate'
import _ from 'lodash' import _ from 'lodash'
import Vue from 'vue' import Vue from 'vue'
import VueResource from 'vue-resource' import VueResource from 'vue-resource'
import Quasar from 'quasar-framework' import Quasar from 'quasar-framework'
import { store } from './store' import { store } from './store'
import { i18n, locales } from './i18n' import { i18n } from './i18n'
import router from './router' import router from './router'
import { sync } from 'vuex-router-sync' import { sync } from 'vuex-router-sync'
import { RtcEngineCall } from './plugins/call' import { RtcEngineCall } from './plugins/call'
import filter from './filters' import App from './App.vue'
import './filters'
Vue.use(VueResource);
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.use(Quasar); // Install Quasar Framework Vue.use(Quasar);
Vue.use(VueResource);
Vue.use(RtcEngineCall); Vue.use(RtcEngineCall);
if (__THEME === 'mat') {
require('quasar-extras/roboto-font')
}
import 'quasar-extras/material-icons'
import 'quasar-extras/fontawesome'
import 'quasar-extras/animate'
sync(store, router); sync(store, router);
Vue.http.interceptors.push(function(request, next) { Vue.http.interceptors.push(function(request, next) {
@ -54,6 +41,6 @@ Quasar.start(() => {
i18n, i18n,
store, store,
router, router,
render: h => h(require('./App.vue').default) render: h => h(App)
}) })
}); });

@ -17,7 +17,8 @@ export default {
type: this.$t('pbxConfig.group'), type: this.$t('pbxConfig.group'),
name: number.subscriber.display_name name: number.subscriber.display_name
}); });
} else if (number.subscriber !== null && number.subscriber.display_name !== null) { }
else if (number.subscriber !== null && number.subscriber.display_name !== null) {
owner = this.$t('pbxConfig.allocatedBy', { owner = this.$t('pbxConfig.allocatedBy', {
type: this.$t('pbxConfig.seat'), type: this.$t('pbxConfig.seat'),
name: number.subscriber.display_name name: number.subscriber.display_name

@ -40,7 +40,7 @@ export class CallAlreadyExists {
var rtcEngineCallInstance = null; var rtcEngineCallInstance = null;
export class RtcEngineCall { export class RtcEngineCall {
constructor(options) { constructor() {
this.networkTag = 'sip'; this.networkTag = 'sip';
this.network = null; this.network = null;
this.loadedLibrary = null; this.loadedLibrary = null;
@ -123,14 +123,16 @@ export class RtcEngineCall {
if (hasVideo && _.isObject(sources.defaultVideo)) { if (hasVideo && _.isObject(sources.defaultVideo)) {
sources.defaultVideo.setQuality(cdk.MediaSourceQuality.HD); sources.defaultVideo.setQuality(cdk.MediaSourceQuality.HD);
this.localMedia.setVideo(sources.defaultVideo); this.localMedia.setVideo(sources.defaultVideo);
} else if (hasScreen && _.isObject(sources.desktopSharing)) { }
else if (hasScreen && _.isObject(sources.desktopSharing)) {
sources.desktopSharing.setQuality(cdk.MediaSourceQuality.HD); sources.desktopSharing.setQuality(cdk.MediaSourceQuality.HD);
this.localMedia.setVideo(sources.desktopSharing); this.localMedia.setVideo(sources.desktopSharing);
} }
this.localMedia.build((err)=>{ this.localMedia.build((err)=>{
if(_.isObject(err)) { if(_.isObject(err)) {
reject(err); reject(err);
} else { }
else {
resolve(this.localMedia); resolve(this.localMedia);
} }
}); });
@ -160,9 +162,11 @@ export class RtcEngineCall {
}).onRingingStop(()=>{ }).onRingingStop(()=>{
this.events.emit('ringingStop'); this.events.emit('ringingStop');
}); });
} else if(this.network !== null) { }
else if(this.network !== null) {
throw new CallAlreadyExists(); throw new CallAlreadyExists();
} else { }
else {
throw new NetworkNotConnected(this.networkTag); throw new NetworkNotConnected(this.networkTag);
} }
} }
@ -170,9 +174,11 @@ export class RtcEngineCall {
getNumber() { getNumber() {
if(this.localCall !== null) { if(this.localCall !== null) {
return this.localCall.peer; return this.localCall.peer;
} else if(this.remoteCall !== null) { }
else if(this.remoteCall !== null) {
return this.remoteCall.peer; return this.remoteCall.peer;
} else { }
else {
return null; return null;
} }
} }
@ -184,9 +190,11 @@ export class RtcEngineCall {
fetchEndedReason() { fetchEndedReason() {
if(this.localCall !== null) { if(this.localCall !== null) {
return this.localCall.endedReason; return this.localCall.endedReason;
} else if(this.remoteCall !== null) { }
else if(this.remoteCall !== null) {
return this.remoteCall.endedReason; return this.remoteCall.endedReason;
} else { }
else {
return null; return null;
} }
} }
@ -236,7 +244,8 @@ export class RtcEngineCall {
this.remoteCall.accept({ this.remoteCall.accept({
localMediaStream: localMediaStream localMediaStream: localMediaStream
}); });
} else { }
else {
throw new Error('Remote call does not exist'); throw new Error('Remote call does not exist');
} }
} }
@ -264,7 +273,8 @@ export class RtcEngineCall {
disableAudio() { disableAudio() {
if(this.localCall !== null) { if(this.localCall !== null) {
this.localCall.disableAudio(); this.localCall.disableAudio();
} else if (this.remoteCall !== null) { }
else if (this.remoteCall !== null) {
this.remoteCall.disableAudio(); this.remoteCall.disableAudio();
} }
} }
@ -272,7 +282,8 @@ export class RtcEngineCall {
enableAudio() { enableAudio() {
if(this.localCall !== null) { if(this.localCall !== null) {
this.localCall.enableAudio(); this.localCall.enableAudio();
} else if (this.remoteCall !== null) { }
else if (this.remoteCall !== null) {
this.remoteCall.enableAudio(); this.remoteCall.enableAudio();
} }
} }
@ -280,7 +291,8 @@ export class RtcEngineCall {
disableVideo() { disableVideo() {
if(this.localCall !== null) { if(this.localCall !== null) {
this.localCall.disableVideo(); this.localCall.disableVideo();
} else if (this.remoteCall !== null) { }
else if (this.remoteCall !== null) {
this.remoteCall.disableVideo(); this.remoteCall.disableVideo();
} }
} }
@ -288,7 +300,8 @@ export class RtcEngineCall {
enableVideo() { enableVideo() {
if(this.localCall !== null) { if(this.localCall !== null) {
this.localCall.enableVideo(); this.localCall.enableVideo();
} else if (this.remoteCall !== null) { }
else if (this.remoteCall !== null) {
this.remoteCall.enableVideo(); this.remoteCall.enableVideo();
} }
} }
@ -296,9 +309,11 @@ export class RtcEngineCall {
getCall() { getCall() {
if(this.localCall !== null) { if(this.localCall !== null) {
return this.localCall; return this.localCall;
} else if (this.remoteCall !== null) { }
else if (this.remoteCall !== null) {
return this.remoteCall; return this.remoteCall;
} else { }
else {
return null; return null;
} }
} }
@ -318,7 +333,7 @@ export class RtcEngineCall {
return rtcEngineCallInstance; return rtcEngineCallInstance;
} }
static install(Vue, options) { static install(Vue) {
Vue.call = RtcEngineCall.getInstance(); Vue.call = RtcEngineCall.getInstance();
} }
} }

@ -7,17 +7,6 @@ import routes from './routes'
Vue.use(VueRouter); Vue.use(VueRouter);
var router = new VueRouter({ var router = new VueRouter({
/*
* NOTE! VueRouter "history" mode DOESN'T works for Cordova builds,
* it is only to be used only for websites.
*
* If you decide to go with "history" mode, please also open /config/index.js
* and set "build.publicPath" to something other than an empty string.
* Example: '/' instead of current ''
*
* If switching back to default "hash" mode, don't forget to set the
* build publicPath back to '' so Cordova builds work again.
*/
routes: routes routes: routes
}); });
@ -26,11 +15,13 @@ router.beforeEach((to, from, next) => {
next({ next({
path: '/login' path: '/login'
}); });
} else if (store.getters['user/isLogged'] && to.path === '/login') { }
else if (store.getters['user/isLogged'] && to.path === '/login') {
next({ next({
path: '/' path: '/'
}); });
} else { }
else {
next(); next();
} }
}); });

@ -1,61 +1,78 @@
import DefaultLayout from './components/layouts/Default'
import Home from './components/pages/Home'
import Conversations from './components/pages/Conversations'
import CallForwardAlways from './components/pages/CallForward/Always'
import CallForwardCompanyHours from './components/pages/CallForward/CompanyHours'
import CallForwardAfterHours from './components/pages/CallForward/AfterHours'
import CallBlockingIncoming from './components/pages/CallBlocking/Incoming'
import CallBlockingOutgoing from './components/pages/CallBlocking/Outgoing'
import CallBlockingPrivacy from './components/pages/CallBlocking/Privacy'
import Reminder from './components/pages/Reminder';
import PbxConfigurationGroups from './components/pages/PbxConfiguration/Groups'
import PbxConfigurationSeats from './components/pages/PbxConfiguration/Seats'
import PbxConfigurationDevices from './components/pages/PbxConfiguration/Devices'
import Login from './components/Login'
import Error404 from './components/Error404'
export default [ export default [
{ {
path: '/user', path: '/user',
component: require('./components/layouts/Default').default, component: DefaultLayout,
children: [ children: [
{ {
path: 'home', path: 'home',
component: require('./components/pages/Home').default, component: Home,
}, },
{ {
path: 'conversations', path: 'conversations',
component: require('./components/pages/Conversations').default, component: Conversations,
}, },
{ {
path: 'call-forward/always', path: 'call-forward/always',
component: require('./components/pages/CallForward/Always').default, component: CallForwardAlways,
}, },
{ {
path: 'call-forward/company-hours', path: 'call-forward/company-hours',
component: require('./components/pages/CallForward/CompanyHours').default component: CallForwardCompanyHours
}, },
{ {
path: 'call-forward/after-hours', path: 'call-forward/after-hours',
component: require('./components/pages/CallForward/AfterHours').default component: CallForwardAfterHours
}, },
{ {
path: 'call-blocking/incoming', path: 'call-blocking/incoming',
component: require('./components/pages/CallBlocking/Incoming').default component: CallBlockingIncoming
}, },
{ {
path: 'call-blocking/outgoing', path: 'call-blocking/outgoing',
component: require('./components/pages/CallBlocking/Outgoing').default component: CallBlockingOutgoing
}, },
{ {
path: 'call-blocking/privacy', path: 'call-blocking/privacy',
component: require('./components/pages/CallBlocking/Privacy').default component: CallBlockingPrivacy
}, },
{ {
path: 'reminder', path: 'reminder',
component: require('./components/pages/Reminder').default}, component: Reminder
},
{ {
path: 'pbx-configuration/groups', path: 'pbx-configuration/groups',
component: require('./components/pages/PbxConfiguration/Groups').default component: PbxConfigurationGroups
}, },
{ {
path: 'pbx-configuration/seats', path: 'pbx-configuration/seats',
component: require('./components/pages/PbxConfiguration/Seats').default component: PbxConfigurationSeats
}, },
{ {
path: 'pbx-configuration/devices', path: 'pbx-configuration/devices',
component: require('./components/pages/PbxConfiguration/Devices').default component: PbxConfigurationDevices
} }
] ]
}, },
{ {
path: '/login', path: '/login',
component: require('./components/Login').default component: Login
}, },
{ {
path: '/', path: '/',
@ -63,6 +80,6 @@ export default [
}, },
{ {
path: '*', path: '*',
component: require('./components/Error404').default component: Error404
} }
] ]

@ -69,7 +69,8 @@ export default {
}).catch((err)=>{ }).catch((err)=>{
reject(err); reject(err);
}); });
} else { }
else {
disableIncomingCallBlocking(localStorage.getItem('subscriberId')).then(()=>{ disableIncomingCallBlocking(localStorage.getItem('subscriberId')).then(()=>{
context.commit('disableIncoming'); context.commit('disableIncoming');
resolve(); resolve();
@ -131,7 +132,8 @@ export default {
}).catch((err)=>{ }).catch((err)=>{
reject(err); reject(err);
}); });
} else { }
else {
disableOutgoingCallBlocking(localStorage.getItem('subscriberId')).then(()=>{ disableOutgoingCallBlocking(localStorage.getItem('subscriberId')).then(()=>{
context.commit('disableOutgoing'); context.commit('disableOutgoing');
resolve(); resolve();
@ -193,7 +195,8 @@ export default {
}).catch((err)=>{ }).catch((err)=>{
reject(err); reject(err);
}); });
} else { }
else {
disablePrivacyCallBlocking(localStorage.getItem('subscriberId')).then(()=>{ disablePrivacyCallBlocking(localStorage.getItem('subscriberId')).then(()=>{
context.commit('disablePrivacy'); context.commit('disablePrivacy');
resolve(); resolve();

@ -247,7 +247,7 @@ export default {
}); });
}, },
loadAlwaysEverybodyDestinations(context) { loadAlwaysEverybodyDestinations(context) {
return new Promise((resolve, reject)=>{ return new Promise(()=>{
loadEverybodyDestinations({ loadEverybodyDestinations({
subscriberId: localStorage.getItem('subscriberId'), subscriberId: localStorage.getItem('subscriberId'),
timeset: null timeset: null
@ -257,7 +257,7 @@ export default {
}); });
}, },
loadCompanyHoursEverybodyDestinations(context) { loadCompanyHoursEverybodyDestinations(context) {
return new Promise((resolve, reject)=>{ return new Promise(()=>{
loadEverybodyDestinations({ loadEverybodyDestinations({
subscriberId: localStorage.getItem('subscriberId'), subscriberId: localStorage.getItem('subscriberId'),
timeset: 'Company Hours' timeset: 'Company Hours'
@ -267,7 +267,7 @@ export default {
}); });
}, },
loadAfterHoursEverybodyDestinations(context) { loadAfterHoursEverybodyDestinations(context) {
return new Promise((resolve, reject)=>{ return new Promise(()=>{
loadEverybodyDestinations({ loadEverybodyDestinations({
subscriberId: localStorage.getItem('subscriberId'), subscriberId: localStorage.getItem('subscriberId'),
timeset: 'After Hours' timeset: 'After Hours'
@ -279,7 +279,7 @@ export default {
deleteDestinationFromDestinationset(context, options) { deleteDestinationFromDestinationset(context, options) {
let removedDestination = options.removeDestination; let removedDestination = options.removeDestination;
context.commit('removeDestinationRequesting'); context.commit('removeDestinationRequesting');
return new Promise((resolve, reject) => { return new Promise(() => {
deleteDestinationFromDestinationset(options) deleteDestinationFromDestinationset(options)
.then(() => { .then(() => {
context.commit('setLastRemovedDestination', removedDestination); context.commit('setLastRemovedDestination', removedDestination);
@ -307,15 +307,16 @@ export default {
if (options.timeset === 'Company Hours' || if (options.timeset === 'Company Hours' ||
options.timeset === 'After Hours') { options.timeset === 'After Hours') {
timeset = context.getters.getTimesetId; timeset = context.getters.getTimesetId;
}; }
context.commit('addDestinationRequesting'); context.commit('addDestinationRequesting');
if (type !== 'number') { if (type !== 'number') {
delete form.timeout; delete form.timeout;
form.destination = type; form.destination = type;
} else { }
else {
form.timeout = options.form.timeout; form.timeout = options.form.timeout;
form.destination = options.form.destination; form.destination = options.form.destination;
}; }
updatedOptions = { updatedOptions = {
subscriberId: context.getters.getSubscriberId, subscriberId: context.getters.getSubscriberId,
data: form, data: form,
@ -324,7 +325,7 @@ export default {
timesetId: timeset timesetId: timeset
}; };
if (options.destinations) { if (options.destinations) {
return new Promise((resolve, reject) => { return new Promise(() => {
addDestinationToExistingGroup(updatedOptions).then(() => { addDestinationToExistingGroup(updatedOptions).then(() => {
context.commit('setLastAddedDestination', options.form.destination); context.commit('setLastAddedDestination', options.form.destination);
context.commit('addDestinationSucceeded'); context.commit('addDestinationSucceeded');
@ -332,9 +333,10 @@ export default {
context.commit('addDestinationFailed', err.message); context.commit('addDestinationFailed', err.message);
}); });
}); });
} else { }
return new Promise((resolve, reject) => { else {
addDestinationToEmptyGroup(updatedOptions).then((result) => { return new Promise(() => {
addDestinationToEmptyGroup(updatedOptions).then(() => {
context.commit('setLastAddedDestination', options.form.destination); context.commit('setLastAddedDestination', options.form.destination);
context.commit('addDestinationSucceeded'); context.commit('addDestinationSucceeded');
}).catch((err) => { }).catch((err) => {
@ -350,7 +352,7 @@ export default {
0 : clonedDestinations.length - 1; 0 : clonedDestinations.length - 1;
context.commit('changeDestinationRequesting'); context.commit('changeDestinationRequesting');
if (options.direction === 'up' && options.prevId && options.index === 0) { if (options.direction === 'up' && options.prevId && options.index === 0) {
return new Promise((resolve, reject) => { return new Promise(() => {
moveDestinationUp({ moveDestinationUp({
prevId: options.prevId, prevId: options.prevId,
id: options.id, id: options.id,
@ -361,8 +363,9 @@ export default {
context.commit('changeDestinationFailed', err.message); context.commit('changeDestinationFailed', err.message);
}); });
}); });
} else if (options.direction === 'down' && options.nextId && options.index === lastIndex) { }
return new Promise((resolve, reject) => { else if (options.direction === 'down' && options.nextId && options.index === lastIndex) {
return new Promise(() => {
moveDestinationDown({ moveDestinationDown({
nextId: options.nextId, nextId: options.nextId,
id: options.id, id: options.id,
@ -373,7 +376,8 @@ export default {
context.commit('changeDestinationFailed', err.message); context.commit('changeDestinationFailed', err.message);
}); });
}); });
} else { }
else {
let adjacentDestination = options.direction === 'up' ? let adjacentDestination = options.direction === 'up' ?
options.destinations[options.index-1] : options.destinations[options.index-1] :
options.destinations[options.index+1]; options.destinations[options.index+1];
@ -385,7 +389,7 @@ export default {
clonedDestinations.splice(options.index, 1); clonedDestinations.splice(options.index, 1);
clonedDestinations.splice(adjacentIndex, 0, clonedDestination); clonedDestinations.splice(adjacentIndex, 0, clonedDestination);
clonedDestinations[adjacentIndex].priority = adjacentPriority; clonedDestinations[adjacentIndex].priority = adjacentPriority;
return new Promise((resolve, reject) => { return new Promise(() => {
changePositionOfDestination({ changePositionOfDestination({
destinations: clonedDestinations, destinations: clonedDestinations,
id: options.id, id: options.id,
@ -437,7 +441,7 @@ export default {
delete time.from; delete time.from;
delete time.to; delete time.to;
}); });
return new Promise((resolve, reject) => { return new Promise(() => {
deleteTimeFromTimeset({ deleteTimeFromTimeset({
subscriberId: context.getters.getSubscriberId, subscriberId: context.getters.getSubscriberId,
timesetId: context.getters.getTimesetId, timesetId: context.getters.getTimesetId,
@ -450,9 +454,9 @@ export default {
}); });
}); });
}, },
deleteTimesetById(context, options) { deleteTimesetById(context) {
context.commit('removeTimeRequesting'); context.commit('removeTimeRequesting');
return new Promise((resolve, reject) => { return new Promise(() => {
deleteTimesetById(context.getters.getTimesetId).then(() => { deleteTimesetById(context.getters.getTimesetId).then(() => {
context.commit('removeTimeSucceeded'); context.commit('removeTimeSucceeded');
}).catch((err) => { }).catch((err) => {

@ -1,5 +1,6 @@
'use strict'; 'use strict';
import _ from 'lodash';
import Vue from 'vue'; import Vue from 'vue';
export var CallState = { export var CallState = {
@ -36,64 +37,68 @@ export default {
desktopSharingInstall: false desktopSharingInstall: false
}, },
getters: { getters: {
getNumber(state, getters) { getNumber(state) {
return state.number; return state.number;
}, },
localMediaType(state) { localMediaType(state) {
if(state.localMediaStream !== null && state.localMediaStream.hasAudio() && state.localMediaStream.hasVideo()) { if(state.localMediaStream !== null && state.localMediaStream.hasAudio() && state.localMediaStream.hasVideo()) {
return MediaType.audioVideo; return MediaType.audioVideo;
} else if (state.localMediaStream !== null && state.localMediaStream.hasAudio()) { }
else if (state.localMediaStream !== null && state.localMediaStream.hasAudio()) {
return MediaType.audioOnly; return MediaType.audioOnly;
} else { }
else {
return null; return null;
} }
}, },
remoteMediaType(state) { remoteMediaType(state) {
if(state.remoteMediaStream !== null && state.remoteMediaStream.hasAudio() && state.remoteMediaStream.hasVideo()) { if(state.remoteMediaStream !== null && state.remoteMediaStream.hasAudio() && state.remoteMediaStream.hasVideo()) {
return MediaType.audioVideo; return MediaType.audioVideo;
} else if (state.remoteMediaStream !== null && state.remoteMediaStream.hasAudio()) { }
else if (state.remoteMediaStream !== null && state.remoteMediaStream.hasAudio()) {
return MediaType.audioOnly; return MediaType.audioOnly;
} else { }
else {
return null; return null;
} }
}, },
getEndedReason(state, getters) { getEndedReason(state) {
return state.endedReason; return state.endedReason;
}, },
isNetworkConnected(state, getters) { isNetworkConnected(state) {
return state.initialized; return state.initialized;
}, },
isCallAvailable(state, getters) { isCallAvailable(state, getters) {
return getters.isNetworkConnected; return getters.isNetworkConnected;
}, },
hasCallInitFailure(state, getters) { hasCallInitFailure(state) {
return state.initError !== null && state.disabled === false; return state.initError !== null && state.disabled === false;
}, },
isPreparing(state, getters) { isPreparing(state) {
return state.callState === CallState.input; return state.callState === CallState.input;
}, },
isInitiating(state, getters) { isInitiating(state) {
return state.callState === CallState.initiating; return state.callState === CallState.initiating;
}, },
isIncoming(state, getters) { isIncoming(state) {
return state.callState === CallState.incoming; return state.callState === CallState.incoming;
}, },
isTrying(state, getters) { isTrying(state) {
return state.callState === CallState.initiating || return state.callState === CallState.initiating ||
state.callState === CallState.ringing; state.callState === CallState.ringing;
}, },
isRinging(state, getters) { isRinging(state) {
return state.callState === CallState.ringing; return state.callState === CallState.ringing;
}, },
isCalling(state, getters) { isCalling(state) {
return state.callState === CallState.initiating || return state.callState === CallState.initiating ||
state.callState === CallState.ringing || state.callState === CallState.ringing ||
state.callState === CallState.established; state.callState === CallState.established;
}, },
isEstablished(state, getters) { isEstablished(state) {
return state.callState === CallState.established; return state.callState === CallState.established;
}, },
isEnded(state, getters) { isEnded(state) {
return state.callState === CallState.ended; return state.callState === CallState.ended;
}, },
hasRtcEngineCapability(state, getters, rootState, rootGetters) { hasRtcEngineCapability(state, getters, rootState, rootGetters) {
@ -102,22 +107,22 @@ export default {
hasRtcEngineCapabilityEnabled(state, getters, rootState, rootGetters) { hasRtcEngineCapabilityEnabled(state, getters, rootState, rootGetters) {
return rootGetters['user/hasRtcEngineCapabilityEnabled']; return rootGetters['user/hasRtcEngineCapabilityEnabled'];
}, },
hasRemoteVideo(state, getters) { hasRemoteVideo(state) {
return state.remoteMediaStream !== null && state.remoteMediaStream.hasVideo(); return state.remoteMediaStream !== null && state.remoteMediaStream.hasVideo();
}, },
hasLocalVideo(state, getters) { hasLocalVideo(state) {
return state.localMediaStream !== null && state.localMediaStream.hasVideo(); return state.localMediaStream !== null && state.localMediaStream.hasVideo();
}, },
hasVideo(state, getters) { hasVideo(state, getters) {
return getters.hasLocalVideo || getters.hasRemoteVideo; return getters.hasLocalVideo || getters.hasRemoteVideo;
}, },
isAudioEnabled(state, getters) { isAudioEnabled(state) {
return state.audioEnabled; return state.audioEnabled;
}, },
isVideoEnabled(state, getters) { isVideoEnabled(state) {
return state.videoEnabled; return state.videoEnabled;
}, },
isMuted(state, getters) { isMuted(state) {
return state.muted; return state.muted;
}, },
isCaller(state) { isCaller(state) {
@ -245,7 +250,8 @@ export default {
context.commit('initFailed', err); context.commit('initFailed', err);
reject(err); reject(err);
}); });
} else { }
else {
context.commit('disable'); context.commit('disable');
resolve(); resolve();
} }
@ -269,7 +275,8 @@ export default {
if(err.message === 'plugin not detected') { if(err.message === 'plugin not detected') {
context.commit('desktopSharingInstall'); context.commit('desktopSharingInstall');
context.commit('endCall', 'missingDesktopSharingExtension'); context.commit('endCall', 'missingDesktopSharingExtension');
} else { }
else {
context.commit('endCall', err.name); context.commit('endCall', err.name);
} }
}); });
@ -284,7 +291,8 @@ export default {
if(err.message === 'plugin not detected') { if(err.message === 'plugin not detected') {
context.commit('desktopSharingInstall'); context.commit('desktopSharingInstall');
context.commit('endCall', 'missingDesktopSharingExtension'); context.commit('endCall', 'missingDesktopSharingExtension');
} else { }
else {
context.commit('endCall', err.name); context.commit('endCall', err.name);
} }
}); });
@ -312,7 +320,7 @@ export default {
showCall(context) { showCall(context) {
context.commit('layout/showRight', null, { root: true }); context.commit('layout/showRight', null, { root: true });
}, },
hideCall() { hideCall(context) {
context.commit('layout/hideRight', null, { root: true }); context.commit('layout/hideRight', null, { root: true });
} }
} }

@ -1,7 +1,5 @@
'use strict';
'use strict'
import _ from 'lodash'
import { getConversations, downloadVoiceMail } from '../api/conversations' import { getConversations, downloadVoiceMail } from '../api/conversations'
export default { export default {

@ -2,7 +2,6 @@
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
import CallBlockingModule from './call-blocking' import CallBlockingModule from './call-blocking'
import CallForwardModule from './call-forward' import CallForwardModule from './call-forward'
import CallModule from './call' import CallModule from './call'

@ -37,11 +37,7 @@ export default {
state.sides.left = false; state.sides.left = false;
}, },
toggleFullscreen(state) { toggleFullscreen(state) {
if(state.fullscreenEnabled) { state.fullscreenEnabled = !state.fullscreenEnabled;
state.fullscreenEnabled = false;
} else {
state.fullscreenEnabled = true;
}
}, },
enableFullscreen(state) { enableFullscreen(state) {
state.fullscreenEnabled = true; state.fullscreenEnabled = true;

@ -1,6 +1,7 @@
import _ from 'lodash'; import _ from 'lodash';
import { getPbxConfiguration, addGroup, removeGroup, addSeat, removeSeat } from '../api/pbx-config' import { getPbxConfiguration, addGroup,
removeGroup, addSeat, removeSeat } from '../api/pbx-config'
const ListState = { const ListState = {
initiated: 'initiated', initiated: 'initiated',
@ -48,13 +49,13 @@ export default {
removeSeatItem: null removeSeatItem: null
}, },
getters: { getters: {
groups(state, getters) { groups(state) {
return state.groupsOrdered; return state.groupsOrdered;
}, },
seats(state, getters) { seats(state) {
return state.seatsOrdered; return state.seatsOrdered;
}, },
numbers(state, getters) { numbers(state) {
return _.get(state, 'numbers', []); return _.get(state, 'numbers', []);
}, },
primaryNumbers(state, getters) { primaryNumbers(state, getters) {
@ -117,11 +118,14 @@ export default {
all.numbers.forEach((number)=>{ all.numbers.forEach((number)=>{
if(_.has(state.groups, number.subscriber_id)) { if(_.has(state.groups, number.subscriber_id)) {
number.subscriber = state.groups[number.subscriber_id]; number.subscriber = state.groups[number.subscriber_id];
} else if (_.has(state.seats, number.subscriber_id)) { }
else if (_.has(state.seats, number.subscriber_id)) {
number.subscriber = state.seats[number.subscriber_id]; number.subscriber = state.seats[number.subscriber_id];
} else if (state.pilot.id === number.subscriber_id) { }
else if (state.pilot.id === number.subscriber_id) {
number.subscriber = state.pilot; number.subscriber = state.pilot;
} else { }
else {
number.subscriber = null; number.subscriber = null;
} }
state.numbersMap[number.id] = number; state.numbersMap[number.id] = number;

@ -1,6 +1,5 @@
'use strict'; 'use strict';
import _ from 'lodash';
import { import {
getReminder, getReminder,
createReminder, createReminder,
@ -42,7 +41,8 @@ export default {
getReminder(localStorage.getItem('subscriberId')).then((result) => { getReminder(localStorage.getItem('subscriberId')).then((result) => {
if (result.total_count > 0) { if (result.total_count > 0) {
context.commit('reminderLoaded', result._embedded['ngcp:reminders'][0]); // open to suggestions on how to extract data here context.commit('reminderLoaded', result._embedded['ngcp:reminders'][0]); // open to suggestions on how to extract data here
} else { }
else {
// If no default reminder is set, then we need to create it. // If no default reminder is set, then we need to create it.
createReminder(localStorage.getItem('subscriberId')).then((result) => { createReminder(localStorage.getItem('subscriberId')).then((result) => {
context.commit('reminderCreated', result); context.commit('reminderCreated', result);
@ -60,14 +60,15 @@ export default {
toggleReminder(context, enabled) { toggleReminder(context, enabled) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (enabled === true) { if (enabled === true) {
enableReminder(context.state.reminderID).then((result) => { enableReminder(context.state.reminderID).then(() => {
context.commit('enableReminder'); context.commit('enableReminder');
resolve(); resolve();
}).catch((err) => { }).catch((err) => {
reject(err); reject(err);
}); });
} else { }
disableReminder(context.state.reminderID).then((result) => { else {
disableReminder(context.state.reminderID).then(() => {
context.commit('disableReminder'); context.commit('disableReminder');
resolve(); resolve();
}).catch((err) => { }).catch((err) => {
@ -78,7 +79,7 @@ export default {
}, },
changeTime(context, time) { changeTime(context, time) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTime(context.state.reminderID, time).then((result) => { setTime(context.state.reminderID, time).then(() => {
context.commit('setTime', time); context.commit('setTime', time);
resolve(); resolve();
}).catch((err) => { }).catch((err) => {
@ -88,7 +89,7 @@ export default {
}, },
changeRecurrence(context, recurrence) { changeRecurrence(context, recurrence) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setRecurrence(context.state.reminderID, recurrence).then((result) => { setRecurrence(context.state.reminderID, recurrence).then(() => {
context.commit('setRecurrence', recurrence); context.commit('setRecurrence', recurrence);
resolve(); resolve();
}).catch((err) => { }).catch((err) => {

@ -22,28 +22,30 @@ export default {
userDataError: null userDataError: null
}, },
getters: { getters: {
isLogged(state, getters) { isLogged(state) {
return !_.isEmpty(state.jwt) && !_.isEmpty(state.subscriberId); return !_.isEmpty(state.jwt) && !_.isEmpty(state.subscriberId);
}, },
hasUser(state, getters) { hasUser(state) {
return state.subscriber !== null; return state.subscriber !== null;
}, },
getUsername(state, getters) { getUsername(state) {
if(state.subscriber !== null && !_.isEmpty(state.subscriber.display_name)) { if(state.subscriber !== null && !_.isEmpty(state.subscriber.display_name)) {
return state.subscriber.display_name; return state.subscriber.display_name;
} else if (state.subscriber !== null) { }
else if (state.subscriber !== null) {
return state.subscriber.username + "@" + state.subscriber.domain; return state.subscriber.username + "@" + state.subscriber.domain;
} else { }
else {
return ""; return "";
} }
}, },
isAdmin(state, getters) { isAdmin(state) {
return state.subscriber !== null && state.subscriber.administrative; return state.subscriber !== null && state.subscriber.administrative;
}, },
isPbxAdmin(state, getters) { isPbxAdmin(state, getters) {
return getters.isAdmin && state.capabilities !== null && state.capabilities.cloudpbx; return getters.isAdmin && state.capabilities !== null && state.capabilities.cloudpbx;
}, },
hasSmsCapability(state, getters) { hasSmsCapability(state) {
return state.capabilities !== null && return state.capabilities !== null &&
state.capabilities.sms === true; state.capabilities.sms === true;
}, },
@ -53,20 +55,20 @@ export default {
hasSendFaxFeature(state) { hasSendFaxFeature(state) {
return state.features.sendFax; return state.features.sendFax;
}, },
hasFaxCapability(state, getters) { hasFaxCapability(state) {
return state.capabilities !== null && return state.capabilities !== null &&
state.capabilities.faxserver === true; state.capabilities.faxserver === true;
}, },
hasRtcEngineCapability(state, getters) { hasRtcEngineCapability(state) {
return state.capabilities !== null && _.has(state.capabilities, 'rtcengine'); return state.capabilities !== null && _.has(state.capabilities, 'rtcengine');
}, },
hasRtcEngineCapabilityEnabled(state, getters) { hasRtcEngineCapabilityEnabled(state, getters) {
return getters.hasRtcEngineCapability && state.capabilities.rtcengine === true; return getters.hasRtcEngineCapability && state.capabilities.rtcengine === true;
}, },
getSubscriberId(state, getters) { getSubscriberId(state) {
return state.subscriberId; return state.subscriberId;
}, },
loginRequesting(state, getters) { loginRequesting(state) {
return state.loginRequesting; return state.loginRequesting;
}, },
loginSucceeded(state) { loginSucceeded(state) {
@ -75,7 +77,7 @@ export default {
loginError(state) { loginError(state) {
return state.loginError; return state.loginError;
}, },
userDataRequesting(state, getters) { userDataRequesting(state) {
return state.userDataRequesting; return state.userDataRequesting;
}, },
userDataSucceeded(state) { userDataSucceeded(state) {
@ -84,17 +86,19 @@ export default {
jwtTTL(state) { jwtTTL(state) {
let expirationBuffer = 0.05; let expirationBuffer = 0.05;
try { try {
let jwtParts = state.jwt.split('\.'); let jwtParts = state.jwt.split('.');
let jwtPayload = JSON.parse(atob(jwtParts[1])); let jwtPayload = JSON.parse(atob(jwtParts[1]));
if(_.isNumber(jwtPayload.exp)) { if(_.isNumber(jwtPayload.exp)) {
let timeDiff = Math.floor((Date.now() / 1000) - jwtPayload.exp); let timeDiff = Math.floor((Date.now() / 1000) - jwtPayload.exp);
let timeLeft = Math.abs(timeDiff); let timeLeft = Math.abs(timeDiff);
let timeLeftBuffer = Math.round(timeLeft * expirationBuffer); let timeLeftBuffer = Math.round(timeLeft * expirationBuffer);
return timeLeft - timeLeftBuffer; return timeLeft - timeLeftBuffer;
} else { }
else {
return null; return null;
} }
} catch(err) { }
catch(err) {
return null; return null;
} }
} }
@ -161,7 +165,7 @@ export default {
context.commit('loginFailed', err.message); context.commit('loginFailed', err.message);
}); });
}, },
logout(context) { logout() {
localStorage.removeItem('jwt'); localStorage.removeItem('jwt');
localStorage.removeItem('subscriberId'); localStorage.removeItem('subscriberId');
document.location.href = '/csc'; document.location.href = '/csc';

@ -10,5 +10,5 @@ export default {
} }
</script> </script>
<style> <style lang="stylus" rel="stylesheet/stylus">
</style> </style>

Loading…
Cancel
Save