summaryrefslogtreecommitdiffstats
path: root/ecomp-portal-widget-ms
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-portal-widget-ms')
-rw-r--r--ecomp-portal-widget-ms/common-widgets/events-widget/js/controller.js22
-rw-r--r--ecomp-portal-widget-ms/common-widgets/news-widget/js/controller.js22
-rw-r--r--ecomp-portal-widget-ms/common-widgets/pom.xml34
-rw-r--r--ecomp-portal-widget-ms/common-widgets/resources-widget/js/controller.js22
-rw-r--r--ecomp-portal-widget-ms/pom.xml34
-rw-r--r--ecomp-portal-widget-ms/widget-ms/pom.xml34
-rw-r--r--ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js106
7 files changed, 165 insertions, 109 deletions
diff --git a/ecomp-portal-widget-ms/common-widgets/events-widget/js/controller.js b/ecomp-portal-widget-ms/common-widgets/events-widget/js/controller.js
index 8ccebeee..3298432b 100644
--- a/ecomp-portal-widget-ms/common-widgets/events-widget/js/controller.js
+++ b/ecomp-portal-widget-ms/common-widgets/events-widget/js/controller.js
@@ -15,27 +15,7 @@ function EventsCtrl($rootScope, applicationsService , $log,
$scope.editData = JSON.stringify(availableData);
$scope.availableDataTemp = $scope.availableData;
- ngDialog.open({
- templateUrl : 'app/views/dashboard/dashboard-widget-manage.html',
- controller : 'CommonWidgetController',
- resolve : {
- message : function message() {
- var message = {
- type : resourceType,
- availableData : $scope.editData
- };
- return message;
- }
- }
- }).closePromise.then(needUpdate => {
- if(resourceType=='NEWS'){
- $scope.updateNews();
- }else if(resourceType=='EVENTS'){
- $scope.updateEvents();
- }else if(resourceType=='IMPORTANTRESOURCES'){
- $scope.updateImportRes();
- }
- });
+
};
/*Setting News data*/
$scope.eventData = [];
diff --git a/ecomp-portal-widget-ms/common-widgets/news-widget/js/controller.js b/ecomp-portal-widget-ms/common-widgets/news-widget/js/controller.js
index 13133339..b5880c0e 100644
--- a/ecomp-portal-widget-ms/common-widgets/news-widget/js/controller.js
+++ b/ecomp-portal-widget-ms/common-widgets/news-widget/js/controller.js
@@ -16,27 +16,7 @@ function NewsCtrl($rootScope, applicationsService , $log,
$scope.editData = JSON.stringify(availableData);
$scope.availableDataTemp = $scope.availableData;
- ngDialog.open({
- templateUrl : 'app/views/dashboard/dashboard-widget-manage.html',
- controller : 'CommonWidgetController',
- resolve : {
- message : function message() {
- var message = {
- type : resourceType,
- availableData : $scope.editData
- };
- return message;
- }
- }
- }).closePromise.then(needUpdate => {
- if(resourceType=='NEWS'){
- $scope.updateNews();
- }else if(resourceType=='EVENTS'){
- $scope.updateEvents();
- }else if(resourceType=='IMPORTANTRESOURCES'){
- $scope.updateImportRes();
- }
- });
+
};
/*Setting News data*/
diff --git a/ecomp-portal-widget-ms/common-widgets/pom.xml b/ecomp-portal-widget-ms/common-widgets/pom.xml
index 6a6d54bd..a5b51bf6 100644
--- a/ecomp-portal-widget-ms/common-widgets/pom.xml
+++ b/ecomp-portal-widget-ms/common-widgets/pom.xml
@@ -72,8 +72,40 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.7.6.201602180812</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <inherited>True</inherited>
+ <executions>
+ <!-- Unit-Tests -->
+ <execution>
+ <id>prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <phase>test</phase>
+ <configuration>
+ <destFile>${sonar.jacoco.reportPath}</destFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>report</id>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <phase>test</phase>
+ <configuration>
+ <dataFile>${sonar.jacoco.reportPath}</dataFile>
+ <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
-
</build>
</project>
diff --git a/ecomp-portal-widget-ms/common-widgets/resources-widget/js/controller.js b/ecomp-portal-widget-ms/common-widgets/resources-widget/js/controller.js
index 13133339..b5880c0e 100644
--- a/ecomp-portal-widget-ms/common-widgets/resources-widget/js/controller.js
+++ b/ecomp-portal-widget-ms/common-widgets/resources-widget/js/controller.js
@@ -16,27 +16,7 @@ function NewsCtrl($rootScope, applicationsService , $log,
$scope.editData = JSON.stringify(availableData);
$scope.availableDataTemp = $scope.availableData;
- ngDialog.open({
- templateUrl : 'app/views/dashboard/dashboard-widget-manage.html',
- controller : 'CommonWidgetController',
- resolve : {
- message : function message() {
- var message = {
- type : resourceType,
- availableData : $scope.editData
- };
- return message;
- }
- }
- }).closePromise.then(needUpdate => {
- if(resourceType=='NEWS'){
- $scope.updateNews();
- }else if(resourceType=='EVENTS'){
- $scope.updateEvents();
- }else if(resourceType=='IMPORTANTRESOURCES'){
- $scope.updateImportRes();
- }
- });
+
};
/*Setting News data*/
diff --git a/ecomp-portal-widget-ms/pom.xml b/ecomp-portal-widget-ms/pom.xml
index d2c72fb3..52d73821 100644
--- a/ecomp-portal-widget-ms/pom.xml
+++ b/ecomp-portal-widget-ms/pom.xml
@@ -26,6 +26,40 @@
<skip>true</skip>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.7.6.201602180812</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <inherited>True</inherited>
+ <executions>
+ <!-- Unit-Tests -->
+ <execution>
+ <id>prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <phase>test</phase>
+ <configuration>
+ <destFile>${sonar.jacoco.reportPath}</destFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>report</id>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <phase>test</phase>
+ <configuration>
+ <dataFile>${sonar.jacoco.reportPath}</dataFile>
+ <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/ecomp-portal-widget-ms/widget-ms/pom.xml b/ecomp-portal-widget-ms/widget-ms/pom.xml
index b421ebd5..45da5d57 100644
--- a/ecomp-portal-widget-ms/widget-ms/pom.xml
+++ b/ecomp-portal-widget-ms/widget-ms/pom.xml
@@ -162,6 +162,40 @@
<skip>true</skip>
</configuration>
</plugin>
+
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.7.6.201602180812</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ <inherited>True</inherited>
+ <executions>
+ <!-- Unit-Tests -->
+ <execution>
+ <id>prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ <phase>test</phase>
+ <configuration>
+ <destFile>${sonar.jacoco.reportPath}</destFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>report</id>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ <phase>test</phase>
+ <configuration>
+ <dataFile>${sonar.jacoco.reportPath}</dataFile>
+ <outputDirectory>${project.basedir}/target/site/jacoco</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
diff --git a/ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js b/ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js
index 45350d91..42e8c133 100644
--- a/ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js
+++ b/ecomp-portal-widget-ms/widget-ms/src/main/resources/framework-template.js
@@ -1,21 +1,24 @@
-var ARUGMENT1 = (function(window, undefined) {
+var ARGUMENT1 = (function(window, undefined) {
- var ARUGMENT1 = ARUGMENT1 || {};
+ var ARGUMENT1 = ARGUMENT1 || {};
function extractHostPortApp(src) {
- ARUGMENT1.microserviceId = MICROSERVICE_ID;
- ARUGMENT1.pathArray = src.split( '/' );
- ARUGMENT1.widgetName = ARUGMENT1.pathArray[ARUGMENT1.pathArray.length - 2];
- ARUGMENT1.serviceSeperator = ARUGMENT1.pathArray[ARUGMENT1.pathArray.length - 4];
- ARUGMENT1.commonUrl = src.substring(0, src.lastIndexOf("/" + ARUGMENT1.widgetName));
- ARUGMENT1.recipientDivDataAttrib = 'data-' + ARUGMENT1.widgetName;
- ARUGMENT1.controllerName = 'ARUGMENT2';
- ARUGMENT1.readyCssFlag = 'ARUGMENT3';
- ARUGMENT1.readyCssFlagExpectedValue = '#bada55';
- ARUGMENT1.serviceURL = src.substring(0, src.lastIndexOf("/" + ARUGMENT1.serviceSeperator)) + '/portalApi/microservice/proxy/parameter/' + WIDGET_ID;
- }
-
- extractHostPortApp(document.currentScript.src);
-
+
+ ARGUMENT1.microserviceId = MICROSERVICE_ID;
+ ARGUMENT1.pathArray = src.split( '/' );
+
+ ARGUMENT1.widgetName = WIDGET_ID;
+ ARGUMENT1.serviceSeperator = ARGUMENT1.pathArray[ARGUMENT1.pathArray.length - 4];
+ ARGUMENT1.commonUrl = src.substring(0, src.lastIndexOf("/" + ARGUMENT1.pathArray[ARGUMENT1.pathArray.length - 2]));
+
+ ARGUMENT1.recipientDivDataAttrib = 'data-' + ARGUMENT1.widgetName;
+ ARGUMENT1.controllerName = 'ARGUMENT2';
+ ARGUMENT1.readyCssFlag = 'ARGUMENT3';
+ ARGUMENT1.readyCssFlagExpectedValue = '#bada55';
+ ARGUMENT1.serviceURL = src.substring(0, src.lastIndexOf("/" + ARGUMENT1.serviceSeperator)) + '/portalApi/microservice/proxy/parameter/' + WIDGET_ID;
+ }
+
+ extractHostPortApp(document.getElementsByTagName('script')[0].src);
+
function loadStylesheet(url) {
var link = document.createElement('link');
link.rel = 'stylesheet';
@@ -27,7 +30,7 @@ var ARUGMENT1 = (function(window, undefined) {
function isCssReady(callback) {
var testElem = document.createElement('span');
- testElem.id = ARUGMENT1.readyCssFlag;
+ testElem.id = ARGUMENT1.readyCssFlag;
testElem.style = 'CSS_ARG1';
var entry = document.getElementsByTagName('script')[0];
entry.parentNode.insertBefore(testElem, entry);
@@ -42,7 +45,7 @@ var ARUGMENT1 = (function(window, undefined) {
else if (node.currentStyle) {
value = node.currentStyle.color;
}
- if (value && value === 'rgb(186, 218, 85)' || value.toLowerCase() === ARUGMENT1.readyCssFlagExpectedValue) {
+ if (value && value === 'rgb(186, 218, 85)' || value.toLowerCase() === ARGUMENT1.readyCssFlagExpectedValue) {
callback();
} else {
setTimeout(poll, 500);
@@ -67,9 +70,11 @@ var ARUGMENT1 = (function(window, undefined) {
function loadScript(url, callback) {
var script = document.createElement('script');
script.src = url;
+
var entry = document.getElementsByTagName('script')[0];
entry.parentNode.insertBefore(script, entry);
- script.onload = script.onreadystatechange = function() {
+
+ script.onload = script.onreadystatechange = function() {
var rdyState = script.readyState;
if (!rdyState || /complete|loaded/.test(script.readyState)) {
callback();
@@ -111,30 +116,41 @@ var ARUGMENT1 = (function(window, undefined) {
}
}
-
- function getMarkupContent(markupLocation, target){
+
+ function getMarkupContent(markupLocation, callback){
- jQuery.ajax({
- url: markupLocation,
- success: function (result) {
- if (result.isOk == false){
-
- }else{
- target.innerHTML = result;
- }
- },
- async: false
- });
+ try{
+ jQuery.ajax({
+ url: markupLocation,
+ method: "GET",
+ xhrFields: {
+ withCredentials: true
+ },
+ crossDomain: true,
+ success: function (result) {
+ if (result.isOk == false){
+
+ }else{
+ callback(result);
+ }
+ }
+ });
+ }
+ catch(e){
+
+ }
}
function renderWidget(data, location, $controllerProvider) {
var div = document.createElement('div');
- getMarkupContent(ARUGMENT1.commonUrl + "/markup/" + ARUGMENT1.widgetName, div);
- location.append(div);
- ARUGMENT1.widgetData = data;
- app.controllerProvider.register(ARUGMENT1.controllerName, ARUGMENT1.controller);
- var mController = angular.element(document.getElementById("widgets"));
- mController.scope().activateThis(location);
+ getMarkupContent(ARGUMENT1.commonUrl + "/markup/" + ARGUMENT1.widgetName, function(div){
+ location.append(div);
+ ARGUMENT1.widgetData = data;
+ app.controllerProvider.register(ARGUMENT1.controllerName, ARGUMENT1.controller);
+ var mController = angular.element(document.getElementById("widgets"));
+ mController.scope().activateThis(location);
+ });
+
}
function printAllArtifacts(moduleName, controllerName) {
@@ -151,14 +167,14 @@ var ARUGMENT1 = (function(window, undefined) {
}
loadSupportingFiles(function() {
- loadStylesheet(ARUGMENT1.commonUrl + '/' + ARUGMENT1.widgetName + '/style.css');
- loadScript(ARUGMENT1.commonUrl + '/' + ARUGMENT1.widgetName + '/controller.js',
+ loadStylesheet(ARGUMENT1.commonUrl + '/' + ARGUMENT1.widgetName + '/style.css');
+ loadScript(ARGUMENT1.commonUrl + '/' + ARGUMENT1.widgetName + '/controller.js',
function() {
- $('['+ ARUGMENT1.recipientDivDataAttrib + ']').each(function() {
+ $('['+ ARGUMENT1.recipientDivDataAttrib + ']').each(function() {
var location = jQuery(this);
- location.removeAttr(ARUGMENT1.recipientDivDataAttrib);
- var id = location.attr(ARUGMENT1.recipientDivDataAttrib);
- getWidgetData(ARUGMENT1.serviceURL, function(data) {
+ location.removeAttr(ARGUMENT1.recipientDivDataAttrib);
+ var id = location.attr(ARGUMENT1.recipientDivDataAttrib);
+ getWidgetData(ARGUMENT1.serviceURL, function(data) {
isCssReady(function(){
renderWidget(data, location);
});
@@ -168,6 +184,6 @@ var ARUGMENT1 = (function(window, undefined) {
);
});
- return ARUGMENT1;
+ return ARGUMENT1;
})(window);
\ No newline at end of file