diff --git a/.eslintrc.js b/.eslintrc.js
index a822147d..44a6a419 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,41 +1,38 @@
module.exports = {
- root: true,
- parser: 'babel-eslint',
- parserOptions: {
- sourceType: 'module'
- },
- env: {
- browser: 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: {
- 'cordova': true,
- 'DEV': true,
- 'PROD': true,
- '__THEME': true
- },
- // add your custom rules here
- 'rules': {
- // allow paren-less arrow functions
- 'arrow-parens': 0,
- 'one-var': 0,
- 'import/first': 0,
- 'import/named': 2,
- '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
- }
-}
+ root: true,
+ parser: 'babel-eslint',
+ parserOptions: {
+ sourceType: 'module'
+ },
+ env: {
+ browser: true,
+ es6: true
+ },
+ extends: [
+ 'eslint:recommended'
+ ],
+ plugins: [
+ 'html',
+ 'import'
+ ],
+ globals: {
+ 'cdk': true,
+ 'cordova': true,
+ 'DEV': true,
+ 'PROD': true,
+ '__THEME': true
+ },
+ rules: {
+ 'arrow-parens': 0,
+ 'one-var': 0,
+ 'import/first': 0,
+ 'import/named': 2,
+ 'import/namespace': 2,
+ 'import/default': 2,
+ 'import/export': 2,
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
+ 'brace-style': [2, 'stroustrup', {'allowSingleLine': true}],
+ "no-console": 0
+ }
+};
+
diff --git a/build/webpack.base.conf.js b/build/webpack.base.conf.js
index 9cbc5820..821bc5aa 100644
--- a/build/webpack.base.conf.js
+++ b/build/webpack.base.conf.js
@@ -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',
diff --git a/src/App.vue b/src/App.vue
index 0c2a020a..112f7889 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -13,7 +13,6 @@
}
-
diff --git a/src/components/CscConversations.vue b/src/components/CscConversations.vue
index abf63012..2a6b2a68 100644
--- a/src/components/CscConversations.vue
+++ b/src/components/CscConversations.vue
@@ -27,7 +27,7 @@
this.$store.dispatch('conversations/loadConversations')
.then(() => {
done();
- }).catch((err) => {
+ }).catch(() => {
done();
this.$refs.infinite.stop();
});
@@ -36,5 +36,5 @@
}
-
diff --git a/src/components/CscMedia.vue b/src/components/CscMedia.vue
index 38c298e8..f040eb3c 100644
--- a/src/components/CscMedia.vue
+++ b/src/components/CscMedia.vue
@@ -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 @@
}
-
diff --git a/src/components/Login.vue b/src/components/Login.vue
index 1fb16251..ddc560b4 100644
--- a/src/components/Login.vue
+++ b/src/components/Login.vue
@@ -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 @@
}
-
diff --git a/src/components/card/CscNumberChip.vue b/src/components/card/CscNumberChip.vue
index 190b9c3d..0e509d08 100644
--- a/src/components/card/CscNumberChip.vue
+++ b/src/components/card/CscNumberChip.vue
@@ -19,7 +19,7 @@
}
-
diff --git a/src/components/layouts/Default.vue b/src/components/layouts/Default.vue
index e1d2bd8e..7772618e 100644
--- a/src/components/layouts/Default.vue
+++ b/src/components/layouts/Default.vue
@@ -110,8 +110,7 @@
-
diff --git a/src/components/pages/CallBlocking/Outgoing.vue b/src/components/pages/CallBlocking/Outgoing.vue
index ad8274ab..5ab205d5 100644
--- a/src/components/pages/CallBlocking/Outgoing.vue
+++ b/src/components/pages/CallBlocking/Outgoing.vue
@@ -14,5 +14,5 @@
}
-
diff --git a/src/components/pages/CallBlocking/Privacy.vue b/src/components/pages/CallBlocking/Privacy.vue
index 3c9e6011..afed60e2 100644
--- a/src/components/pages/CallBlocking/Privacy.vue
+++ b/src/components/pages/CallBlocking/Privacy.vue
@@ -41,5 +41,5 @@
}
-
diff --git a/src/components/pages/CallForward/AfterHours.vue b/src/components/pages/CallForward/AfterHours.vue
index f98ab721..36e701f1 100644
--- a/src/components/pages/CallForward/AfterHours.vue
+++ b/src/components/pages/CallForward/AfterHours.vue
@@ -28,5 +28,5 @@
}
-
diff --git a/src/components/pages/CallForward/Always.vue b/src/components/pages/CallForward/Always.vue
index e3904c09..3ec42d15 100644
--- a/src/components/pages/CallForward/Always.vue
+++ b/src/components/pages/CallForward/Always.vue
@@ -31,5 +31,5 @@
}
-
diff --git a/src/components/pages/CallForward/CompanyHours.vue b/src/components/pages/CallForward/CompanyHours.vue
index 50725842..5c548f4e 100644
--- a/src/components/pages/CallForward/CompanyHours.vue
+++ b/src/components/pages/CallForward/CompanyHours.vue
@@ -79,5 +79,5 @@
}
-
diff --git a/src/components/pages/CallForward/CscAddDestinationForm.vue b/src/components/pages/CallForward/CscAddDestinationForm.vue
index e0cf8734..7b037311 100644
--- a/src/components/pages/CallForward/CscAddDestinationForm.vue
+++ b/src/components/pages/CallForward/CscAddDestinationForm.vue
@@ -42,9 +42,7 @@
-
diff --git a/src/components/pages/CallForward/CscCallForwardDestinations.vue b/src/components/pages/CallForward/CscCallForwardDestinations.vue
index ace1fadf..82ef466b 100644
--- a/src/components/pages/CallForward/CscCallForwardDestinations.vue
+++ b/src/components/pages/CallForward/CscCallForwardDestinations.vue
@@ -22,7 +22,6 @@
-
diff --git a/src/components/pages/CallForward/CscCallForwardTime.vue b/src/components/pages/CallForward/CscCallForwardTime.vue
index ff218a21..573640e4 100644
--- a/src/components/pages/CallForward/CscCallForwardTime.vue
+++ b/src/components/pages/CallForward/CscCallForwardTime.vue
@@ -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 @@
}
-
diff --git a/src/components/pages/CallForward/CscCallForwardTimes.vue b/src/components/pages/CallForward/CscCallForwardTimes.vue
index 7d9cc9f4..a7dff81f 100644
--- a/src/components/pages/CallForward/CscCallForwardTimes.vue
+++ b/src/components/pages/CallForward/CscCallForwardTimes.vue
@@ -19,7 +19,6 @@
-
diff --git a/src/components/pages/CallForward/CscDestination.vue b/src/components/pages/CallForward/CscDestination.vue
index 29bd8349..b7ab4e6a 100644
--- a/src/components/pages/CallForward/CscDestination.vue
+++ b/src/components/pages/CallForward/CscDestination.vue
@@ -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 @@
}
-
diff --git a/src/components/pages/CallForward/CscDestinations.vue b/src/components/pages/CallForward/CscDestinations.vue
index 6ed8cb52..45d963b2 100644
--- a/src/components/pages/CallForward/CscDestinations.vue
+++ b/src/components/pages/CallForward/CscDestinations.vue
@@ -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,21 +72,25 @@
}
-
diff --git a/src/components/pages/Conversations.vue b/src/components/pages/Conversations.vue
index d762127e..87364c10 100644
--- a/src/components/pages/Conversations.vue
+++ b/src/components/pages/Conversations.vue
@@ -1,6 +1,6 @@
-
+
@@ -24,8 +24,7 @@
}
-
diff --git a/src/components/pages/Home.vue b/src/components/pages/Home.vue
index c332aff0..9abb04bc 100644
--- a/src/components/pages/Home.vue
+++ b/src/components/pages/Home.vue
@@ -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 @@
}
-
diff --git a/src/components/pages/PbxConfiguration/Devices.vue b/src/components/pages/PbxConfiguration/Devices.vue
index 2f96e431..945245f9 100644
--- a/src/components/pages/PbxConfiguration/Devices.vue
+++ b/src/components/pages/PbxConfiguration/Devices.vue
@@ -14,5 +14,5 @@
}
-
diff --git a/src/components/pages/PbxConfiguration/Groups.vue b/src/components/pages/PbxConfiguration/Groups.vue
index 92013fa5..fb9658b1 100644
--- a/src/components/pages/PbxConfiguration/Groups.vue
+++ b/src/components/pages/PbxConfiguration/Groups.vue
@@ -58,7 +58,7 @@
diff --git a/src/filters/date.js b/src/filters/date.js
index 3395533d..28262247 100644
--- a/src/filters/date.js
+++ b/src/filters/date.js
@@ -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);
diff --git a/src/filters/number-format.js b/src/filters/number-format.js
index 11ce99ac..90f1577f 100644
--- a/src/filters/number-format.js
+++ b/src/filters/number-format.js
@@ -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;
}
}
diff --git a/src/filters/number.js b/src/filters/number.js
index 4a85a6de..56ee84ff 100644
--- a/src/filters/number.js
+++ b/src/filters/number.js
@@ -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;
}
diff --git a/src/helpers/cdk-lib.js b/src/helpers/cdk-lib.js
index 5830ae42..80814a4e 100644
--- a/src/helpers/cdk-lib.js
+++ b/src/helpers/cdk-lib.js
@@ -16,11 +16,13 @@ export function loadCdkLib() {
}, function(err, script){
if(err) {
reject(err);
- } else {
+ }
+ else {
resolve(script);
}
});
- } else {
+ }
+ else {
resolve();
}
});
diff --git a/src/helpers/ui.js b/src/helpers/ui.js
index f03b4112..27131aae 100644
--- a/src/helpers/ui.js
+++ b/src/helpers/ui.js
@@ -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();
}
diff --git a/src/i18n.js b/src/i18n.js
index caff41e8..174e633a 100644
--- a/src/i18n.js
+++ b/src/i18n.js
@@ -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({
diff --git a/src/main.js b/src/main.js
index e428ae85..bd26471a 100644
--- a/src/main.js
+++ b/src/main.js
@@ -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)
})
});
diff --git a/src/mixins/alias-number-options.js b/src/mixins/alias-number-options.js
index 59976b21..17a6f6d9 100644
--- a/src/mixins/alias-number-options.js
+++ b/src/mixins/alias-number-options.js
@@ -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
diff --git a/src/plugins/call.js b/src/plugins/call.js
index d2bf994e..e6ad9960 100644
--- a/src/plugins/call.js
+++ b/src/plugins/call.js
@@ -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();
}
}
diff --git a/src/router.js b/src/router.js
index 0204716a..458f3aba 100644
--- a/src/router.js
+++ b/src/router.js
@@ -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();
}
});
diff --git a/src/routes.js b/src/routes.js
index 9b833ea1..a0e18c4c 100644
--- a/src/routes.js
+++ b/src/routes.js
@@ -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
}
]
diff --git a/src/store/call-blocking.js b/src/store/call-blocking.js
index 8f815e87..fb533930 100644
--- a/src/store/call-blocking.js
+++ b/src/store/call-blocking.js
@@ -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();
diff --git a/src/store/call-forward.js b/src/store/call-forward.js
index 50812175..94067b77 100644
--- a/src/store/call-forward.js
+++ b/src/store/call-forward.js
@@ -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) => {
diff --git a/src/store/call.js b/src/store/call.js
index 34e0ee11..b76f02de 100644
--- a/src/store/call.js
+++ b/src/store/call.js
@@ -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 });
}
}
diff --git a/src/store/conversations.js b/src/store/conversations.js
index 64048076..6b0723af 100644
--- a/src/store/conversations.js
+++ b/src/store/conversations.js
@@ -1,7 +1,5 @@
+'use strict';
-'use strict'
-
-import _ from 'lodash'
import { getConversations, downloadVoiceMail } from '../api/conversations'
export default {
diff --git a/src/store/index.js b/src/store/index.js
index 9578c233..4b8cedbf 100644
--- a/src/store/index.js
+++ b/src/store/index.js
@@ -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'
diff --git a/src/store/layout.js b/src/store/layout.js
index 9acb3e18..dfd00129 100644
--- a/src/store/layout.js
+++ b/src/store/layout.js
@@ -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;
diff --git a/src/store/pbx-config.js b/src/store/pbx-config.js
index 8099eff0..5a5b3ec3 100644
--- a/src/store/pbx-config.js
+++ b/src/store/pbx-config.js
@@ -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;
diff --git a/src/store/reminder.js b/src/store/reminder.js
index 50cc4f08..ae92fd73 100644
--- a/src/store/reminder.js
+++ b/src/store/reminder.js
@@ -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) => {
diff --git a/src/store/user.js b/src/store/user.js
index e3b527c0..03735241 100644
--- a/src/store/user.js
+++ b/src/store/user.js
@@ -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';
diff --git a/templates/component.vue b/templates/component.vue
index acdaedc7..14cbdee6 100644
--- a/templates/component.vue
+++ b/templates/component.vue
@@ -10,5 +10,5 @@ export default {
}
-