diff --git a/.gitignore b/.gitignore
index 575868ff..9c01e7ee 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,3 +37,5 @@ yarn-error.log*
/junit.xml
/test/jest/coverage
+
+quasar.conf.dev.js
diff --git a/quasar.conf.dev.proxy.js b/quasar.conf.dev.proxy.js
new file mode 100644
index 00000000..4a641d07
--- /dev/null
+++ b/quasar.conf.dev.proxy.js
@@ -0,0 +1,7 @@
+
+module.exports = {
+ public: '',
+ publicPath: '/v2/',
+ proxyAPI2localhost: true,
+ proxyAPIFromURL: 'https://{{sipwiseVoipPlatformIPorFDQN}}'
+}
diff --git a/quasar.conf.js b/quasar.conf.js
index 0155f202..cf86ade1 100644
--- a/quasar.conf.js
+++ b/quasar.conf.js
@@ -1,3 +1,4 @@
+/* eslint-env node */
/*
* This file runs in a Node context (it's NOT transpiled by Babel), so use only
* the ES6 features that are supported by your Node version. https://node.green/
@@ -5,9 +6,18 @@
// Configuration for your app
// https://quasar.dev/quasar-cli/quasar-conf-js
-/* eslint-env node */
+module.exports = function (ctx) {
+ let devServerConfig = {}
+ try {
+ devServerConfig = (ctx.dev) ? require('./quasar.conf.dev.js') : {}
+ } catch (e) {
+ if (e.code === 'MODULE_NOT_FOUND') {
+ devServerConfig = {}
+ } else {
+ throw e
+ }
+ }
-module.exports = function (/* ctx */) {
return {
// https://quasar.dev/quasar-cli/supporting-ts
supportTS: false,
@@ -88,7 +98,24 @@ module.exports = function (/* ctx */) {
devServer: {
https: false,
port: 8080,
- open: true // opens browser window automatically
+ open: true, // opens browser window automatically,
+ public: devServerConfig.public,
+ publicPath: devServerConfig.publicPath,
+ ...(!devServerConfig.proxyAPI2localhost ? {} : {
+ https: true,
+ publicPath: devServerConfig.publicPath || '/v2/',
+ proxy: {
+ [`!${devServerConfig.publicPath || '/v2/'}`]: {
+ target: devServerConfig.proxyAPIFromURL,
+ secure: false
+ }
+ },
+ before: function (app, server, compiler) {
+ app.get('/', function (req, res) {
+ res.redirect(301, devServerConfig.publicPath || '/v2/')
+ })
+ }
+ })
},
// https://quasar.dev/quasar-cli/quasar-conf-js#Property%3A-framework
diff --git a/src/boot/config.js b/src/boot/config.js
index 640ef1fe..35990200 100644
--- a/src/boot/config.js
+++ b/src/boot/config.js
@@ -5,6 +5,7 @@ import config from 'src/config'
Vue.use({
install (Vue, options) {
Vue.$config = config
+ Vue.prototype.$config = config
}
})
diff --git a/src/components/CscMainMenuTop.vue b/src/components/CscMainMenuTop.vue
index 9cfe6e21..31383373 100644
--- a/src/components/CscMainMenuTop.vue
+++ b/src/components/CscMainMenuTop.vue
@@ -48,7 +48,9 @@ export default {
'isRtcEngineUiVisible',
'isPbxEnabled',
'hasFaxCapability',
- 'hasSubscriberProfileAttribute'
+ 'hasSubscriberProfileAttribute',
+ 'getCustomerId',
+ 'isOldCSCProxyingAllowed'
]),
items () {
return [
@@ -200,6 +202,12 @@ export default {
icon: 'devices',
label: this.$t('Registered Devices'),
visible: true
+ },
+ {
+ to: '/customer/' + this.getCustomerId + '/details',
+ icon: 'far fa-address-card',
+ label: this.$t('Customer Details'),
+ visible: this.isOldCSCProxyingAllowed
}
]
}
diff --git a/src/i18n/en.json b/src/i18n/en.json
index fbb13bdf..95a9a891 100644
--- a/src/i18n/en.json
+++ b/src/i18n/en.json
@@ -178,6 +178,7 @@
"Custom Announcement": "Custom Announcement",
"Custom Announcements": "Custom Announcements",
"Custom sound": "Custom sound",
+ "Customer Details": "Customer Details",
"Daily": "Daily",
"Default": "Default",
"Default For Subscribers": "Default For Subscribers",
diff --git a/src/i18n/index.js b/src/i18n/index.js
index fba5e377..f48eb6b1 100644
--- a/src/i18n/index.js
+++ b/src/i18n/index.js
@@ -5,6 +5,7 @@ import localeIt from './it.json'
import localeEs from './es.json'
import localeDe from './de.json'
import localeRu from './ru.json'
+import { i18n } from 'src/boot/i18n'
export const defaultLocale = 'en-US'
@@ -43,3 +44,25 @@ function patchKeysForFallback (messages = {}) {
})
return messages
}
+
+/**
+ * It converts language code from V2 (new CSC) to V1 UI (old Panel CSC) format
+ * @param {string} lang
+ * @returns {string}
+ */
+export function convertLangV2toV1 (lang) {
+ return lang === 'en-US' ? 'en' : lang
+}
+
+/**
+ * It converts language code from V1 (old Panel CSC) to V2 UI (new CSC) format
+ * @param {string} lang
+ * @returns {string}
+ */
+export function convertLangV1toV2 (lang) {
+ return ['en', 'i-default'].includes(lang) ? 'en-US' : lang
+}
+
+export function getCurrentLangAsV1Format () {
+ return convertLangV2toV1(i18n.locale)
+}
diff --git a/src/pages/Proxy.vue b/src/pages/Proxy.vue
new file mode 100644
index 00000000..e2160514
--- /dev/null
+++ b/src/pages/Proxy.vue
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/src/router/routes.js b/src/router/routes.js
index 1e15f4ee..675a79ae 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -355,6 +355,21 @@ export default function routes (app) {
}
}
},
+ {
+ path: '/customer/*',
+ component: () => import('pages/Proxy'),
+ meta: {
+ title: i18n.t('Customer Details'),
+ subtitle: i18n.t('Customer Details')
+ },
+ async beforeEnter (routeTo, routeFrom, next) {
+ if (app.store.getters['user/isOldCSCProxyingAllowed']) {
+ next()
+ } else {
+ next('/')
+ }
+ }
+ },
{
path: '*',
component: CscPageError404,
diff --git a/src/store/user.js b/src/store/user.js
index 316e53d6..40611088 100644
--- a/src/store/user.js
+++ b/src/store/user.js
@@ -173,6 +173,9 @@ export default {
getSubscriber (state) {
return state.subscriber
},
+ getCustomerId (state) {
+ return state.subscriber?.customer_id
+ },
isPasswordChanging (state) {
return state.changePasswordState === RequestState.requesting
},
@@ -199,6 +202,9 @@ export default {
},
hasSubscriberProfileAttributes: (state) => (attributes) => {
return state.profile ? state.profile.attributes.some(item => attributes.includes(item)) : true
+ },
+ isOldCSCProxyingAllowed (state, getters) {
+ return getters.isAdmin && state.platformInfo?.csc_v2_mode === 'mixed' && !!getters.getCustomerId
}
},
mutations: {
diff --git a/t/Dockerfile b/t/Dockerfile
index 40b8e8cb..4ea2d2ba 100644
--- a/t/Dockerfile
+++ b/t/Dockerfile
@@ -5,7 +5,7 @@ FROM docker.mgm.sipwise.com/sipwise-bullseye:latest
# is updated with the current date. It will force refresh of all
# of the base images and things like `apt-get update` won't be using
# old cached versions when the Dockerfile is built.
-ENV REFRESHED_AT 2021-07-07
+ENV REFRESHED_AT 2021-07-08
ENV DEBIAN_FRONTEND noninteractive
ENV DISPLAY=:0