Adding profiles to EnodeB and IMSI
diff --git a/mCordPortal/src/app/components/add-profile-to-item/add-profile-to-item.html b/mCordPortal/src/app/components/add-profile-to-item/add-profile-to-item.html
new file mode 100644
index 0000000..dec2045
--- /dev/null
+++ b/mCordPortal/src/app/components/add-profile-to-item/add-profile-to-item.html
@@ -0,0 +1,6 @@
+<div class="modal-header">
+ <h3 class="modal-title">Add Profile</h3>
+</div>
+<div class="modal-body">
+ <xos-table data="vm.profiles" config="vm.config"></xos-table>
+</div>
\ No newline at end of file
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
new file mode 100644
index 0000000..17f0504
--- /dev/null
+++ b/mCordPortal/src/app/components/add-profile-to-item/add-profile-to-item.js
@@ -0,0 +1,79 @@
+/*
+ * 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('addProfileToItem', function () {
+ return {
+ restrict: 'E',
+ templateUrl: 'app/components/add-profile-to-item/add-profile-to-item.html',
+ scope: {
+ modal: '=',
+ cb: '=',
+ item: '='
+ },
+ bindToController: true,
+ controllerAs: 'vm',
+ controller: function(Profile){
+
+ Profile.query().$promise
+ .then((profiles) => {
+ // TODO diff all profile from item.getProfiles
+ this.profiles = profiles;
+ return this.item.getProfiles();
+ })
+ .then((itemProfiles) => {
+ this.profiles = _.differenceBy(this.profiles, itemProfiles, 'Name');
+ });
+
+ this.config = {
+ columns: [
+ {
+ label: 'Name',
+ prop: 'Name'
+ },
+ {
+ label: 'DlAllocRBRate',
+ prop: 'DlAllocRBRate'
+ },
+ {
+ label: 'UlAllocRBRate',
+ prop: 'UlAllocRBRate'
+ },
+ {
+ label: 'Start',
+ prop: 'Start'
+ },
+ {
+ label: 'End',
+ prop: 'End'
+ }
+ ],
+ actions: [
+ {
+ label: 'Add',
+ icon: 'plus',
+ cb: (profile) => {
+ _.remove(this.profiles, p => p.Name === profile.Name);
+ this.cb(profile);
+ },
+ }
+ ],
+ filter: 'field',
+ order: true
+ }
+ }
+ };
+ });
diff --git a/mCordPortal/src/app/components/related-profiles/related-profiles.js b/mCordPortal/src/app/components/related-profiles/related-profiles.js
index 44314ef..5a889d3 100644
--- a/mCordPortal/src/app/components/related-profiles/related-profiles.js
+++ b/mCordPortal/src/app/components/related-profiles/related-profiles.js
@@ -26,8 +26,8 @@
bindToController: true,
controllerAs: 'vm',
controller: function($scope, _){
- $scope.$watch(() => this.model, enode => {
- if(enode){
+ $scope.$watch(() => this.model, model => {
+ if(model){
loadProfiles();
}
});
@@ -44,7 +44,13 @@
.then(() => {
_.remove(this.profiles, p => p.Name === id);
});
- }
+ };
+
+ $scope.$on('profile.add', (evt, data) => {
+ if(this.model.IMSI === data.targetId || this.model.eNBId === data.targetId){
+ this.profiles.push(data.profile);
+ }
+ });
}
};
});