diff options
Diffstat (limited to 'sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory')
10 files changed, 1591 insertions, 0 deletions
diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-bundle/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-bundle/pom.xml new file mode 100644 index 00000000..feb32631 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-bundle/pom.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>mwtnPerformanceHistory</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + </parent> + <artifactId>mwtnPerformanceHistory-bundle</artifactId> + <name>${prefix} ${project.artifactId}</name> + <packaging>bundle</packaging> + <dependencies> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <version>${osgi.core.version}</version> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.compendium</artifactId> + <version>${osgi.core.version}</version> + </dependency> + <dependency> + <groupId>org.apache.felix</groupId> + <artifactId>org.osgi.compendium</artifactId> + <version>${apache.felix.compendium}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.dlux</groupId> + <artifactId>loader</artifactId> + <version>${dlux.loader.version}</version> + </dependency> + <dependency> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <artifactId>mwtnPerformanceHistory-module</artifactId> + <version>0.5.1-SNAPSHOT</version> + </dependency> + </dependencies> + <build> + <resources> + <resource> + <directory>target/generated-resources</directory> + </resource> + <resource> + <directory>src/main/resources</directory> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <version>2.6</version> + <executions> + <!--loader Resources --> + <execution> + <id>unpack-loader-resources</id> + <goals> + <goal>unpack-dependencies</goal> + </goals> + <phase>generate-resources</phase> + <configuration> + <outputDirectory>${project.build.directory}/generated-resources</outputDirectory> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <includeArtifactIds>mwtnPerformanceHistory-module</includeArtifactIds> + <excludes>META-INF\/**</excludes> + <excludeTransitive>true</excludeTransitive> + <ignorePermissions>false</ignorePermissions> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Import-Package>org.osgi.service.http, + org.osgi.framework;version="1.0.0", + org.opendaylight.dlux.loader + </Import-Package> + <Export-Package></Export-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml new file mode 100644 index 00000000..3288e4f1 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -0,0 +1,19 @@ +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"> + <reference id="httpService" availability="mandatory" activation="eager" interface="org.osgi.service.http.HttpService"/> + <reference id="loader" availability="mandatory" activation="eager" interface="org.opendaylight.dlux.loader.DluxModuleLoader"/> + + <bean id="bundle" init-method="initialize" destroy-method="clean" class="org.opendaylight.dlux.loader.DluxModule"> + <property name="httpService" ref="httpService"/> + <property name="loader" ref="loader"/> + <property name="moduleName" value="mwtnPerformanceHistory"/> + <property name="url" value="/src/app/mwtnPerformanceHistory"/> + <property name="directory" value="/mwtnPerformanceHistory"/> + <property name="requireJs" value="app/mwtnPerformanceHistory/mwtnPerformanceHistory.module"/> + <property name="angularJs" value="app.mwtnPerformanceHistory"/> + <property name="cssDependencies"> + <list> + <value>src/app/mwtnPerformanceHistory/mwtnPerformanceHistory-custom.css</value> + </list> + </property> + </bean> +</blueprint> diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/pom.xml new file mode 100644 index 00000000..9665ca86 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/pom.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project + xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>mwtnPerformanceHistory</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + </parent> + <artifactId>mwtnPerformanceHistory-module</artifactId> + <name>${prefix} ${project.artifactId}</name> + <packaging>jar</packaging> +</project>
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/images/mwtnPerformance.png b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/images/mwtnPerformance.png Binary files differnew file mode 100755 index 00000000..5517f5b1 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/images/mwtnPerformance.png diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory-custom.css b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory-custom.css new file mode 100644 index 00000000..43663034 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory-custom.css @@ -0,0 +1,13 @@ +/** + * Add your application related css here + */ + + .mwtnHistoryGrid { + height: 600px; + background-color: white; + color:black; +} + +.mwtnHistoryGrid span { + color: #393939; +}
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.controller.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.controller.js new file mode 100644 index 00000000..6a5a2e9a --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.controller.js @@ -0,0 +1,1196 @@ +/* + * @copyright 2017 highstreet technologies GmbH and others. All rights reserved. + * + * @license + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +define(['app/mwtnPerformanceHistory/mwtnPerformanceHistory.module', + 'app/mwtnPerformanceHistory/mwtnPerformanceHistory.services'], + function (mwtnPerformanceHistoryoryApp) { + + mwtnPerformanceHistoryoryApp.register.controller('mwtnPerformanceHistoryCtrl', ['$scope', '$rootScope', '$window', '$translate', '$mwtnLog', '$mwtnPerformanceHistory', 'uiGridConstants', 'OnfNetworkElement', + function ($scope, $rootScope, $window, $translate, $mwtnLog, $mwtnPerformanceHistory, uiGridConstants, OnfNetworkElement) { + + var COMPONENT = 'mwtnPerformanceHistory'; + $mwtnLog.info({ component: COMPONENT, message: 'mwtn historical Performance started!' }); + + $rootScope.section_logo = 'src/app/mwtnPerformanceHistory/images/mwtnPerformance.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif' + + var globalFilter; + + $scope.selecteditem = {}; + + //time selector + $scope.selecteditem.timePeriod = "15 minutes"; + $scope.timePeriods = ["15 minutes", "24 hours"]; + + //interface selector + $scope.selecteditem.selectedLtpId = undefined; + $scope.availableLtpIds = []; + + //stateobject + $scope.state = {}; + $scope.state.filter = false; + $scope.state.sort = false; + $scope.state.lastfilter = null; + $scope.state.lastSort = null; + $scope.state.grid = null; + + //perf log configuration + $scope.gridOptionsPerformance826 = { + paginationPageSizes: [25, 100, 1000, 10000], + paginationPageSize: 25, + useExternalPagination: true, + useExternalSorting: true, + enablePaginationControls: true, + enableFiltering: true, + useExternalFiltering: true, + enableGridMenu: true, + columnDefs: [ + { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false }, + { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false }, + { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 }, + { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 }, + { + field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: { + direction: uiGridConstants.ASC, + priority: 1 + } + }, + { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 }, + + { field: 'es', type: 'string', displayName: 'ES', width: 70 }, + { field: 'ses', type: 'string', displayName: 'SES', width: 70 }, + { field: 'uas', type: 'string', displayName: 'UAS', width: 70 } + + ], + data: 'performance826', + onRegisterApi: function (gridApi) { + $scope.performancegridApi = gridApi; + $scope.performancegridApi.core.on.filterChanged($scope, $scope.filter); + $scope.performancegridApi.core.on.sortChanged($scope, $scope.sortChanged); + $scope.sortChanged($scope.performancegridApi.grid, [$scope.gridOptionsPerformance826.columnDefs[1]]); + + $scope.performancegridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { + getPage($scope.gridOptionsPerformance826); + }); + } + }; + + //receive lvl configuration + $scope.gridOptionsReceiveLevel = { + paginationPageSizes: [25, 100, 1000, 10000], + paginationPageSize: 25, + useExternalPagination: true, + useExternalSorting: true, + enablePaginationControls: true, + enableFiltering: true, + useExternalFiltering: true, + enableGridMenu: true, + columnDefs: [ + { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false }, + { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false }, + { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 }, + { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 }, + { + field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: { + direction: uiGridConstants.ASC, + priority: 1 + } + }, + { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 }, + { field: 'rxmin', type: 'string', displayName: 'Rx min', width: 90 }, + { field: 'rxavg', type: 'string', displayName: 'Rx avg', width: 90 }, + { field: 'rxmax', type: 'string', displayName: 'Rx max', width: 90 } + ], + data: 'receiveLevel', + onRegisterApi: function (gridApi) { + $scope.recvGridApi = gridApi; + $scope.recvGridApi.core.on.filterChanged($scope, $scope.filter); + $scope.recvGridApi.core.on.sortChanged($scope, $scope.sortChanged); + $scope.sortChanged($scope.recvGridApi.grid, [$scope.gridOptionsReceiveLevel.columnDefs[1]]); + + $scope.recvGridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { + getPage($scope.gridOptionsReceiveLevel); + }); + } + }; + + //transmission lvl configuration + $scope.gridOptionsTransmissionLevel = { + paginationPageSizes: [25, 100, 1000, 10000], + paginationPageSize: 25, + useExternalPagination: true, + useExternalSorting: true, + enablePaginationControls: true, + enableFiltering: true, + useExternalFiltering: true, + enableGridMenu: true, + columnDefs: [ + { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false }, + { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false }, + { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 }, + { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 }, + { + field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: { + direction: uiGridConstants.ASC, + priority: 1 + } + }, + { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 }, + { field: 'txmin', type: 'string', displayName: 'Tx min', width: 90 }, + { field: 'txavg', type: 'string', displayName: 'Tx avg', width: 90 }, + { field: 'txmax', type: 'string', displayName: 'Tx max', width: 90 } + ], + data: 'transmissionLevel', + onRegisterApi: function (gridApi) { + $scope.transmissionGridApi = gridApi; + $scope.transmissionGridApi.core.on.filterChanged($scope, $scope.filter); + $scope.transmissionGridApi.core.on.sortChanged($scope, $scope.sortChanged); + $scope.sortChanged($scope.transmissionGridApi.grid, [$scope.gridOptionsTransmissionLevel.columnDefs[1]]); + + $scope.transmissionGridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { + getPage($scope.gridOptionsTransmissionLevel); + }); + } + }; + + //modulation configuration + $scope.gridOptionsModulation = { + paginationPageSizes: [25, 100, 1000, 10000], + paginationPageSize: 25, + useExternalPagination: true, + useExternalSorting: true, + enablePaginationControls: true, + enableFiltering: true, + useExternalFiltering: true, + enableGridMenu: true, + columnDefs: [ + { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false }, + { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false }, + { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 }, + { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 }, + { + field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: { + direction: uiGridConstants.ASC, + priority: 1 + } + }, + { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 }, + { field: 'time2S', type: 'string', displayName: 'QAM2S', width: 90 }, + { field: 'time2', type: 'string', displayName: 'QAM2', width: 90 }, + { field: 'time2L', type: 'string', displayName: 'QAM2L', width: 90 }, + { field: 'time4S', type: 'string', displayName: 'QAM4S', width: 90 }, + { field: 'time4', type: 'string', displayName: 'QAM4', width: 90 }, + { field: 'time4L', type: 'string', displayName: 'QAM4L', width: 90 }, + { field: 'time16S', type: 'string', displayName: 'QAM16S', width: 90 }, + { field: 'time16', type: 'string', displayName: 'QAM16', width: 90 }, + { field: 'time16L', type: 'string', displayName: 'QAM16L', width: 90 }, + { field: 'time32S', type: 'string', displayName: 'QAM32S', width: 90 }, + { field: 'time32', type: 'string', displayName: 'QAM32', width: 90 }, + { field: 'time32L', type: 'string', displayName: 'QAM32L', width: 90 }, + { field: 'time64S', type: 'string', displayName: 'QAM64S', width: 90 }, + { field: 'time64', type: 'string', displayName: 'QAM64', width: 90 }, + { field: 'time64L', type: 'string', displayName: 'QAM64L', width: 90 }, + { field: 'time128S', type: 'string', displayName: 'QAM128S', width: 90 }, + { field: 'time128', type: 'string', displayName: 'QAM128', width: 90 }, + { field: 'time128L', type: 'string', displayName: 'QAM128L', width: 90 }, + { field: 'time256S', type: 'string', displayName: 'QAM256S', width: 90 }, + { field: 'time256', type: 'string', displayName: 'QAM256', width: 90 }, + { field: 'time256L', type: 'string', displayName: 'QAM256L', width: 90 }, + { field: 'time512S', type: 'string', displayName: 'QAM512S', width: 90 }, + { field: 'time512', type: 'string', displayName: 'QAM512', width: 90 }, + { field: 'time512L', type: 'string', displayName: 'QAM512L', width: 90 }, + { field: 'time1024S', type: 'string', displayName: 'QAM1024S', width: 90 }, + { field: 'time1024', type: 'string', displayName: 'QAM1024', width: 90 }, + { field: 'time1024L', type: 'string', displayName: 'QAM1024L', width: 90 }, + { field: 'time2048S', type: 'string', displayName: 'QAM2048S', width: 90 }, + { field: 'time2048', type: 'string', displayName: 'QAM2048', width: 90 }, + { field: 'time2048L', type: 'string', displayName: 'QAM2048L', width: 90 }, + { field: 'time4096S', type: 'string', displayName: 'QAM4096S', width: 90 }, + { field: 'time4096', type: 'string', displayName: 'QAM4096', width: 90 }, + { field: 'time4096L', type: 'string', displayName: 'QAM4096L', width: 90 }, + { field: 'time8192S', type: 'string', displayName: 'QAM8192S', width: 90 }, + { field: 'time8192', type: 'string', displayName: 'QAM8192', width: 90 }, + { field: 'time8192L', type: 'string', displayName: 'QAM8192L', width: 90 } + + + ], + data: 'modulation', + onRegisterApi: function (gridApi) { + $scope.gridApi = gridApi; + $scope.gridApi.core.on.filterChanged($scope, $scope.filter); + $scope.gridApi.core.on.sortChanged($scope, $scope.sortChanged); + $scope.sortChanged($scope.gridApi.grid, [$scope.gridOptionsModulation.columnDefs[1]]); + + $scope.gridApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { + getPage($scope.gridOptionsModulation); + }); + } + }; + + //temperature configuration + $scope.gridOptionsTemperature = { + paginationPageSizes: [25, 100, 1000, 10000], + paginationPageSize: 25, + useExternalPagination: true, + useExternalSorting: true, + enablePaginationControls: true, + enableFiltering: true, + useExternalFiltering: true, + enableGridMenu: true, + columnDefs: [ + { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false }, + { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false }, + { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 }, + { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 }, + { + field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: { + direction: uiGridConstants.ASC, + priority: 1 + } + }, + { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 }, + { field: 'rfTempMin', type: 'string', displayName: 'Rf Temp Min [°C]', width: 90 }, + { field: 'rfTempAvg', type: 'string', displayName: 'Rf Temp Avg [°C]', width: 90 }, + { field: 'rfTempMax', type: 'string', displayName: 'Rf Temp Max [°C]', width: 90 } + + ], + data: 'temperature', + onRegisterApi: function (gridApi) { + $scope.gridTemperatureApi = gridApi; + $scope.gridTemperatureApi.core.on.filterChanged($scope, $scope.filter); + $scope.gridTemperatureApi.core.on.sortChanged($scope, $scope.sortChanged); + $scope.sortChanged($scope.gridTemperatureApi.grid, [$scope.gridOptionsTemperature.columnDefs[1]]); + + $scope.gridTemperatureApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { + getPage($scope.gridOptionsTemperature); + }); + } + } + + //SNIR configuration + $scope.gridOptionsSnir = { + paginationPageSizes: [25, 100, 1000, 10000], + paginationPageSize: 25, + useExternalPagination: true, + useExternalSorting: true, + enablePaginationControls: true, + enableFiltering: true, + useExternalFiltering: true, + enableGridMenu: true, + columnDefs: [ + { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false }, + { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false }, + { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 }, + { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 }, + { + field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: { + direction: uiGridConstants.ASC, + priority: 1 + } + }, + { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 }, + { field: 'snirMin', type: 'string', displayName: [$translate.instant('MWTN_SNIR_MIN'),'[dB]'].join(' '), width: 90 }, + { field: 'snirAvg', type: 'string', displayName: [$translate.instant('MWTN_SNIR_AVG'),'[dB]'].join(' '), width: 90 }, + { field: 'snirMax', type: 'string', displayName: [$translate.instant('MWTN_SNIR_MAX'),'[dB]'].join(' '), width: 90 } + ], + data: 'snir', + onRegisterApi: function (gridApi) { + $scope.gridSNIRApi = gridApi; + $scope.gridSNIRApi.core.on.filterChanged($scope, $scope.filter); + $scope.gridSNIRApi.core.on.sortChanged($scope, $scope.sortChanged); + $scope.sortChanged($scope.gridSNIRApi.grid, [$scope.gridOptionsSnir.columnDefs[1]]); + + $scope.gridSNIRApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { + getPage($scope.gridOptionsSnir); + }); + } + } + + //CPD Configuration + $scope.gridOptionsCrossPolarDiscrimination = { + paginationPageSizes: [25, 100, 1000, 10000], + paginationPageSize: 25, + useExternalPagination: true, + useExternalSorting: true, + enablePaginationControls: true, + enableFiltering: true, + useExternalFiltering: true, + enableGridMenu: true, + columnDefs: [ + { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false }, + { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false }, + { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90 }, + { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 }, + { + field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: { + direction: uiGridConstants.ASC, + priority: 1 + } + }, + { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 }, + { field: 'xpdMin', type: 'string', displayName: 'CPD min [dB]', width: 90 }, + { field: 'xpdAvg', type: 'string', displayName: 'CPD avg [dB]', width: 90 }, + { field: 'xpdMax', type: 'string', displayName: 'CPD max [dB]', width: 90 } + + ], + data: 'crossPolarDiscrimination', + onRegisterApi: function (gridApi) { + $scope.gridXpdApi = gridApi; + $scope.gridXpdApi.core.on.filterChanged($scope, $scope.filter); + $scope.gridXpdApi.core.on.sortChanged($scope, $scope.sortChanged); + $scope.sortChanged($scope.gridOptionsCrossPolarDiscrimination, [$scope.gridOptionsCrossPolarDiscrimination.columnDefs[1]]); + + $scope.gridXpdApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { + getPage($scope.gridOptionsCrossPolarDiscrimination); + }); + } + } + + //ethernet perf configuration + $scope.gridOptionsPerformanceEthernetContainer = { + paginationPageSizes: [25, 100, 1000, 10000], + paginationPageSize: 25, + useExternalPagination: true, + useExternalSorting: true, + enablePaginationControls: true, + enableFiltering: true, + useExternalFiltering: true, + enableGridMenu: true, + columnDefs: [ + { field: 'layerProtocol', type: 'string', displayName: 'Layer Protocol Name', width: 90, visible: false }, + { field: 'id', type: 'string', displayName: $translate.instant('MWTN_LTP'), width: 200, visible: false }, + { field: 'radiosignal', type: 'string', displayName: 'Radio Signal Id', width: 90, visible: false }, + { field: 'scannerId', type: 'string', displayName: 'Scanner Id', width: 90 }, + { + field: 'timestamp', type: 'string', displayName: 'End time', width: 200, sort: { + direction: uiGridConstants.ASC, + priority: 1 + } + }, + { field: 'suspectInterval', type: 'string', displayName: 'Suspect Interval Flag', width: 100 }, + { field: 'txEthernetBytesMaxS', type: 'number', displayName: 'Tx BytesMaxS', width: 90 }, + { field: 'txEthernetBytesMaxM', type: 'number', displayName: 'Tx BytesMaxM', width: 90 }, + { field: 'txEthernetBytesSum', type: 'number', displayName: 'Tx BytesSum', width: 90 } + + ], + data: 'performanceEthernetContainer', + onRegisterApi: function (gridApi) { + $scope.gridPerfEthernetApi = gridApi; + $scope.gridPerfEthernetApi.core.on.filterChanged($scope, $scope.filter); + $scope.gridPerfEthernetApi.core.on.sortChanged($scope, $scope.sortChanged); + $scope.sortChanged($scope.gridPerfEthernetApi.grid, [$scope.gridOptionsPerformanceEthernetContainer.columnDefs[1]]); + + $scope.gridPerfEthernetApi.pagination.on.paginationChanged($scope, function (newPage, pageSize) { + getPage($scope.gridOptionsPerformanceEthernetContainer); + }); + } + }; + + //filter + $scope.filter = function () { + var grid = this.grid; + var columns = []; + + //get all columns where data was typed in + angular.forEach(grid.columns, function (value, key) { + if (value.filters[0].term) { + var col = findColumn(value.field); + if (col === "time-stamp") { + //convert timestamp to db format + var timestamp = $mwtnPerformanceHistory.TimeStampToONFFormat(value.filters[0].term); + columns.push({ column: col, value: timestamp }); + } + else + columns.push({ column: col, value: value.filters[0].term }); //create column object + } + }); + + if (columns.length == 0) { //all filter data cleared away + $scope.state.filter = false; + $scope.state.lastfilter = null; + + //get unfiltered data + getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, null, null).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, grid.options); + + } + }); + + } else { + //base filter string + var filter = { "query": { "bool": { "must": [] } } }; + + //create filter objects + var prefixs = []; + prefixs.push({ prefix: globalFilter }); + + columns.map(function (obj) { + var prefixObj = {}; + prefixObj[obj.column] = obj.value;//add like: {column: "fault.counter", value: "1"} => {"fault.counter":1} + prefixs.push({ prefix: prefixObj }); // => {"prefix":{...}} + }); + + //add objects to must property + filter.query.bool.must = prefixs; + + //save filter + $scope.state.lastfilter = filter; + $scope.state.filter = true; + + getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, filter, null).then(function (response) { + if (response.data.hits.total > 0) { //only, when hits exist + processRequestInGrid(response, grid.options); + //$scope.gridOptionsAlarmLog.totalItems = response.data.hits.total; + } else { + //clear data from list + $scope[grid.options.data] = []; + grid.options.totalItems = 0; + + } + }); + } + }; + + $scope.sortChanged = function (grid, sortColumns) { // sortColumns is an array containing just the column sorted in the grid + + + if (sortColumns && sortColumns.length > 0) { + if (sortColumns[0].sort) { + var name = sortColumns[0].field; // the field (name) of the column sorted + var direction = sortColumns[0].sort.direction // the direction of the column sorted: "desc" or "asc" + sort(direction, findColumn(name), grid); + } + } else if (sortColumns) { + $scope.state.sort = false; + $scope.state.lastSort = null; + + //get unsorted data + getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, null, null).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, grid.options); + } + }); + } + }; + + var sort = function (direction, columnName, grid) { + switch (direction) { + case uiGridConstants.ASC: + + //create sort object + var sortObj = {}; + sortObj[columnName] = { order: 'asc' }; + var sort = [sortObj]; + //save last sort + $scope.state.lastSort = sort; + + getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, null, sort).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, grid.options); + $scope.state.sort = true; + + } + }); + + break; + + case uiGridConstants.DESC: + + var sortObj = {}; + sortObj[columnName] = { order: 'desc' }; + var sort = [sortObj]; + $scope.state.lastSort = sort; + + getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, null, sort).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, grid.options); + $scope.state.sort = true; + } + }); + break; + + case undefined: + + $scope.state.sort = false; + $scope.state.lastSort = null; + + getData($scope.state.lastSort, $scope.state.lastfilter, grid.options, null, null) + .then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, grid.options); + } + }); + + break; + } + } + + function findColumn(name) { + + if (name === "timestamp") { return "time-stamp"; } + else if (name === "layerprotocol") { return "layer-protocol-name"; } + else if (name === "id") { return "uuid-interface"; } + else if (name === "suspectInterval") { return "suspect-interval-flag"; } + else if (name === "scannerId") { return "scanner-id"; } + else if (name === "radiosignal") { return "radio-signal-id"; } + else if (name === "es") { return "performance-data.es"; } + else if (name === "ses") { return "performance-data.ses"; } + else if (name === "uas") { return "performance-data.unavailability"; } + else if (name === "rxmin") { return "performance-data.rx-level-min"; } + else if (name === "rxmax") { return "performance-data.rx-level-max"; } + else if (name === "rxavg") { return "performance-data.rx-level-avg"; } + else if (name === "txmin") { return "performance-data.tx-level-min"; } + else if (name === "txmax") { return "performance-data.tx-level-max"; } + else if (name === "txavg") { return "performance-data.tx-level-avg"; } + else if (name === "Tx BytesMaxS") { return "performance-data.tx-ethernet-bytes-max-s"; } + else if (name === "Tx BytesMaxM") { return "performance-data.tx-ethernet-bytes-max-m"; } + else if (name === "Tx BytesSum") { return "performance-data.tx-ethernet-bytes-sum"; } + else if (name === "xpdMin") { return "performance-data.xpd-min"; } + else if (name === "xpdAvg") { return "performance-data.xpd-avg"; } + else if (name === "xpdMax") { return "performance-data.xpd-max"; } + else if (name === "snirMin") { return "performance-data.snir-min"; } + else if (name === "snirAvg") { return "performance-data.snir-avg"; } + else if (name === "snirMax") { return "performance-data.snir-max"; } + else if (name === "rfTempMin") { return "performance-data.rf-temp-min"; } + else if (name === "rfTempAvg") { return "performance-data.rf-temp-avg"; } + else if (name === "rfTempMax") { return "performance-data.rf-temp-max"; } + else if (name === "time2S") { return "performance-data.time2-states-s"; } + else if (name === "time2") { return "performance-data.time2-states"; } + else if (name === "time2L") { return "performance-data.time2-states-l"; } + else if (name === "time4S") { return "performance-data.time4-states-s"; } + else if (name === "time4") { return "performance-data.time4-states"; } + else if (name === "time4L") { return "performance-data.time4-states-l"; } + else if (name === "time16S") { return "performance-data.time16-states-s"; } + else if (name === "time16") { return "performance-data.time16-states"; } + else if (name === "time16L") { return "performance-data.time16-states-l"; } + else if (name === "time32S") { return "performance-data.time32-states-s"; } + else if (name === "time32") { return "performance-data.time32-states"; } + else if (name === "time32L") { return "performance-data.time32-states-l"; } + else if (name === "time64S") { return "performance-data.time64-states-s"; } + else if (name === "time64") { return "performance-data.time64-states"; } + else if (name === "time64L") { return "performance-data.time64-states-l"; } + else if (name === "time128S") { return "performance-data.time128-states-s"; } + else if (name === "time128") { return "performance-data.time128-states"; } + else if (name === "time128L") { return "performance-data.time128-states-l"; } + else if (name === "time256S") { return "performance-data.time256-states-s"; } + else if (name === "time256") { return "performance-data.time256-states"; } + else if (name === "time256L") { return "performance-data.time256-states-l"; } + else if (name === "time512S") { return "performance-data.time512-states-s"; } + else if (name === "time512") { return "performance-data.time512-states"; } + else if (name === "time512L") { return "performance-data.time512-states-l"; } + else if (name === "time1024S") { return "performance-data.time1024-states-s"; } + else if (name === "time1024") { return "performance-data.time1024-states"; } + else if (name === "time1024L") { return "performance-data.time1024-states-l"; } + else if (name === "time2048S") { return "performance-data.time2048-states-s"; } + else if (name === "time2048") { return "performance-data.time2048-states"; } + else if (name === "time2048L") { return "performance-data.time2048-states-l"; } + else if (name === "time4096S") { return "performance-data.time4096-states-s"; } + else if (name === "time4096") { return "performance-data.time4096-states"; } + else if (name === "time4096L") { return "performance-data.time4096-states-l"; } + else if (name === "time8192S") { return "performance-data.time8192-states-s"; } + else if (name === "time8192") { return "performance-data.time8192-states"; } + else if (name === "time8192L") { return "performance-data.time8192-states-l"; } + + + }; + + var checkData = function (value) { + if (value === -1 || value === undefined) return undefined; + else return value; + }; + + var getPage = function (grid) { + + //from, how many, sort, filter + getData($scope.state.lastSort, $scope.state.lastfilter, grid, null, null) + .then(function (data) { + + processRequestInGrid(data, grid); + }); + }; + + var processRequestInGrid = function (response, grid) { + // console.log(grid.data); + switch (grid.data) { + case "performance826": + var list = []; + + response.data.hits.hits.map(function (entry) { + var item = { + timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']), + id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'], + layerProtocol: entry._source['layer-protocol-name'], + suspectInterval: entry._source['suspect-interval-flag'], + scannerId: entry._source['scanner-id'], + es: checkData(entry._source['performance-data'].es), + ses: checkData(entry._source['performance-data'].ses), + uas: checkData(entry._source['performance-data'].unavailability), + radiosignal: entry._source['radio-signal-id'] + }; + + list.push(item); + + }); + $scope.performance826 = list; + $scope.gridOptionsPerformance826.totalItems = response.data.hits.total; + break; + case "transmissionLevel": + var list = []; + + response.data.hits.hits.map(function (entry) { + var item = { + timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']), + id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'], + layerProtocol: entry._source['layer-protocol-name'], + suspectInterval: entry._source['suspect-interval-flag'], + scannerId: entry._source['scanner-id'], + txmin: checkData(entry._source['performance-data']['tx-level-min']), + txavg: checkData(entry._source['performance-data']['tx-level-avg']), + txmax: checkData(entry._source['performance-data']['tx-level-max']), + radiosignal: entry._source['radio-signal-id'] + }; + + list.push(item); + + }); + $scope.transmissionLevel = list; + $scope.gridOptionsTransmissionLevel.totalItems = response.data.hits.total; + + break; + case "receiveLevel": + + var list = []; + + response.data.hits.hits.map(function (entry) { + var item = { + timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']), + id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'], + layerProtocol: entry._source['layer-protocol-name'], + suspectInterval: entry._source['suspect-interval-flag'], + scannerId: entry._source['scanner-id'], + rxmin: checkData(entry._source['performance-data']['rx-level-min']), + rxavg: checkData(entry._source['performance-data']['rx-level-avg']), + rxmax: checkData(entry._source['performance-data']['rx-level-max']), + radiosignal: entry._source['radio-signal-id'] + }; + + list.push(item); + + }); + $scope.receiveLevel = list; + $scope.gridOptionsReceiveLevel.totalItems = response.data.hits.total; + + break; + case "modulation": + + var list = []; + + response.data.hits.hits.map(function (entry) { + var item = { + timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']), + id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'], + layerProtocol: entry._source['layer-protocol-name'], + suspectInterval: entry._source['suspect-interval-flag'], + scannerId: entry._source['scanner-id'], + time2S: checkData(entry._source['performance-data']['time2-states-s']), + time2: checkData(entry._source['performance-data']['time2-states']), + time2L: checkData(entry._source['performance-data']['time2-states-l']), + time4S: checkData(entry._source['performance-data']['time4-states-s']), + time4: checkData(entry._source['performance-data']['time4-states']), + time4L: checkData(entry._source['performance-data']['time4-states-l']), + time16S: checkData(entry._source['performance-data']['time16-states-s']), + time16: checkData(entry._source['performance-data']['time16-states']), + time16L: checkData(entry._source['performance-data']['time16-states-l']), + time32S: checkData(entry._source['performance-data']['time32-states-s']), + time32: checkData(entry._source['performance-data']['time32-states']), + time32L: checkData(entry._source['performance-data']['time32-states-l']), + time64S: checkData(entry._source['performance-data']['time64-states-s']), + time64: checkData(entry._source['performance-data']['time64-states']), + time64L: checkData(entry._source['performance-data']['time64-states-l']), + time128S: checkData(entry._source['performance-data']['time128-states-s']), + time128: checkData(entry._source['performance-data']['time128-states']), + time128L: checkData(entry._source['performance-data']['time128-states-l']), + time256S: checkData(entry._source['performance-data']['time256-states-s']), + time256: checkData(entry._source['performance-data']['time256-states']), + time256L: checkData(entry._source['performance-data']['time256-states-l']), + time512S: checkData(entry._source['performance-data']['time512-states-s']), + time512: checkData(entry._source['performance-data']['time512-states']), + time512L: checkData(entry._source['performance-data']['time512-states-l']), + time1024S: checkData(entry._source['performance-data']['time1024-states-s']), + time1024: checkData(entry._source['performance-data']['time1024-states']), + time1024L: checkData(entry._source['performance-data']['time1024-states-l']), + time2048S: checkData(entry._source['performance-data']['time2048-states-s']), + time2048: checkData(entry._source['performance-data']['time2048-states']), + time2048L: checkData(entry._source['performance-data']['time2048-states-l']), + time4096S: checkData(entry._source['performance-data']['time4096-states-s']), + time4096: checkData(entry._source['performance-data']['time4096-states']), + time4096L: checkData(entry._source['performance-data']['time4096-states-l']), + time8192S: checkData(entry._source['performance-data']['time8192-states-s']), + time8192: checkData(entry._source['performance-data']['time8192-states']), + time8192L: checkData(entry._source['performance-data']['time8192-states-l']), + radiosignal: entry._source['radio-signal-id'] + }; + + list.push(item); + + }); + $scope.modulation = list; + $scope.gridOptionsModulation.totalItems = response.data.hits.total; + + break; + + case "temperature": + var list = []; + + response.data.hits.hits.map(function (entry) { + var item = { + timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']), + id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'], + layerProtocol: entry._source['layer-protocol-name'], + suspectInterval: entry._source['suspect-interval-flag'], + scannerId: entry._source['scanner-id'], + rfTempMin: entry._source['performance-data']['rf-temp-min'], + rfTempAvg: entry._source['performance-data']['rf-temp-avg'], + rfTempMax: entry._source['performance-data']['rf-temp-max'], + radiosignal: entry._source['radio-signal-id'] + }; + + list.push(item); + + }); + $scope.temperature = list; + $scope.gridOptionsTemperature.totalItems = response.data.hits.total; + + break; + + case "snir": + var list = []; + + response.data.hits.hits.map(function (entry) { + var item = { + timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']), + id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'], + layerProtocol: entry._source['layer-protocol-name'], + suspectInterval: entry._source['suspect-interval-flag'], + scannerId: entry._source['scanner-id'], + snirMin: entry._source['performance-data']['snir-min'], + snirAvg: entry._source['performance-data']['snir-avg'], + snirMax: entry._source['performance-data']['snir-max'], + radiosignal: entry._source['radio-signal-id'] + }; + + list.push(item); + + }); + $scope.snir = list; + $scope.gridOptionsSnir.totalItems = response.data.hits.total; + + break; + + case "crossPolarDiscrimination": + var list = []; + + response.data.hits.hits.map(function (entry) { + var item = { + timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']), + id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'], + layerProtocol: entry._source['layer-protocol-name'], + suspectInterval: entry._source['suspect-interval-flag'], + scannerId: entry._source['scanner-id'], + xpdMin: entry._source['performance-data']['xpd-min'], + xpdAvg: entry._source['performance-data']['xpd-avg'], + xpdMax: entry._source['performance-data']['xpd-max'], + radiosignal: entry._source['radio-signal-id'] + + }; + + list.push(item); + + }); + $scope.crossPolarDiscrimination = list; + $scope.gridOptionsCrossPolarDiscrimination.totalItems = response.data.hits.total; + + break; + + + case "performanceEthernetContainer": + + var list = []; + + response.data.hits.hits.map(function (entry) { + var item = { + timestamp: $mwtnPerformanceHistory.formatTimeStamp(entry._source['time-stamp']), + id: $scope.onfNetworkElement.getLpById(entry._source['uuid-interface']).getLabel() || entry._source['uuid-interface'], + layerProtocol: entry._source['layer-protocol-name'], + suspectInterval: entry._source['suspect-interval-flag'], + scannerId: entry._source['scanner-id'], + period: entry._source['granularity-period'], + txEthernetBytesMaxS: checkData(entry._source['performance-data']['tx-ethernet-bytes-max-s']), + txEthernetBytesMaxM: checkData(entry._source['performance-data']['tx-ethernet-bytes-max-m']), + txEthernetBytesSum: checkData(entry._source['performance-data']['tx-ethernet-bytes-sum']) + + }; + + list.push(item); + + }); + $scope.performanceEthernetContainer = list; + $scope.gridOptionsPerformanceEthernetContainer.totalItems = response.data.hits.total; + + break; + } + }; + + var getData = function (sort, query, grid, currFilter, currSort) { + + // console.log(grid); + var pagesize; + var pagenr; + + switch (grid.data) { //get pagesize / nr according to current grid (else everything gets messy => wana get next page in grid a, get next page for grid b too) + case 'performance826': + pagesize = $scope.gridOptionsPerformance826.paginationPageSize; + pagenr = $scope.gridOptionsPerformance826.paginationCurrentPage; + break; + + case 'receiveLevel': + pagesize = $scope.gridOptionsReceiveLevel.paginationPageSize; + pagenr = $scope.gridOptionsReceiveLevel.paginationCurrentPage; + break; + + case 'transmissionLevel': + pagesize = $scope.gridOptionsTransmissionLevel.paginationPageSize; + pagenr = $scope.gridOptionsTransmissionLevel.paginationCurrentPage; + break; + + case 'modulation': + pagesize = $scope.gridOptionsModulation.paginationPageSize; + pagenr = $scope.gridOptionsModulation.paginationCurrentPage; + break; + + case 'temperature': + pagesize = $scope.gridOptionsTemperature.paginationPageSize; + pagenr = $scope.gridOptionsTemperature.paginationCurrentPage; + break; + + case 'snir': + pagesize = $scope.gridOptionsSnir.paginationPageSize; + pagenr = $scope.gridOptionsSnir.paginationCurrentPage; + break; + + case 'crossPolarDiscrimination': + pagesize = $scope.gridOptionsCrossPolarDiscrimination.paginationPageSize; + pagenr = $scope.gridOptionsCrossPolarDiscrimination.paginationCurrentPage; + break; + + case 'performanceEthernetContainer': + pagesize = $scope.gridOptionsPerformanceEthernetContainer.paginationPageSize; + pagenr = $scope.gridOptionsPerformanceEthernetContainer.paginationCurrentPage; + break; + + default: + $mwtnLog.warning({component: COMPONENT, message: ['Unexpected grid.data', grid.data, '!'].join(' ')}); + } + + if (grid !== undefined) { + + if ($scope.state.grid === null || $scope.state.grid === undefined) { + $scope.state.grid = grid.data; + } + + //check, if sort/filter params are for current grid + if ($scope.state.grid !== grid.data) { + $scope.state.sort = false; + $scope.state.lastSort = null; + $scope.state.filter = false; + $scope.state.lastfilter = null; + if (currSort !== null) { + sort = currSort; + } else { + sort = null; + } + + if (currFilter !== null) { + query = currFilter; + } else { + query = null; + } + + //update current grid + $scope.state.grid = grid.data; + } + } + + if (!sort) { //default sort value + sort = [{ 'time-stamp': { order: 'desc' } }]; + //sort=[]; + } + if (!query) { //default filter value + query = { query: { bool: { must: [{ prefix: globalFilter }] } } }; + } + + //add layer protocol selector to filter query + var localQuery = angular.copy(query); //copy the object for adding layerprotocol locally + var lpn = $scope.layerProtocol; + if (lpn === 'ETC' && $scope.revision.contains('2016')) lpn = 'ETH-CTP'; + localQuery.query.bool.must.push({ prefix: { "layer-protocol-name": lpn } }); + + //add interface selector to filter query + if ($scope.selecteditem.selectedLtpId) { + localQuery.query.bool.must.push({ prefix: { "uuid-interface": $scope.selecteditem.selectedLtpId } }); + } + + var selected15minPeriod = true; + if ($scope.selecteditem.timePeriod !== $scope.timePeriods[0]) selected15minPeriod = false; + console.warn('selected15minPeriod', selected15minPeriod); + return $mwtnPerformanceHistory.getFilteredSortedData((pagenr - 1) * pagesize, pagesize, sort, localQuery, selected15minPeriod); + }; + + /** + * function to calculate the current open tab + * @param status - Object of current tab opening information + * @param previousStatus - optional Object of previous tab opening information + * @return latest opened tab key or undefined, in case none is currently open + */ + var getKey = function(status, previousStatus) { + var result = Object.keys(status).filter(function(key){ + return status[key] === true && !(previousStatus && previousStatus[key]) + }); + if (result.length > 0) { + return result[0]; + } + } + + // events + $scope.status = { performance826: true, performanceEthernetContainer: false }; + $scope.spinner = {}; + + $scope.$watch(function() { + return $scope.selecteditem; + }, function (newValue, oldValue) { + console.warn('selecteditem###', newValue, oldValue, $scope.networkElementId ); + + if (newValue.selectedLtpId && newValue.selectedLtpId !== oldValue.selectedLtpId && $scope.onfNetworkElement) { + $scope.layerProtocol = $scope.onfNetworkElement.getLpById(newValue.selectedLtpId).getLayer(); + + $scope.performance826 = []; + $scope.receiveLevel = []; + $scope.transmissionLevel = []; + $scope.modulation = []; + $scope.temperature = []; + $scope.performanceEthernetContainer = []; + $scope.snir = []; + $scope.crossPolarDiscrimination = []; + $scope.jsonvalue = []; + + // if all tabs are closed - open first. + var isOneTabOpen = Object.keys($scope.status).filter(function(key){ + return $scope.status[key] === true; + }).length > 0; + if (!isOneTabOpen) { + $scope.status = { performance826: $scope.layerProtocol === 'MWPS', performanceEthernetContainer: $scope.layerProtocol === 'ETC' }; + } + } + + chooseGrid(getKey($scope.status)); + + }, true); + + + $scope.$watch('status', function (status, oldValue) { + console.warn('status', status, oldValue,$scope.networkElementId ); + if ($scope.networkElementId && status && status !== oldValue) { + chooseGrid(getKey(status, oldValue)); + } + }, true); + + + // $scope.$watch(function(){ + // $scope.selecteditem.timePeriod; + // }, function (newValue, oldValue) { + // console.warn('timePeriod', status, oldValue,$scope.networkElementId ); + // if (newValue && oldValue !== "" && newValue !== oldValue) { + // chooseGrid(getKey($scope.status)); + // } + // }, true); + + $scope.collapseAll = function () { + // close all groups + Object.keys($scope.status).map(function (group) { + $scope.status[group] = false; + }); + Object.keys($scope.spinner).map(function (group) { + $scope.spinner[group] = false; + }); + }; + + var order = $mwtnPerformanceHistory.layerProtocolNameOrder; + + /** + * @function updateNe + * A function, which updates onfNetworkElement by new data. + * @param {*} data New data recieved from OpenDaylight via RestConf + */ + var updateNe = function(data) { + if (!data) return; + // update onfNetworkElement + switch ($scope.revision) { + case '2016-08-09': + case '2016-08-11': + case '2016-09-01': + case '2017-02-17': + case '2017-03-20': + case '2017-03-24': + // console.log(JSON.stringify(data)); + $scope.onfNetworkElement = new OnfNetworkElement(data['network-element']); + $scope.onfLtps = $scope.onfNetworkElement.getLogicalTerminationPoints().filter(function(ltp){ + return ltp.getLayer() === 'MWPS' || ltp.getLayer() === 'ETC'; + }).sort(function(a, b){ + if(order[a.getLayer()] < order[b.getLayer()]) return 1; + if(order[a.getLayer()] > order[b.getLayer()]) return -1; + if(a.getId() < b.getId()) return -1; + if(a.getId() > b.getId()) return 1; + return 0; + }); + $scope.availableLtpIds = $scope.onfLtps.map(function(ltp){ + return {key: ltp.getLayerProtocols()[0].getId(), label:ltp.getLabel()}; + }); + if ($scope.availableLtpIds.length > 0) { + $scope.selecteditem.selectedLtpId = $scope.availableLtpIds[0].key; + } + break; + default: + $mwtnLog.info({component: COMPONENT, message: ['The ONF Microwave Model revision', $scope.revision, ' is not supported (yet)!'].join(' ')}); + $scope.onfNetworkElement = {}; + $scope.onfLtps = {}; + } + }; + + var updatePart = function(spec, data) { + switch (spec.pacId) { + case 'ne': + updateNe(data); + break; + } + }; + + //get data on ne selection + $scope.$watch('networkElement', function (neId, oldValue) { + console.warn('networkElement', neId, oldValue,$scope.networkElementId ); + + if (neId && neId !== '' && neId !== oldValue) { + $scope.selecteditem.selectedLtpId = undefined; + var revision; + $scope.networkElements.map(function (ne) { + if (ne.id === neId) revision = ne.revision; + }); + $scope.networkElementId = neId; + $scope.revision = revision; + + //get data + var filter = { "query": { "bool": { "must": [{ "prefix": { "node-name": $scope.networkElementId } }] } } }; + // var filter={"query":{"bool":{"must":[{"prefix":{"node-name": "new"}}]}}}; //first part of my local simulator name + globalFilter = filter.query.bool.must[0].prefix; + $scope.state.filter = true; + $scope.state.lastfilter = filter; + $scope.state.sort = false; + $scope.state.lastSort = null; + + // get onf network element data + var spec = { + nodeId: $scope.networkElementId, + revision: $scope.revision, + pacId: 'ne' + }; + console.warn('PM HIstory getPacPMHistory', JSON.stringify(spec)); + $mwtnPerformanceHistory.getPacParts(spec).then(function(success){ + $scope.collapseAll(); + // console.warn('PM HIstory getPacPMHistory', JSON.stringify(success)); + updatePart(spec, $mwtnPerformanceHistory.yangifyObject(success)); + }, function(error){ + console.error(JSON.stringify(error)); + $scope.collapseAll(); + updatePart(spec, error); + }); + } + }); + + var chooseGrid = function (key) { + if (!$scope.networkElementId || !key) return; + + switch (key) { + + case 'performance826': + getData(null, null, $scope.gridOptionsPerformance826).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, $scope.gridOptionsPerformance826); + } + }); + break; + + case 'receiveLevel': + getData(null, null, $scope.gridOptionsReceiveLevel).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, $scope.gridOptionsReceiveLevel); + } + }); + break; + + case 'transmissionLevel': + getData(null, null, $scope.gridOptionsTransmissionLevel).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, $scope.gridOptionsTransmissionLevel); + } + }); + break; + + case 'modulation': + getData(null, null, $scope.gridOptionsModulation).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, $scope.gridOptionsModulation); + } + }); + break; + + case 'temperature': + getData(null, null, $scope.gridOptionsTemperature).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, $scope.gridOptionsTemperature); + } + }); + break; + + case 'snir': + getData(null, null, $scope.gridOptionsSnir).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, $scope.gridOptionsSnir); + } + }); + break; + + case 'crossPolarDiscrimination': + getData(null, null, $scope.gridOptionsCrossPolarDiscrimination).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, $scope.gridOptionsCrossPolarDiscrimination); + } + }); + break; + + case 'performanceEthernetContainer': + getData(null, null, $scope.gridOptionsPerformanceEthernetContainer).then(function (response) { + if (response.data.hits.hits) { + processRequestInGrid(response, $scope.gridOptionsPerformanceEthernetContainer); + } + }); + break; + } + $window.dispatchEvent(new Event("resize")); + }; + }]); + }); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.module.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.module.js new file mode 100644 index 00000000..4199ae62 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.module.js @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2016 highstreet technologies GmbH and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +define(['angularAMD', + 'app/routingConfig', + 'app/core/core.services', + 'common/config/env.module', + 'app/mwtnCommons/mwtnCommons.module'], function(ng) { + var mwtnPerformanceHistoryApp = angular.module('app.mwtnPerformanceHistory', ['ui.grid', 'ui.bootstrap', 'app.core', 'ui.router.state', 'config', 'ui.router.state','ui.grid.exporter', + 'ui.grid.moveColumns', 'ui.grid.pinning', 'ui.grid.selection', + 'ui.grid.resizeColumns', 'ui.grid.pagination']); + + mwtnPerformanceHistoryApp.config(function($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $translateProvider) { + mwtnPerformanceHistoryApp.register = { + controller : $controllerProvider.register, + directive : $compileProvider.directive, + factory : $provide.factory, + service : $provide.service + + }; + + NavHelperProvider.addControllerUrl('app/mwtnPerformanceHistory/mwtnPerformanceHistory.controller'); + NavHelperProvider.addToMenu('mwtnPerformanceHistory', { + "link" : "#/pnfPerformanceHistory/", + "active" : "main.mwtnPerformanceHistory", + "title" : "pnf PM History", + "icon" : "fa fa-bar-chart", // Add navigation icon css class here + "page" : { + "title" : "pnf PM History", + "description" : "mwtnHistoricalPerformance" + } + }); + + var access = routingConfig.accessLevels; + + $stateProvider.state('main.mwtnPerformanceHistory', { + url: 'pnfPerformanceHistory/:nodeId', + access: access.admin, + views : { + 'content' : { + templateUrl: 'src/app/mwtnPerformanceHistory/mwtnPerformanceHistory.tpl.html', + controller: 'mwtnPerformanceHistoryCtrl' + } + } + }); + + }); + + return mwtnPerformanceHistoryApp; +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.services.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.services.js new file mode 100644 index 00000000..94aeb935 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.services.js @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2016 HCL Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +define(['app/mwtnCommons/mwtnCommons.module', 'app/mwtnPerformanceHistory/mwtnPerformanceHistory.module'], function (mwtnPerformanceHistoryoryApp) { + + mwtnPerformanceHistoryoryApp.register.factory('$mwtnPerformanceHistory', function ($q, $mwtnCommons, $mwtnDatabase, $mwtnLog) { + + var COMPONENT = '$mwtnPerformanceHistory'; + $mwtnLog.info({ component: COMPONENT, message: '$mwtnPerformanceHistory started!' }); + + var service = {}; + service.formatTimeStamp = $mwtnCommons.formatTimeStamp; + service.getMountPoints = $mwtnCommons.getMountPoints; + service.getPacParts = $mwtnCommons.getPacParts; + service.layerProtocolNameOrder = $mwtnCommons.layerProtocolNameOrder; + + service.yangifyObject = $mwtnCommons.yangifyObject; + + service.TimeStampToONFFormat = function (timestamp) { + timestamp = timestamp.split('-').join(''); + timestamp = timestamp.split(':').join(''); + timestamp = timestamp.split(' ').join(''); + timestamp = timestamp.replace('UTC', 'Z'); + return timestamp; + }; + + service.getFilteredSortedData = function (from, size, sort, query, selected15minPeriod) { + var func = function () { + if (selected15minPeriod) { + return $mwtnDatabase.getFilteredSortedData('sdnperformance', 'historicalperformance15min', from, size, sort, query); + } else { + return $mwtnDatabase.getFilteredSortedData('sdnperformance', 'historicalperformance24h', from, size, sort, query); + } + }; + var deferred = $q.defer(); + func().then(function (success) { + deferred.resolve(success); + }, function (error) { + $mwtnLog.error({ component: '$mwtnHistPerformance.getFilteredSortedData', message: JSON.stringify(error.data) }); + deferred.reject(error) + }); + return deferred.promise; + + }; + + return service; + }); + +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.tpl.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.tpl.html new file mode 100644 index 00000000..bb5f6e46 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/mwtnPerformanceHistory-module/src/main/resources/mwtnPerformanceHistory/mwtnPerformanceHistory.tpl.html @@ -0,0 +1,127 @@ +<ht-header help-link='sdnr/pnfPerformance/0.4.0/README.md'></ht-header> +<mwtn-select-network-element></mwtn-select-network-element> + +<div class="owl container" ng-if="networkElements.lenght !== 0 && networkElement" style="width: 100%"> + + <div class="row" ng-show="networkElements.lenght !== 0"> + <div class="col-md-3"> + <div class="form-group"> + <select class="form-control" ng-model="selecteditem.selectedLtpId"> + <option ng-repeat="ltp in availableLtpIds" value="{{ltp.key}}">{{ltp.label}}</option> + </select> + </div> + </div> + <div class="col-md-3"> + <span class="white">{{'MWTN_SELECT_LTP' | translate }}</span> + </div> + <div class="col-md-2"> + <div class="form-group"> + <select class="form-control" ng-model="selecteditem.timePeriod"> + <option ng-repeat="time in timePeriods">{{time}}</option> + </select> + </div> + </div> + <div class="col-md-2"> + <span class="white">{{'MWTN_TIME_PERIOD' | translate}}</span> + </div> + </div> + + <div class="row" ng-show="selecteditem.selectedLtpId"> + <div class="col-md-12"> + <uib-accordion close-others="true"> + <div uib-accordion-group class="panel-primary" is-open="status.performance826" ng-show="layerProtocol==='MWPS'"> + <uib-accordion-heading> <i class="pull-left fa" ng-class="{'fa-chevron-down': status.performance826, 'fa-chevron-right': !status.performance826}"></i> + <span>Performance Data G.826</span> + <i class="pull-right fa fa-spinner fa-pulse" ng-show="spinner.performance826"></i> + </uib-accordion-heading> + + <div id="mwtnFaultGridAlarmLog" ui-grid="gridOptionsPerformance826" ui-grid-pagination ui-grid-exporter ui-grid-selection + ui-grid-pinning ui-grid-resize-columns ui-grid-move-columns class="mwtnHistoryGrid"> + </div> + </div> + <div uib-accordion-group class="panel-primary" is-open="status.receiveLevel" ng-show="layerProtocol==='MWPS'"> + <uib-accordion-heading> <i class="pull-left fa" ng-class="{'fa-chevron-down': status.receiveLevel, 'fa-chevron-right': !status.receiveLevel}"></i> + <span>Receive Level</span> + <i class="pull-right fa fa-spinner fa-pulse" ng-show="spinner.receiveLevel"></i> + </uib-accordion-heading> + + <div ui-grid="gridOptionsReceiveLevel" ui-grid-pagination ui-grid-exporter ui-grid-selection ui-grid-pinning ui-grid-resize-columns + ui-grid-move-columns class="mwtnHistoryGrid"> + </div> + + </div> + <div uib-accordion-group class="panel-primary" is-open="status.transmissionLevel" ng-show="layerProtocol==='MWPS'"> + <uib-accordion-heading> <i class="pull-left fa" ng-class="{'fa-chevron-down': status.transmissionLevel, 'fa-chevron-right': !status.transmissionLevel}"></i> + <span>Transmission Power</span> + <i class="pull-right fa fa-spinner fa-pulse" ng-show="spinner.transmissionLevel"></i> + </uib-accordion-heading> + + <div ui-grid="gridOptionsTransmissionLevel" ui-grid-pagination ui-grid-exporter ui-grid-selection ui-grid-pinning ui-grid-resize-columns + ui-grid-move-columns class="mwtnHistoryGrid"> + </div> + + </div> + <div uib-accordion-group class="panel-primary" is-open="status.modulation" ng-show="layerProtocol==='MWPS'"> + <uib-accordion-heading> <i class="pull-left fa" ng-class="{'fa-chevron-down': status.modulation, 'fa-chevron-right': !status.modulation}"></i> + <span>Adaptive Modulation</span> + <i class="pull-right fa fa-spinner fa-pulse" ng-show="spinner.modulation"></i> + </uib-accordion-heading> + + <div ui-grid="gridOptionsModulation" ui-grid-pagination ui-grid-exporter ui-grid-selection ui-grid-pinning ui-grid-resize-columns + ui-grid-move-columns class="mwtnHistoryGrid"> + </div> + + </div> + <div uib-accordion-group class="panel-primary" is-open="status.temperature" ng-show="layerProtocol==='MWPS'"> + <uib-accordion-heading> <i class="pull-left fa" ng-class="{'fa-chevron-down': status.temperature, 'fa-chevron-right': !status.temperature}"></i> + <span>Temperature</span> + <i class="pull-right fa fa-spinner fa-pulse" ng-show="spinner.temperature"></i> + </uib-accordion-heading> + + <div ui-grid="gridOptionsTemperature" ui-grid-pagination ui-grid-exporter ui-grid-selection ui-grid-pinning ui-grid-resize-columns + ui-grid-move-columns class="mwtnHistoryGrid"> + </div> + + </div> + <div uib-accordion-group class="panel-primary" is-open="status.snir" ng-show="layerProtocol==='MWPS'"> + <uib-accordion-heading> <i class="pull-left fa" ng-class="{'fa-chevron-down': status.snir, 'fa-chevron-right': !status.snir}"></i> + <span>{{'MWTN_SINR' | translate}}</span> + <i class="pull-right fa fa-spinner fa-pulse" ng-show="spinner.snir"></i> + </uib-accordion-heading> + + <div ui-grid="gridOptionsSnir" ui-grid-pagination ui-grid-exporter ui-grid-selection ui-grid-pinning ui-grid-resize-columns + ui-grid-move-columns class="mwtnHistoryGrid"> + </div> + + </div> + <div uib-accordion-group class="panel-primary" is-open="status.crossPolarDiscrimination" ng-show="layerProtocol==='MWPS'"> + <uib-accordion-heading> <i class="pull-left fa" ng-class="{'fa-chevron-down': status.crossPolarDiscrimination, 'fa-chevron-right': !status.crossPolarDiscrimination}"></i> + <span>Cross Polar Discrimination</span> + <i class="pull-right fa fa-spinner fa-pulse" ng-show="spinner.crossPolarDiscrimination"></i> + </uib-accordion-heading> + + <div ui-grid="gridOptionsCrossPolarDiscrimination" ui-grid-pagination ui-grid-exporter ui-grid-selection ui-grid-pinning ui-grid-resize-columns + ui-grid-move-columns class="mwtnHistoryGrid"> + </div> + + </div> + + <div uib-accordion-group class="panel-primary" is-open="status.performanceEthernetContainer" ng-show="layerProtocol==='ETC'"> + <uib-accordion-heading> <i class="pull-left fa" ng-class="{'fa-chevron-down': status.performanceEthernetContainer, 'fa-chevron-right': !status.performanceEthernetContainer}"></i> + <span>Performance Data</span> + <i class="pull-right fa fa-spinner fa-pulse" ng-show="spinner.performanceEthernetContainer"></i> + </uib-accordion-heading> + + <div ui-grid="gridOptionsPerformanceEthernetContainer" ui-grid-pagination ui-grid-exporter ui-grid-selection ui-grid-pinning ui-grid-resize-columns + ui-grid-auto-resize ui-grid-move-columns class="mwtnHistoryGrid"> + </div> + </div> + + </uib-accordion> + </div> + </div> +</div> +<hr /> +<div class="owl"> + <span class="white">ONAP SDN-R | ONF Wireless for @distversion@ - Build: @buildtime@</span> +</div>
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/pom.xml new file mode 100644 index 00000000..2d6ced8c --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnPerformanceHistory/pom.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <artifactId>mwtn</artifactId> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <version>0.5.1-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + <packaging>pom</packaging> + <groupId>com.highstreet.technologies.odl.dlux</groupId> + <artifactId>mwtnPerformanceHistory</artifactId> + <version>0.5.1-SNAPSHOT</version> + <name>${prefix} ${project.artifactId}</name> + + <prerequisites> + <maven>3.0</maven> + </prerequisites> + + <modules> + <module>mwtnPerformanceHistory-module</module> + <module>mwtnPerformanceHistory-bundle</module> + </modules> +</project> |