Matteo Scandolo | eccf497 | 2016-06-13 11:32:05 -0700 | [diff] [blame] | 1 | /** |
| 2 | * © OpenCORD |
| 3 | * |
| 4 | * Visit http://guide.xosproject.org/devguide/addview/ for more information |
| 5 | * |
| 6 | * Created by teone on 6/13/16. |
| 7 | */ |
| 8 | |
| 9 | (function () { |
| 10 | 'use strict'; |
| 11 | angular.module('mCord') |
| 12 | .directive('imsiList', function ($uibModal) { |
| 13 | return { |
| 14 | restrict: 'E', |
| 15 | scope: {}, |
| 16 | controllerAs: 'vm', |
| 17 | templateUrl: 'app/view/imsi-list/imsi-list.tpl.html', |
| 18 | controller: function ($log, Imsi) { |
| 19 | |
| 20 | Imsi.query().$promise |
| 21 | .then((imsi) => { |
| 22 | console.log(imsi); |
| 23 | this.imsi = imsi; |
| 24 | }); |
| 25 | |
| 26 | this.tableConfig = { |
| 27 | order: true, |
| 28 | filter: 'field', |
| 29 | columns: [ |
| 30 | { |
| 31 | label: '#', |
| 32 | prop: 'IMSI', |
| 33 | link: item => `#/imsi/${item.IMSI}` |
| 34 | }, |
| 35 | { |
| 36 | label: 'Enodeb', |
| 37 | prop: 'Enodeb' |
| 38 | }, |
| 39 | { |
| 40 | label: 'DlMeasBitRate', |
| 41 | prop: 'DlMeasBitRate' |
| 42 | }, |
| 43 | { |
| 44 | label: 'UlMeasBitRate', |
| 45 | prop: 'UlMeasBitRate' |
| 46 | }, |
| 47 | { |
| 48 | label: 'Status', |
| 49 | prop: 'UeStatus', |
| 50 | type: 'boolean' |
| 51 | } |
Matteo Scandolo | 76b29ae | 2016-07-14 13:47:51 -0700 | [diff] [blame] | 52 | ], |
| 53 | actions: [ |
| 54 | { |
| 55 | label: 'delete', |
| 56 | icon: 'remove', |
| 57 | cb: (item) => { |
| 58 | item.$delete() |
| 59 | .then(() => { |
| 60 | _.remove(this.imsi, item); |
| 61 | }) |
| 62 | .catch(e => { |
| 63 | console.log(e); |
| 64 | }) |
| 65 | }, |
| 66 | color: 'red' |
| 67 | } |
Matteo Scandolo | eccf497 | 2016-06-13 11:32:05 -0700 | [diff] [blame] | 68 | ] |
| 69 | }; |
Matteo Scandolo | ed9e3ec | 2016-06-13 15:20:11 -0700 | [diff] [blame] | 70 | |
| 71 | this.addImsi = () => { |
| 72 | this.modalInstance = $uibModal.open({ |
| 73 | animation: true, |
| 74 | templateUrl: 'addEnode', |
| 75 | controllerAs: 'vm', |
| 76 | controller: function($uibModalInstance){ |
| 77 | this.modal = $uibModalInstance; |
| 78 | } |
| 79 | }); |
| 80 | } |
Matteo Scandolo | eccf497 | 2016-06-13 11:32:05 -0700 | [diff] [blame] | 81 | } |
| 82 | } |
| 83 | }); |
| 84 | })(); |
| 85 | |