Profile details page
diff --git a/mCordPortal/src/app/components/add-enode-to-item/add-enode-to-item.html b/mCordPortal/src/app/components/add-enode-to-item/add-enode-to-item.html
new file mode 100644
index 0000000..efd65e0
--- /dev/null
+++ b/mCordPortal/src/app/components/add-enode-to-item/add-enode-to-item.html
@@ -0,0 +1,6 @@
+<div class="modal-header">
+ <h3 class="modal-title">Add Imsi</h3>
+</div>
+<div class="modal-body">
+ <xos-table data="vm.enodes" config="vm.config"></xos-table>
+</div>
\ No newline at end of file
diff --git a/mCordPortal/src/app/components/add-enode-to-item/add-enode-to-item.js b/mCordPortal/src/app/components/add-enode-to-item/add-enode-to-item.js
new file mode 100644
index 0000000..6d40929
--- /dev/null
+++ b/mCordPortal/src/app/components/add-enode-to-item/add-enode-to-item.js
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+angular.module('mCord')
+ .directive('addEnodeToItem', function () {
+ return {
+ restrict: 'E',
+ templateUrl: 'app/components/add-enode-to-item/add-enode-to-item.html',
+ scope: {
+ modal: '=',
+ cb: '=',
+ item: '='
+ },
+ bindToController: true,
+ controllerAs: 'vm',
+ controller: function(Enodeb){
+
+ Enodeb.query().$promise
+ .then((enodes) => {
+ this.enodes = enodes;
+ return this.item.getEnodes();
+ })
+ .then((itemEnodes) => {
+ console.log(itemEnodes, this.enodes);
+ this.enodes = _.differenceBy(this.enodes, itemEnodes, 'eNBId');
+ });
+
+ this.config = {
+ columns: [
+ {
+ label: '#',
+ prop: 'eNBId',
+ link: item => `#/enode/${item.eNBId}`
+ },
+ {
+ label: 'Ip Address',
+ prop: 'IpAddr'
+ },
+ {
+ label: 'Description',
+ prop: 'Description'
+ },
+ {
+ label: 'Status',
+ prop: 'Status',
+ type: 'boolean'
+ }
+ ],
+ actions: [
+ {
+ label: 'Add',
+ icon: 'plus',
+ cb: (enode) => {
+ _.remove(this.enodes, p => p.eNBId === enode.eNBId);
+ this.cb(enode);
+ },
+ }
+ ],
+ filter: 'field',
+ order: true
+ }
+ }
+ };
+ });
diff --git a/mCordPortal/src/app/components/add-imsi-to-item/add-imsi-to-item.html b/mCordPortal/src/app/components/add-imsi-to-item/add-imsi-to-item.html
new file mode 100644
index 0000000..7bbb358
--- /dev/null
+++ b/mCordPortal/src/app/components/add-imsi-to-item/add-imsi-to-item.html
@@ -0,0 +1,6 @@
+<div class="modal-header">
+ <h3 class="modal-title">Add Imsi</h3>
+</div>
+<div class="modal-body">
+ <xos-table data="vm.imsis" config="vm.config"></xos-table>
+</div>
\ No newline at end of file
diff --git a/mCordPortal/src/app/components/add-imsi-to-item/add-imsi-to-item.js b/mCordPortal/src/app/components/add-imsi-to-item/add-imsi-to-item.js
new file mode 100644
index 0000000..4236ca9
--- /dev/null
+++ b/mCordPortal/src/app/components/add-imsi-to-item/add-imsi-to-item.js
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2015 Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+angular.module('mCord')
+ .directive('addImsiToItem', function () {
+ return {
+ restrict: 'E',
+ templateUrl: 'app/components/add-imsi-to-item/add-imsi-to-item.html',
+ scope: {
+ modal: '=',
+ cb: '=',
+ item: '='
+ },
+ bindToController: true,
+ controllerAs: 'vm',
+ controller: function(Imsi){
+
+ Imsi.query().$promise
+ .then((imsis) => {
+ this.imsis = imsis;
+ return this.item.getImsis();
+ })
+ .then((itemImsi) => {
+ console.log(itemImsi, this.imsis);
+ this.imsis = _.differenceBy(this.imsis, itemImsi, 'IMSI');
+ });
+
+ this.config = {
+ columns: [
+ {
+ label: '#',
+ prop: 'IMSI',
+ link: item => `#/imsi/${item.IMSI}`
+ },
+ {
+ label: 'Enodeb',
+ prop: 'Enodeb'
+ },
+ {
+ label: 'DlMeasBitRate',
+ prop: 'DlMeasBitRate'
+ },
+ {
+ label: 'UlMeasBitRate',
+ prop: 'UlMeasBitRate'
+ },
+ {
+ label: 'Status',
+ prop: 'UeStatus',
+ type: 'boolean'
+ }
+ ],
+ actions: [
+ {
+ label: 'Add',
+ icon: 'plus',
+ cb: (imsi) => {
+ _.remove(this.imsis, p => p.IMSI === imsi.IMSI);
+ this.cb(imsi);
+ },
+ }
+ ],
+ filter: 'field',
+ order: true
+ }
+ }
+ };
+ });
diff --git a/mCordPortal/src/app/components/add-profile-to-item/add-profile-to-item.js b/mCordPortal/src/app/components/add-profile-to-item/add-profile-to-item.js
index 17f0504..15569d0 100644
--- a/mCordPortal/src/app/components/add-profile-to-item/add-profile-to-item.js
+++ b/mCordPortal/src/app/components/add-profile-to-item/add-profile-to-item.js
@@ -30,7 +30,6 @@
Profile.query().$promise
.then((profiles) => {
- // TODO diff all profile from item.getProfiles
this.profiles = profiles;
return this.item.getProfiles();
})
diff --git a/mCordPortal/src/app/services/rest/enodeb.js b/mCordPortal/src/app/services/rest/enodeb.js
index 9ab289c..d1b9e50 100644
--- a/mCordPortal/src/app/services/rest/enodeb.js
+++ b/mCordPortal/src/app/services/rest/enodeb.js
@@ -1,7 +1,7 @@
(function () {
angular.module('mCord')
.service('Enodeb', function($resource, $q, $http, baseUrl){
- const r = $resource(`${baseUrl}api/enodeb/:id`, {id: '@id'}, {
+ const r = $resource(`${baseUrl}api/enodeb/:id`, {id: '@eNBId'}, {
save: {method: 'PUT'}
});
diff --git a/mCordPortal/src/app/services/rest/imsi.js b/mCordPortal/src/app/services/rest/imsi.js
index 16f4f19..8e93aac 100644
--- a/mCordPortal/src/app/services/rest/imsi.js
+++ b/mCordPortal/src/app/services/rest/imsi.js
@@ -1,7 +1,7 @@
(function () {
angular.module('mCord')
.service('Imsi', function($resource, $q, $http, baseUrl){
- const r = $resource(`${baseUrl}api/imsi/:id`, {id: '@id'}, {
+ const r = $resource(`${baseUrl}api/imsi/:id`, {id: '@IMSI'}, {
save: {method: 'PUT'}
});
diff --git a/mCordPortal/src/app/services/rest/profiles.js b/mCordPortal/src/app/services/rest/profiles.js
index ab9fca9..a6e0d3c 100644
--- a/mCordPortal/src/app/services/rest/profiles.js
+++ b/mCordPortal/src/app/services/rest/profiles.js
@@ -1,6 +1,92 @@
(function () {
angular.module('mCord')
- .service('Profile', function($resource, baseUrl){
- return $resource(`${baseUrl}api/profile/:id`, {id: '@id'});
+ .service('Profile', function($resource, $q, $http, baseUrl){
+ const r = $resource(`${baseUrl}api/profile/:id`, {id: '@Name'});
+
+ r.prototype.getImsis = function(){
+ const d = $q.defer();
+
+ $http.get(`${baseUrl}api/profile/${this.Name}/imsi`)
+ .then(res => {
+ d.resolve(res.data);
+ })
+ .catch(err => {
+ d.reject(err)
+ });
+
+ return d.promise;
+ };
+
+ r.prototype.deleteImsis = function(){
+ const d = $q.defer();
+
+ $http.delete(`${baseUrl}api/profile/${this.Name}/imsi`)
+ .then(res => {
+ d.resolve(res.data);
+ })
+ .catch(err => {
+ d.reject(err)
+ });
+
+ return d.promise;
+ };
+
+ r.prototype.deleteImsi = function(id){
+ const d = $q.defer();
+
+ $http.delete(`${baseUrl}api/profile/${this.Name}/imsi/${id}`)
+ .then(res => {
+ d.resolve(res.data);
+ })
+ .catch(err => {
+ d.reject(err)
+ });
+
+ return d.promise;
+ };
+
+ r.prototype.getEnodes = function(){
+ const d = $q.defer();
+
+ $http.get(`${baseUrl}api/profile/${this.Name}/enodeb`)
+ .then(res => {
+ d.resolve(res.data);
+ })
+ .catch(err => {
+ d.reject(err)
+ });
+
+ return d.promise;
+ };
+
+ r.prototype.deleteEnodes = function(){
+ const d = $q.defer();
+
+ $http.delete(`${baseUrl}api/profile/${this.Name}/enodeb`)
+ .then(res => {
+ d.resolve(res.data);
+ })
+ .catch(err => {
+ d.reject(err)
+ });
+
+ return d.promise;
+ };
+
+ r.prototype.deleteEnode = function(id){
+ const d = $q.defer();
+
+ $http.delete(`${baseUrl}api/profile/${this.Name}/enodeb/${id}`)
+ .then(res => {
+ d.resolve(res.data);
+ })
+ .catch(err => {
+ d.reject(err)
+ });
+
+ return d.promise;
+ };
+
+ return r;
})
})();
\ No newline at end of file
diff --git a/mCordPortal/src/app/view/profiles-details/profiles-details.js b/mCordPortal/src/app/view/profiles-details/profiles-details.js
new file mode 100644
index 0000000..124db00
--- /dev/null
+++ b/mCordPortal/src/app/view/profiles-details/profiles-details.js
@@ -0,0 +1,178 @@
+/**
+ * © OpenCORD
+ *
+ * Visit http://guide.xosproject.org/devguide/addview/ for more information
+ *
+ * Created by teone on 6/13/16.
+ */
+
+(function () {
+ 'use strict';
+ angular.module('mCord')
+ .directive('profileDetails', function ($uibModal, $q) {
+ return {
+ restrict: 'E',
+ scope: {},
+ controllerAs: 'vm',
+ templateUrl: 'app/view/profiles-details/profiles-details.tpl.html',
+ controller: function ($uibModal, $stateParams, Profile, _) {
+ Profile.get({id: $stateParams.id}).$promise
+ .then((profile) => {
+ this.profile = profile;
+ return $q.all([
+ profile.getImsis(),
+ profile.getEnodes()
+ ]);
+ })
+ .then(res => {
+ const [imsis, enodes] = res;
+ this.imsis = imsis;
+ this.enodes = enodes;
+ })
+ .catch(e => console.log(e));
+
+ this.formConfig = {
+ exclude: ['IMSIRuleArray'],
+ formName: 'updateProfiles',
+ actions: [
+ {
+ label: 'Update',
+ icon: 'ok',
+ cb: (imsi) => {
+ imsi.$save();
+ },
+ class: 'primary-border'
+ }
+ ]
+ };
+
+ this.imsiTableCfg = {
+ order: true,
+ filter: 'field',
+ columns: [
+ {
+ label: '#',
+ prop: 'IMSI',
+ link: item => `#/imsi/${item.IMSI}`
+ },
+ {
+ label: 'Enodeb',
+ prop: 'Enodeb'
+ },
+ {
+ label: 'DlMeasBitRate',
+ prop: 'DlMeasBitRate'
+ },
+ {
+ label: 'UlMeasBitRate',
+ prop: 'UlMeasBitRate'
+ },
+ {
+ label: 'Status',
+ prop: 'UeStatus',
+ type: 'boolean'
+ }
+ ],
+ actions: [
+ {
+ label: 'Delete',
+ icon: 'remove',
+ color: 'red',
+ cb: (imsi) => {
+ this.profile.deleteImsi(imsi.IMSI)
+ .then(() => {
+ _.remove(this.imsis, i =>i.IMSI === imsi.IMSI);
+ });
+ }
+ }
+ ]
+ };
+
+ this.enodeTableCfg = {
+ order: true,
+ filter: 'field',
+ columns: [
+ {
+ label: '#',
+ prop: 'eNBId',
+ link: item => `#/enode/${item.eNBId}`
+ },
+ {
+ label: 'Ip Address',
+ prop: 'IpAddr'
+ },
+ {
+ label: 'Description',
+ prop: 'Description'
+ },
+ {
+ label: 'Status',
+ prop: 'Status',
+ type: 'boolean'
+ }
+ ],
+ actions: [
+ {
+ label: 'Delete',
+ icon: 'remove',
+ color: 'red',
+ cb: (enode) => {
+ this.profile.deleteImsi(enode.eNBId)
+ .then(() => {
+ _.remove(this.enodes, i =>i.eNBId === enode.eNBId);
+ });
+ }
+ }
+ ]
+ };
+
+ this.deleteAllImsi = () => {
+ this.profile.deleteImsis()
+ .then(() => {
+ this.imsis = [];
+ });
+ };
+
+ this.addImsi = () => {
+ const _this = this;
+ this.modalInstance = $uibModal.open({
+ animation: true,
+ templateUrl: 'addImsiToProfile',
+ controllerAs: 'vm',
+ controller: function ($uibModalInstance) {
+ this.modal = $uibModalInstance;
+ this.callback = (imsi) => {
+ _this.imsis.push(imsi);
+ };
+ this.profile = _this.profile;
+ }
+ });
+ };
+
+ this.addEnode = () => {
+ const _this = this;
+ this.modalInstance = $uibModal.open({
+ animation: true,
+ templateUrl: 'addEnodeToProfile',
+ controllerAs: 'vm',
+ controller: function ($uibModalInstance) {
+ this.modal = $uibModalInstance;
+ this.callback = (enode) => {
+ _this.enodes.push(enode);
+ };
+ this.profile = _this.profile;
+ }
+ });
+ };
+
+ this.deleteAllEnodes = () => {
+ this.profile.deleteEnodes()
+ .then(() => {
+ this.enodes = [];
+ });
+ };
+ }
+ }
+ });
+})();
+
diff --git a/mCordPortal/src/app/view/profiles-details/profiles-details.tpl.html b/mCordPortal/src/app/view/profiles-details/profiles-details.tpl.html
new file mode 100644
index 0000000..cdedf66
--- /dev/null
+++ b/mCordPortal/src/app/view/profiles-details/profiles-details.tpl.html
@@ -0,0 +1,50 @@
+<div class="container-fluid">
+ <div class="row">
+ <div class="col-xs-12">
+ <h1 class="primary">Profile {{vm.profile.Name}}</h1>
+ </div>
+ <div class="col-sm-12">
+ <xos-form ng-model="vm.profile" config="vm.formConfig"></xos-form>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-xs-12">
+ <h1 class="primary">IMSI:</h1>
+ </div>
+ <div class="col-xs-12">
+ <xos-table config="vm.imsiTableCfg" data="vm.imsis"></xos-table>
+ </div>
+ <div class="col-xs-12 text-right">
+ <a ng-show="vm.imsis.length > 0" ng-click="vm.deleteAllImsi()" href="" class="btn btn-danger-border">
+ Delete all IMSI
+ </a>
+ <a ng-click="vm.addImsi()" class="btn btn-primary-border">
+ Add IMSI
+ </a>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col-xs-12">
+ <h1 class="primary">E Node B:</h1>
+ </div>
+ <div class="col-xs-12">
+ <xos-table config="vm.enodeTableCfg" data="vm.enodes"></xos-table>
+ </div>
+ <div class="col-xs-12 text-right">
+ <a ng-show="vm.enodes.length > 0" ng-click="vm.deleteAllEnodes()" href="" class="btn btn-danger-border">
+ Delete all E Node B
+ </a>
+ <a ng-click="vm.addEnode()" class="btn btn-primary-border">
+ Add E Node B
+ </a>
+ </div>
+ </div>
+</div>
+
+<script type="text/ng-template" id="addImsiToProfile">
+ <add-imsi-to-item modal="vm.modal" cb="vm.callback" item="vm.profile"></add-imsi-to-item>
+</script>
+
+<script type="text/ng-template" id="addEnodeToProfile">
+ <add-enode-to-item modal="vm.modal" cb="vm.callback" item="vm.profile"></add-enode-to-item>
+</script>
\ No newline at end of file