From 27fb2d06608fbb070ae2c15a5580a4f5b2423d15 Mon Sep 17 00:00:00 2001 From: demx8as6 Date: Tue, 10 Jul 2018 18:07:44 +0200 Subject: Add seed code for sdnr app based on ONF Centennial At this point in time all the Carbon code from ONF Centennial is added to ONAP. Later it needs to be refactored and modified for ODL Oxygen. Change-Id: Iff85dd940c05c3827f1c4e6f9542ecd060c58a46 Issue-ID: SDNC-374 Signed-off-by: demx8as6 --- .../ux/mwtnLog/mwtnLog-bundle/pom.xml | 115 ++++++++++++++++ .../resources/OSGI-INF/blueprint/blueprint.xml | 19 +++ .../ux/mwtnLog/mwtnLog-module/pom.xml | 14 ++ .../src/main/resources/mwtnLog/images/mwtnLog.png | Bin 0 -> 2261 bytes .../src/main/resources/mwtnLog/mwtnLog-custom.css | 58 ++++++++ .../main/resources/mwtnLog/mwtnLog.controller.js | 151 +++++++++++++++++++++ .../src/main/resources/mwtnLog/mwtnLog.module.js | 56 ++++++++ .../src/main/resources/mwtnLog/mwtnLog.services.js | 40 ++++++ .../src/main/resources/mwtnLog/mwtnLog.tpl.html | 26 ++++ .../templates/clearLogConfirmation.tpl.html | 12 ++ .../code-Carbon-SR1/ux/mwtnLog/pom.xml | 24 ++++ 11 files changed, 515 insertions(+) create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-bundle/pom.xml create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/pom.xml create mode 100755 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/images/mwtnLog.png create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog-custom.css create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.controller.js create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.module.js create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.services.js create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.tpl.html create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/templates/clearLogConfirmation.tpl.html create mode 100644 sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/pom.xml (limited to 'sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog') diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-bundle/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-bundle/pom.xml new file mode 100644 index 00000000..ab98f462 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-bundle/pom.xml @@ -0,0 +1,115 @@ + + + 4.0.0 + + mwtnLog + com.highstreet.technologies.odl.dlux + 0.5.1-SNAPSHOT + + mwtnLog-bundle + bundle + ${prefix} ${project.artifactId} + + + org.osgi + org.osgi.core + ${osgi.core.version} + + + org.osgi + org.osgi.compendium + ${osgi.core.version} + + + org.apache.felix + org.osgi.compendium + ${apache.felix.compendium} + + + org.opendaylight.dlux + loader + ${dlux.loader.version} + + + com.highstreet.technologies.odl.dlux + mwtnLog-module + 0.5.1-SNAPSHOT + + + + + + target/generated-resources + + + src/main/resources + + + + + org.apache.maven.plugins + maven-dependency-plugin + 2.6 + + + + unpack-loader-resources + + unpack-dependencies + + generate-resources + + ${project.build.directory}/generated-resources + com.highstreet.technologies.odl.dlux + mwtnLog-module + META-INF\/** + true + false + + + + + + org.apache.felix + maven-bundle-plugin + true + + + org.osgi.service.http, + org.osgi.framework;version="1.0.0", + org.opendaylight.dlux.loader + + + + + + + + + diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml new file mode 100644 index 00000000..cf298447 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + src/app/mwtnLog/mwtnLog-custom.css + + + + \ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/pom.xml new file mode 100644 index 00000000..72264b86 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + + mwtnLog + com.highstreet.technologies.odl.dlux + 0.5.1-SNAPSHOT + + mwtnLog-module + ${prefix} ${project.artifactId} + jar + \ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/images/mwtnLog.png b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/images/mwtnLog.png new file mode 100755 index 00000000..8d0bcad5 Binary files /dev/null and b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/images/mwtnLog.png differ diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog-custom.css b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog-custom.css new file mode 100644 index 00000000..47c5864d --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog-custom.css @@ -0,0 +1,58 @@ +/** + * Add your application related css here + */ +.owl .uib-tab a { + border: 1px solid #000; + background-color: white; + color: #3276b1; +} + +.owl .uib-tab.active a { + background-color: #3276b1; + color: white; +} + +.mwtnLogGrid { + height: 600px; + background-color: white; +} + +.mwtnLogGrid span { + color: #393939; +} + +.mwtnLogGrid div.debug { + color: #393939; + background-color: white; +} +.mwtnLogGrid div.error { + color: #ff0000; + background-color: #ffeeee; + font-weight: bold; +} + +.mwtnLogGrid div.info { + color: #3276b1; + background-color: #eeeeff; +} + +.mwtnLogGrid div.warning { + color: #ffa500; + background-color: #ffeedd; +} + +.rotated { + transform: rotate(180deg); + -webkit-transform: rotate(180deg); + -ms-transform: rotate(180deg); + -moz-transform: rotate(180deg); + -o-transform: rotate(180deg); +} + +h3.modal-title { + color: #393939; +} + +.modal-body span { + color: #393939; +} \ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.controller.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.controller.js new file mode 100644 index 00000000..c4135e6b --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.controller.js @@ -0,0 +1,151 @@ +/* + * 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(['app/mwtnLog/mwtnLog.module', + 'app/mwtnLog/mwtnLog.services', + 'app/mwtnCommons/mwtnCommons.module'], + function(mwtnLogApp) { + + mwtnLogApp.register.controller('mwtnLogCtrl', ['uiGridConstants', '$uibModal', '$scope', '$rootScope', '$mwtnCommons', '$mwtnLogView', '$mwtnLog' , + function(uiGridConstants, $uibModal, $scope, $rootScope, $mwtnCommons, $mwtnLogView, $mwtnLog) { + + var COMPONENT = 'mwtnLogCtrl'; + $mwtnLog.info({component: COMPONENT, message: 'mwtnLogCtrl started!'}); + // $mwtnLog.error({component: COMPONENT, message: 'Just a test of logging an error.'}); + // $mwtnLog.warning({component: COMPONENT, message: 'Just a test of logging a warning.'}); + // $mwtnLog.debug({component: COMPONENT, message: 'Just a test of logging debug information.'}); + + $rootScope.section_logo = 'src/app/mwtnLog/images/mwtnLog.png'; // Add your topbar logo location here such as 'assets/images/logo_topology.gif' + + $scope.highlightFilteredHeader = $mwtnLogView.highlightFilteredHeader; + + var rowTemplate = '
'; + var iconCell = '
'; + + $scope.gridOptions = JSON.parse(JSON.stringify($mwtnLogView.gridOptions)); + $scope.gridOptions.rowTemplate = rowTemplate; + $scope.gridOptions.columnDefs = [ + // { field: 'id', type: 'number', displayName: 'No.', headerCellClass: $scope.highlightFilteredHeader, width : 50, cellClass: 'number', pinnedLeft : true }, + { field: 'icon', type: 'string', displayName: '', headerCellClass: $scope.highlightFilteredHeader, width: 25, enableSorting: false, enableFiltering:false, cellTemplate: iconCell }, + { field: 'timestamp', type: 'string', displayName: 'Timestamp', headerCellClass: $scope.highlightFilteredHeader, width : 200,sort: { + direction: uiGridConstants.DESC, + priority: 1 + } }, + { field: 'type', type: 'string', displayName: 'Type', headerCellClass: $scope.highlightFilteredHeader, width: 70 }, + { field: 'component', type: 'string', displayName: 'Component', headerCellClass: $scope.highlightFilteredHeader, width : 200 }, + { field: 'message', type: 'string', displayName: 'Message', headerCellClass: $scope.highlightFilteredHeader, width : 500 } + ]; + + $scope.progress = { + show: true, + max: 200, + value: 160 + }; + + $scope.clearLog = function () { + + var modalInstance = $uibModal.open({ + animation: true, + ariaLabelledBy: 'modal-title', + ariaDescribedBy: 'modal-body', + templateUrl: 'src/app/mwtnLog/templates/clearLogConfirmation.tpl.html', + controller: 'ClearLogCtrl', + size: 'lg', + resolve: { + now: function () { + return new Date().toISOString(); + } + } + }); + + modalInstance.result.then(function () { + var spec = { + functionId : 'mwtn', + docType : 'log', + query: { + match_all: {} + } + }; + $mwtnLogView.deleteDocType(spec).then(function(deleted){ + $scope.gridOptions.data = []; + $mwtnLog.info({component: COMPONENT, message: 'Log cleared!'}); + }, function(error){ + $mwtnLog.error({component: COMPONENT, message:JSON.stringify(error)}); + }); + }, function () { + $mwtnLog.info({component: COMPONENT, message: 'Mount dismissed!'}); + }); + }; + + var getIconFromType = function(type) { + var mapping = { + debug : '', + info : 'fa-info-circle', + warning : 'fa-exclamation-triangle', + error : 'fa-times-circle' + }; + return mapping[type]; + }; + + var processLogEntries = function(logEntries) { + if (logEntries.data.hits.hits) { + logEntries.data.hits.hits.map(function(entry){ + var log = { + id: entry._id, + icon: getIconFromType(entry._source.type), + timestamp: entry._source.timestamp, + type: entry._source.type, + component: entry._source.component, + message: entry._source.message, + }; + $scope.gridOptions.data.push(log); + }); + $scope.progress.max = logEntries.data.hits.total; + $scope.progress.value = $scope.gridOptions.data.length; + $scope.progress.show = $scope.gridOptions.data.length < logEntries.data.hits.total; + } + }; + + $scope.refreshLog = function() { + $scope.gridOptions.data = []; + var from = 0; + var size = 100; + $scope.processing = true; + $mwtnLogView.getAllLogEntries(from, size).then(function(logEntries){ + $scope.processing = false; + processLogEntries(logEntries); + from = from + size; + while (from < $scope.progress.max) { + $mwtnLogView.getAllLogEntries(from, size).then(function(logEntries){ + processLogEntries(logEntries); + }, function(error){ + console.error(JSON.stringify(error)); + }); + from = from + size; + } + }, function(error){ + console.error(JSON.stringify(error)); + }); + }; + $scope.refreshLog(); + + }]); + + mwtnLogApp.register.controller('ClearLogCtrl', ['$scope', '$uibModalInstance', + function ($scope, $uibModalInstance) { + + $scope.ok = function () { + $uibModalInstance.close('ok'); + }; + + $scope.cancel = function () { + $uibModalInstance.dismiss('cancel'); + }; + }]); + +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.module.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.module.js new file mode 100644 index 00000000..faece4fc --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.module.js @@ -0,0 +1,56 @@ +/* + * 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 mwtnLogApp = angular.module('app.mwtnLog', ['ui.grid', 'ui.bootstrap', 'app.core', + 'ui.router.state', 'config', 'ui.grid.exporter', + 'ui.grid.moveColumns', 'ui.grid.pinning', 'ui.grid.selection', + 'ui.grid.resizeColumns' ]); + + mwtnLogApp.config(function($stateProvider, $compileProvider, $controllerProvider, $provide, NavHelperProvider, $translateProvider) { + mwtnLogApp.register = { + controller : $controllerProvider.register, + directive : $compileProvider.directive, + factory : $provide.factory, + service : $provide.service + }; + + + NavHelperProvider.addControllerUrl('app/mwtnLog/mwtnLog.controller'); + NavHelperProvider.addToMenu('mwtnLog', { + "link" : "#/mwtnLog", + "active" : "main.mwtnLog", + "title" : "Logs", + "icon" : "fa fa-list", // Add navigation icon css class here + "page" : { + "title" : "Logs", + "description" : "mwtnLog" + } + }); + + var access = routingConfig.accessLevels; + + $stateProvider.state('main.mwtnLog', { + url: 'mwtnLog', + access: access.admin, + views : { + 'content' : { + templateUrl: 'src/app/mwtnLog/mwtnLog.tpl.html', + controller: 'mwtnLogCtrl' + } + } + }); + + }); + + return mwtnLogApp; +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.services.js b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.services.js new file mode 100644 index 00000000..ef900e2a --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.services.js @@ -0,0 +1,40 @@ +/* + * 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(['app/mwtnLog/mwtnLog.module','app/mwtnCommons/mwtnCommons.services'],function(mwtnLogApp) { + + mwtnLogApp.register.factory('$mwtnLogView', function($q, $mwtnCommons, $mwtnDatabase, $mwtnLog) { + + var service = {}; + + service.checkModules = $mwtnCommons.checkModules; + service.highlightFilteredHeader = $mwtnCommons.highlightFilteredHeader; + service.gridOptions = $mwtnCommons.gridOptions; + service.formatTimeStamp = $mwtnCommons.formatTimeStamp; + service.deleteDocType = $mwtnDatabase.deleteDocType; + + + service.getAllLogEntries = function(from, size) { + var sort = [ { + timestamp : { + order : 'desc' + } + }]; + var deferred = $q.defer(); + $mwtnDatabase.getAllData('mwtn', 'log', from, size, sort).then(function(success){ + deferred.resolve(success); + }, function(error){ + $mwtnLog.error({component: '$mwtnLogView.getAllLogEntries', message: JSON.stringify(error.data)}); + deferred.reject(error); + }); + return deferred.promise; + }; + + return service; + }); +}); diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.tpl.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.tpl.html new file mode 100644 index 00000000..f20f154b --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/mwtnLog.tpl.html @@ -0,0 +1,26 @@ + +
+ {{progress.value}} / {{progress.max}} + +
+
+ + + +
+ +
+
+ ONAP SDN-R | ONF Wireless for @distversion@ - Build: @buildtime@ +
\ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/templates/clearLogConfirmation.tpl.html b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/templates/clearLogConfirmation.tpl.html new file mode 100644 index 00000000..cdd87c6a --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/mwtnLog-module/src/main/resources/mwtnLog/templates/clearLogConfirmation.tpl.html @@ -0,0 +1,12 @@ + + + + \ No newline at end of file diff --git a/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/pom.xml b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/pom.xml new file mode 100644 index 00000000..ebae8300 --- /dev/null +++ b/sdnr/wireless-transport/code-Carbon-SR1/ux/mwtnLog/pom.xml @@ -0,0 +1,24 @@ + + + 4.0.0 + + mwtn + com.highstreet.technologies.odl.dlux + 0.5.1-SNAPSHOT + + pom + com.highstreet.technologies.odl.dlux + mwtnLog + 0.5.1-SNAPSHOT + ${prefix} ${project.artifactId} + + + 3.0 + + + + mwtnLog-module + mwtnLog-bundle + + \ No newline at end of file -- cgit 1.2.3-korg