2 * Copyright (c) 2016 highstreet technologies GmbH and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 define(['app/mwtnSpectrum/mwtnSpectrum.module',
10 'app/mwtnSpectrum/mwtnSpectrum.services',
11 'app/mwtnCommons/mwtnCommons.services'], function(mwtnSpectrumApp) {
13 mwtnSpectrumApp.register.controller('mwtnSpectrumCtrl', ['$scope', '$rootScope', 'uiGridConstants','$mwtnSpectrum', '$mwtnLog', 'OnfNetworkElement', 'MicrowavePhysicalSection',
14 function($scope, $rootScope, uiGridConstants, $mwtnSpectrum, $mwtnLog, OnfNetworkElement, MicrowavePhysicalSection) {
16 var COMPONENT = 'mwtnSpectrumCtrl';
17 $mwtnLog.info({component: COMPONENT, message: 'mwtnSpectrumCtrl started!'});
19 $rootScope.section_logo = 'src/app/mwtnSpectrum/images/mwtnSpectrum.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif'
21 $scope.interference = {
22 alarmStatus: 'cleared'
25 $scope.execute = function() {
26 $scope.interference.alarmStatus = 'raised';
27 $mwtnSpectrum.execute().then(function(success) {
28 $scope.interference.alarmStatus = 'cleared';
30 $scope.interference.alarmStatus = 'cleared';
33 $scope.clear = function() {
34 console.log("Cleared");
35 $scope.interference.alarmStatus = 'cleared';
38 var updateAirInterface = function(spec, data) {
40 var radioSignalID = data.airInterfaceConfiguration.radioSignalID;
41 $scope.gridOptions.data.map(function(row){
42 if (row.name === spec.nodeId && row.radioSignalID === radioSignalID) {
43 row.actualTxFrequency = data.airInterfaceConfiguration.txFrequency;
44 row.actualRxFrequency = data.airInterfaceConfiguration.rxFrequency;
48 $scope.gridOptions.data.map(function(row){
49 if (row.nodeId === spec.nodeId) {
50 row.actualTxFrequency = '?';
51 row.actualRxFrequency = '?';
57 $scope.processing = false;
58 $scope.refresh = function() {
59 $scope.processing = true;
60 $scope.interference.alarmStatus = 'cleared';
61 $mwtnSpectrum.refresh().then(function(success){
62 $scope.processing = false;
63 $scope.gridOptions.data = success.airInterfaces;
64 success.actualNodes.map(function(actualNode){
65 if (actualNode.connectionStatus !== 'connected') {
68 var revision = '2016-09-01';
69 $mwtnSpectrum.getActualNetworkElement(actualNode.id, revision).then(function(onfNe){
70 var aOnfNe = new OnfNetworkElement(onfNe.NetworkElement);
71 aOnfNe.getLTPMwpsList().map(function(ltp){
73 nodeId: actualNode.id,
75 pacId: 'airinterface',
76 layerProtocolId: ltp._lpList[0].uuid,
77 partId: 'Configuration'
79 $mwtnSpectrum.getPacParts(spec).then(function(success){
80 updateAirInterface(spec, success);
82 updateAirInterface(spec, error);
90 $scope.processing = false;
91 $scope.gridOptions.data = [];
95 $scope.highlightFilteredHeader = $mwtnSpectrum.highlightFilteredHeader;
97 var requiredNesConnectionStatusCellTemplate = [
98 '<div class="ui-grid-cell-contents" ng-class="{ \'green\': grid.getCellValue(row, col) === \'connected\'}"}>',
99 ' <i ng-show="grid.getCellValue(row, col) === \'connected\'" class="fa fa-link" aria-hidden="true"></i>',
100 ' <span>{{grid.getCellValue(row, col)}}</span>',
103 var actualTxFrequencyCellTemplate = [
104 '<div class="ui-grid-cell-contents" ng-class="{ \'green\': grid.getCellValue(row, col) === \'connected\'}"}>',
105 ' <span ng-class="{\'mismatch\': {{row.entity.plannedTxFrequency}} !== grid.getCellValue(row, col) }">{{grid.getCellValue(row, col)}}</span>',
108 var actualRxFrequencyCellTemplate = [
109 '<div class="ui-grid-cell-contents" ng-class="{ \'green\': grid.getCellValue(row, col) === \'connected\'}"}>',
110 ' <span ng-class="{\'mismatch\': {{row.entity.plannedRxFrequency}} !== grid.getCellValue(row, col) }">{{grid.getCellValue(row, col)}}</span>',
113 $scope.gridOptions = JSON.parse(JSON.stringify($mwtnSpectrum.gridOptions));
114 $scope.gridOptions.columnDefs = [
115 { field: 'id', type: 'number', displayName: 'Id', headerCellClass: $scope.highlightFilteredHeader, width : 50, cellClass: 'number', pinnedLeft : true , sort: {
116 direction: uiGridConstants.ASC,
120 { field: 'name', type: 'string', displayName: 'Name', headerCellClass: $scope.highlightFilteredHeader, width : 140 },
121 { field: 'connectionStatus', type: 'string', displayName: 'Connection status', headerCellClass: $scope.highlightFilteredHeader, width : 150, cellTemplate: requiredNesConnectionStatusCellTemplate },
122 { field: 'airInterfaceName', type: 'string', displayName: 'Airinterface name', headerCellClass: $scope.highlightFilteredHeader, width : 140 },
123 { field: 'radioSignalID', type: 'string', displayName: 'Radio signal id', headerCellClass: $scope.highlightFilteredHeader, width : 130 },
124 { field: 'plannedTxFrequency', type: 'number', displayName: 'TX (plan)', headerCellClass: $scope.highlightFilteredHeader, width : 110, cellClass: 'number' },
125 { field: 'actualTxFrequency', type: 'number', displayName: 'TX (actual)', headerCellClass: $scope.highlightFilteredHeader, width : 110, cellClass: 'number', cellTemplate: actualTxFrequencyCellTemplate},
126 { field: 'plannedRxFrequency', type: 'number', displayName: 'RX (plan)', headerCellClass: $scope.highlightFilteredHeader, width : 110, cellClass: 'number' },
127 { field: 'actualRxFrequency', type: 'number', displayName: 'RX (actual)', headerCellClass: $scope.highlightFilteredHeader, width : 110, cellClass: 'number', cellTemplate: actualRxFrequencyCellTemplate}