diff --git a/src/api/pbx-devices.js b/src/api/pbx-devices.js new file mode 100644 index 00000000..c47f4c80 --- /dev/null +++ b/src/api/pbx-devices.js @@ -0,0 +1,69 @@ +'use strict'; + +import _ from 'lodash'; +import Vue from 'vue'; +import { getJsonBody } from './utils' + +export function getAllDevices(options) { + return new Promise((resolve, reject)=>{ + let rows = _.get(options, 'rows', 25); + let page = _.get(options, 'page', 1); + Vue.http.get('/api/pbxdevices/', null, { + params: { + rows: rows, + page: page + } + }).then((result)=>{ + let body = getJsonBody(result.body); + let totalCount = body.totalCount; + let lastPage = Math.ceil(totalCount / rows); + let items = _.get(body, '_embedded.ngcp:pbxdevices'); + resolve({ + lastPage: lastPage, + items: items + }); + }).catch((err)=>{ + reject(err); + }); + }); +} + +export function getAllProfiles() { + return new Promise((resolve, reject)=>{ + Vue.http.get('/api/pbxdeviceprofiles/').then((result)=>{ + let body = getJsonBody(result.body); + resolve(_.get(body, '_embedded.ngcp:pbxdeviceprofiles')); + }).catch((err)=>{ + reject(err); + }); + }); +} + +export function getAllModels() { + return new Promise((resolve, reject)=>{ + Vue.http.get('/api/pbxdevicemodels/').then((result)=>{ + let body = getJsonBody(result.body); + resolve(_.get(body, '_embedded.ngcp:pbxdevicemodels')); + }).catch((err)=>{ + reject(err); + }); + }); +} + +export function getDeviceList() { + return new Promise((resolve, reject)=>{ + Promise.all([ + getAllDevices(), + getAllProfiles(), + getAllModels() + ]).then((results)=>{ + resolve({ + devices: results[0], + profiles: results[1], + models: results[2] + }); + }).catch((err)=>{ + reject(err); + }); + }); +} diff --git a/src/components/CscPage.vue b/src/components/CscPage.vue index c0b6eaf7..8b6dd765 100644 --- a/src/components/CscPage.vue +++ b/src/components/CscPage.vue @@ -47,7 +47,7 @@ .page { position: relative; - padding: 30px; + padding: 60px; padding-top: 100px; margin: 0px; } @@ -61,6 +61,7 @@ .page .page-title { padding: 30px; + padding-left: 60px; z-index: 1000; right: 0; background: -moz-linear-gradient(top, rgba(255,255,255,1) 44%, rgba(255,255,255,0.86) 71%, rgba(255,255,255,0) 100%); diff --git a/src/components/pages/PbxConfiguration/CscPbxDevice.vue b/src/components/pages/PbxConfiguration/CscPbxDevice.vue new file mode 100644 index 00000000..6bace9ec --- /dev/null +++ b/src/components/pages/PbxConfiguration/CscPbxDevice.vue @@ -0,0 +1,71 @@ + + + + + diff --git a/src/components/pages/PbxConfiguration/CscPbxDevices.vue b/src/components/pages/PbxConfiguration/CscPbxDevices.vue new file mode 100644 index 00000000..aad41f3f --- /dev/null +++ b/src/components/pages/PbxConfiguration/CscPbxDevices.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/src/components/pages/PbxConfiguration/CscPbxGroup.vue b/src/components/pages/PbxConfiguration/CscPbxGroup.vue index c0ea34d1..f9716d4e 100644 --- a/src/components/pages/PbxConfiguration/CscPbxGroup.vue +++ b/src/components/pages/PbxConfiguration/CscPbxGroup.vue @@ -1,12 +1,13 @@