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

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

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

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

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

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

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

@ -59,7 +59,7 @@ function patchReminder(id, field, value) {
'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();
}).catch((err) => {
reject(err);

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

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

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

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

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

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

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

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

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

@ -36,7 +36,7 @@
import { mapGetters } from 'vuex'
import { startLoading, stopLoading, showGlobalError } from '../helpers/ui'
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 {
name: 'login',
@ -104,8 +104,9 @@
}
</script>
<style lang="stylus">
@import '../../src/themes/app.variables.styl';
<style lang="stylus" rel="stylesheet/stylus">
@import '../themes/app.variables.styl';
#csc-login {
padding-top: 12%;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -151,7 +151,8 @@
titleIcon() {
if(this.expanded) {
return 'keyboard arrow down';
} else {
}
else {
return 'keyboard arrow up';
}
},
@ -163,7 +164,8 @@
toggleMain() {
if(this.expanded) {
this.expanded = false;
} else {
}
else {
this.expanded = true;
}
},
@ -174,7 +176,7 @@
}
</script>
<style>
<style lang="stylus" rel="stylesheet/stylus">
.csc-pbx-group {
position: relative;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1,11 +1,12 @@
import Vue from 'vue'
import VueI18n from 'vue-i18n'
import localeEn from './locales/en'
Vue.use(VueI18n);
export const locales = {
en: require('./locales/en')
en: localeEn
};
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
// require(`quasar/dist/quasar.ie`)
// require(`quasar/dist/quasar.ie.${__THEME}.css`)
import './themes/app.mat.styl'
import 'quasar-extras/roboto-font';
import 'quasar-extras/material-icons'
import 'quasar-extras/fontawesome'
import 'quasar-extras/animate'
import _ from 'lodash'
import Vue from 'vue'
import VueResource from 'vue-resource'
import Quasar from 'quasar-framework'
import { store } from './store'
import { i18n, locales } from './i18n'
import { i18n } from './i18n'
import router from './router'
import { sync } from 'vuex-router-sync'
import { RtcEngineCall } from './plugins/call'
import filter from './filters'
Vue.use(VueResource);
import App from './App.vue'
import './filters'
Vue.config.productionTip = false;
Vue.use(Quasar); // Install Quasar Framework
Vue.use(Quasar);
Vue.use(VueResource);
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);
Vue.http.interceptors.push(function(request, next) {
@ -54,6 +41,6 @@ Quasar.start(() => {
i18n,
store,
router,
render: h => h(require('./App.vue').default)
render: h => h(App)
})
});

@ -17,7 +17,8 @@ export default {
type: this.$t('pbxConfig.group'),
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', {
type: this.$t('pbxConfig.seat'),
name: number.subscriber.display_name

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

@ -7,17 +7,6 @@ import routes from './routes'
Vue.use(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
});
@ -26,11 +15,13 @@ router.beforeEach((to, from, next) => {
next({
path: '/login'
});
} else if (store.getters['user/isLogged'] && to.path === '/login') {
}
else if (store.getters['user/isLogged'] && to.path === '/login') {
next({
path: '/'
});
} else {
}
else {
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 [
{
path: '/user',
component: require('./components/layouts/Default').default,
component: DefaultLayout,
children: [
{
path: 'home',
component: require('./components/pages/Home').default,
component: Home,
},
{
path: 'conversations',
component: require('./components/pages/Conversations').default,
component: Conversations,
},
{
path: 'call-forward/always',
component: require('./components/pages/CallForward/Always').default,
component: CallForwardAlways,
},
{
path: 'call-forward/company-hours',
component: require('./components/pages/CallForward/CompanyHours').default
component: CallForwardCompanyHours
},
{
path: 'call-forward/after-hours',
component: require('./components/pages/CallForward/AfterHours').default
component: CallForwardAfterHours
},
{
path: 'call-blocking/incoming',
component: require('./components/pages/CallBlocking/Incoming').default
component: CallBlockingIncoming
},
{
path: 'call-blocking/outgoing',
component: require('./components/pages/CallBlocking/Outgoing').default
component: CallBlockingOutgoing
},
{
path: 'call-blocking/privacy',
component: require('./components/pages/CallBlocking/Privacy').default
component: CallBlockingPrivacy
},
{
path: 'reminder',
component: require('./components/pages/Reminder').default},
component: Reminder
},
{
path: 'pbx-configuration/groups',
component: require('./components/pages/PbxConfiguration/Groups').default
component: PbxConfigurationGroups
},
{
path: 'pbx-configuration/seats',
component: require('./components/pages/PbxConfiguration/Seats').default
component: PbxConfigurationSeats
},
{
path: 'pbx-configuration/devices',
component: require('./components/pages/PbxConfiguration/Devices').default
component: PbxConfigurationDevices
}
]
},
{
path: '/login',
component: require('./components/Login').default
component: Login
},
{
path: '/',
@ -63,6 +80,6 @@ export default [
},
{
path: '*',
component: require('./components/Error404').default
component: Error404
}
]

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

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

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

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

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

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

@ -1,6 +1,7 @@
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 = {
initiated: 'initiated',
@ -48,13 +49,13 @@ export default {
removeSeatItem: null
},
getters: {
groups(state, getters) {
groups(state) {
return state.groupsOrdered;
},
seats(state, getters) {
seats(state) {
return state.seatsOrdered;
},
numbers(state, getters) {
numbers(state) {
return _.get(state, 'numbers', []);
},
primaryNumbers(state, getters) {
@ -117,11 +118,14 @@ export default {
all.numbers.forEach((number)=>{
if(_.has(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];
} else if (state.pilot.id === number.subscriber_id) {
}
else if (state.pilot.id === number.subscriber_id) {
number.subscriber = state.pilot;
} else {
}
else {
number.subscriber = null;
}
state.numbersMap[number.id] = number;

@ -1,6 +1,5 @@
'use strict';
import _ from 'lodash';
import {
getReminder,
createReminder,
@ -42,7 +41,8 @@ export default {
getReminder(localStorage.getItem('subscriberId')).then((result) => {
if (result.total_count > 0) {
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.
createReminder(localStorage.getItem('subscriberId')).then((result) => {
context.commit('reminderCreated', result);
@ -60,14 +60,15 @@ export default {
toggleReminder(context, enabled) {
return new Promise((resolve, reject) => {
if (enabled === true) {
enableReminder(context.state.reminderID).then((result) => {
enableReminder(context.state.reminderID).then(() => {
context.commit('enableReminder');
resolve();
}).catch((err) => {
reject(err);
});
} else {
disableReminder(context.state.reminderID).then((result) => {
}
else {
disableReminder(context.state.reminderID).then(() => {
context.commit('disableReminder');
resolve();
}).catch((err) => {
@ -78,7 +79,7 @@ export default {
},
changeTime(context, time) {
return new Promise((resolve, reject) => {
setTime(context.state.reminderID, time).then((result) => {
setTime(context.state.reminderID, time).then(() => {
context.commit('setTime', time);
resolve();
}).catch((err) => {
@ -88,7 +89,7 @@ export default {
},
changeRecurrence(context, recurrence) {
return new Promise((resolve, reject) => {
setRecurrence(context.state.reminderID, recurrence).then((result) => {
setRecurrence(context.state.reminderID, recurrence).then(() => {
context.commit('setRecurrence', recurrence);
resolve();
}).catch((err) => {

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

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

Loading…
Cancel
Save