diff --git a/src/api/common.js b/src/api/common.js
index 4db31ed5..20ad4b6f 100644
--- a/src/api/common.js
+++ b/src/api/common.js
@@ -100,7 +100,8 @@ export async function getList (options) {
}
return {
items: items,
- lastPage: lastPage
+ lastPage: lastPage,
+ totalCount
}
}
diff --git a/src/api/subscriber.js b/src/api/subscriber.js
index 5abdadb7..713448d3 100644
--- a/src/api/subscriber.js
+++ b/src/api/subscriber.js
@@ -597,3 +597,22 @@ export async function downloadRecordingStream (fileId) {
const res = await Vue.http.get('api/callrecordingfiles/' + fileId, { responseType: 'blob' })
return res.body
}
+
+export async function getSubscriberRegistrations (options) {
+ let all = false
+ if (options.rows === 0) {
+ delete options.rows
+ delete options.page
+ all = true
+ }
+ if (!options.order_by) {
+ delete options.order_by
+ delete options.order_by_direction
+ }
+ const list = await getList({
+ resource: 'subscriberregistrations',
+ all,
+ params: options
+ })
+ return list
+}
diff --git a/src/components/CscMainMenuTop.vue b/src/components/CscMainMenuTop.vue
index d899a32b..c6c23a2b 100644
--- a/src/components/CscMainMenuTop.vue
+++ b/src/components/CscMainMenuTop.vue
@@ -193,6 +193,12 @@ export default {
icon: 'settings',
label: this.$t('PBX Settings'),
visible: this.isPbxEnabled
+ },
+ {
+ to: '/user/registered-devices',
+ icon: 'devices',
+ label: this.$t('Registered Devices'),
+ visible: true
}
]
}
diff --git a/src/pages/CscPageRegisteredDevices.vue b/src/pages/CscPageRegisteredDevices.vue
new file mode 100644
index 00000000..0dafbd60
--- /dev/null
+++ b/src/pages/CscPageRegisteredDevices.vue
@@ -0,0 +1,130 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/router/routes.js b/src/router/routes.js
index 2e70deb0..09c53d6c 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -31,6 +31,7 @@ import CscPageError404 from 'src/pages/CscPageError404'
import CscRecoverPassword from 'src/pages/CscRecoverPassword'
import CscPageCf from 'pages/CscPageCf'
import CscPageCallSettings from 'pages/CscPageCallSettings'
+import CscPageRegisteredDevices from 'pages/CscPageRegisteredDevices'
const getToken = (route) => {
return {
@@ -247,6 +248,14 @@ export default function routes (app) {
subtitle: i18n.t('Set your PBX settings')
}
},
+ {
+ path: 'registered-devices',
+ component: CscPageRegisteredDevices,
+ meta: {
+ title: i18n.t('Registered Devices'),
+ subtitle: i18n.t('List of registered devices for the subscriber')
+ }
+ },
{
path: '*',
component: CscPageError404
diff --git a/src/store/user.js b/src/store/user.js
index f0e9ae11..3a418fd7 100644
--- a/src/store/user.js
+++ b/src/store/user.js
@@ -13,7 +13,13 @@ import {
login,
getUserData
} from '../api/user'
-import { changePassword, resetPassword, recoverPassword, getBrandingLogo } from '../api/subscriber'
+import {
+ changePassword,
+ resetPassword,
+ recoverPassword,
+ getBrandingLogo,
+ getSubscriberRegistrations
+} from '../api/subscriber'
import { deleteJwt, getJwt, getSubscriberId, setJwt, setSubscriberId } from 'src/auth'
import { setSession } from 'src/storage'
@@ -47,7 +53,8 @@ export default {
logoRequesting: false,
logoRequested: false,
resellerBranding: null,
- defaultBranding: {}
+ defaultBranding: {},
+ subscriberRegistrations: []
},
getters: {
isLogged (state) {
@@ -281,6 +288,9 @@ export default {
},
setDefaultBranding (state, value) {
state.defaultBranding = value
+ },
+ setSubscriberRegistrations (state, value) {
+ state.subscriberRegistrations = value
}
},
actions: {
@@ -391,6 +401,19 @@ export default {
if (value) {
context.commit('setDefaultBranding', value)
}
+ },
+ async loadSubscriberRegistrations ({ commit, dispatch, state, rootGetters }, options) {
+ try {
+ const list = await getSubscriberRegistrations({
+ ...options,
+ subscriber_id: getSubscriberId()
+ })
+ commit('setSubscriberRegistrations', list.items)
+ return list.totalCount
+ } catch (err) {
+ commit('setSubscriberRegistrations', [])
+ throw err
+ }
}
}
}