From d5e7a0bdea592a62e936ac781c8b50c174f365ce Mon Sep 17 00:00:00 2001 From: Hans-Peter Herzog Date: Mon, 16 Apr 2018 15:41:09 +0200 Subject: [PATCH] TT#20518 PBXConfig: As a Customer, I want to see a list of all PBX Devices Change-Id: Ia7971b4e1b6183b6aa5b2ad90ce4f1883371763e --- src/api/pbx-devices.js | 69 ++++++++++++++++++ src/components/CscPage.vue | 3 +- .../pages/PbxConfiguration/CscPbxDevice.vue | 71 +++++++++++++++++++ .../pages/PbxConfiguration/CscPbxDevices.vue | 44 ++++++++++++ .../pages/PbxConfiguration/CscPbxGroup.vue | 36 +++------- .../PbxConfiguration/CscPbxGroupAddForm.vue | 2 +- .../{Groups.vue => CscPbxGroups.vue} | 27 ++++--- .../pages/PbxConfiguration/CscPbxSeat.vue | 34 +++------ .../PbxConfiguration/CscPbxSeatAddForm.vue | 2 +- .../{Seats.vue => CscPbxSeats.vue} | 27 ++++--- .../pages/PbxConfiguration/Devices.vue | 18 ----- src/locales/en.json | 11 ++- src/routes.js | 6 +- src/store/pbx-config/actions.js | 13 ++++ src/store/pbx-config/getters.js | 19 +++++ src/store/pbx-config/mutations.js | 30 ++++++++ src/store/pbx-config/state.js | 6 ++ src/themes/app.common.styl | 32 +++++++++ 18 files changed, 344 insertions(+), 106 deletions(-) create mode 100644 src/api/pbx-devices.js create mode 100644 src/components/pages/PbxConfiguration/CscPbxDevice.vue create mode 100644 src/components/pages/PbxConfiguration/CscPbxDevices.vue rename src/components/pages/PbxConfiguration/{Groups.vue => CscPbxGroups.vue} (91%) rename src/components/pages/PbxConfiguration/{Seats.vue => CscPbxSeats.vue} (89%) delete mode 100644 src/components/pages/PbxConfiguration/Devices.vue create mode 100644 src/themes/app.common.styl 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 @@