aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorxg353y <xg353y@intl.att.com>2019-05-09 11:41:30 +0200
committerxg353y <xg353y@intl.att.com>2019-05-09 11:41:30 +0200
commitbc753dfd1a7eeccecd34763674653d319b822f2b (patch)
tree7382d1ed5786874f018f42a45e0086cc7866514d /src/main
parentb0f7e5bf406a393abc6cfb9fc6cf1003b6e6ef10 (diff)
Fix the loop log issue
Fix the issue where loop log doesn't refresh in UI on time; update the Refresh Status menu to point to the correct url Issue-ID: CLAMP-360 Change-Id: I65064e8f3fe16beea4cb397f66d8e871db17f77d Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'src/main')
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js31
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/app.js15
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/propertyController.js2
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml6
4 files changed, 32 insertions, 22 deletions
diff --git a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
index 38cdc938..a75326de 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
@@ -51,10 +51,10 @@ app
def.resolve(data);
alertService.alertMessage("Action Successful: " + svcAction, 1)
// update deploymentID, lastUpdatedStatus
- setLastUpdatedStatus(data.lastUpdatedStatus);
+ setLastComputedState(data.lastComputedState);
setDeploymentStatusURL(data.dcaeDeploymentStatusUrl);
setDeploymentID(data.dcaeDeploymentId);
- setStatus();
+ setStatus(data.lastComputedState);
enableDisableMenuOptions();
}).error(
function(data) {
@@ -70,6 +70,7 @@ app
var svcUrl = "/restservices/clds/v2/loop/" + modelName;
$http.get(svcUrl).success(function(data) {
cl_props = data;
+ setStatus(data.lastComputedState);
def.resolve(data);
}).error(function(data) {
def.reject("Open Model not successful");
@@ -100,11 +101,9 @@ app
def.resolve(data);
alertService.alertMessage("Action Successful: " + svcAction, 1)
// update deploymentID, lastUpdatedStatus
- setLastUpdatedStatus(data.lastUpdatedStatus);
+ setLastComputedState(data.lastComputedState);
setDeploymentStatusURL(data.dcaeDeploymentStatusUrl);
setDeploymentID(data.dcaeDeploymentId);
- setStatus();
- enableDisableMenuOptions();
}).error(
function(data) {
def.resolve(data);
@@ -139,23 +138,30 @@ app
this.processActionResponse = function(modelName) {
// populate control name (prefix and uuid here)
$("#loop_name").text(getLoopName());
- setStatus();
manageCLImage(modelName);
enableDisableMenuOptions();
};
- this.processRefresh = function() {
- setStatus();
+ this.refreshStatus = function(modelName) {
+ var def = $q.defer();
+ var sets = [];
+ var svcUrl = "/restservices/clds/v2/loop/getstatus/" + modelName;
+ $http.get(svcUrl).success(function(data) {
+ setStatus(data.lastComputedState);
+ def.resolve(data);
+ }).error(function(data) {
+ def.reject("Refresh Status not successful");
+ });
+ return def.promise;
enableDisableMenuOptions();
}
- function setStatus() {
- var status = getLastUpdatedStatus();
+ function setStatus(status) {
// apply color to status
var statusColor = 'white';
if (status.trim() === "DESIGN") {
statusColor = 'gray'
} else if (status.trim() === "DISTRIBUTED") {
statusColor = 'blue'
- } else if (status.trim() === "ACTIVE") {
+ } else if (status.trim() === "SUBMITTED") {
statusColor = 'green'
} else if (status.trim() === "STOPPED") {
statusColor = 'red'
@@ -180,7 +186,6 @@ app
'<span id="status_clds" style="position: absolute; left: 61%;top: 151px; font-size:20px;">Status: '
+ statusMsg + '</span>');
}
-
function manageCLImage(modelName) {
getModelImage(modelName).then(function(pars) {
var svg = pars;
@@ -200,8 +205,6 @@ app
}
enableDisableMenuOptions = function() {
enableDefaultMenu();
- //var status = getStatus();
- //enableActionMenu(status);
enableAllActionMenu();
}
getModelImage = function(modelName) {
diff --git a/src/main/resources/META-INF/resources/designer/scripts/app.js b/src/main/resources/META-INF/resources/designer/scripts/app.js
index 323cffc1..5597bd99 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/app.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/app.js
@@ -505,17 +505,18 @@ function($scope, $rootScope, $timeout, dialogs) {
cldsModelService.processAction(uiAction, modelName).then(function(pars) {
console.log("cldsPerformAction: pars=" + pars);
- $rootScope.refreshLoopLog();
+ cldsModelService.getModel(modelName).then(function(pars) {
+ $rootScope.refreshLoopLog();
+ }, function(data) {
+ });
}, function(data) {
-
});
};
$scope.refreshStatus = function() {
var modelName = selected_model;
console.log("refreStatus modelName=" + modelName);
- cldsModelService.getModel(modelName).then(function(pars) {
+ cldsModelService.refreshStatus(modelName).then(function(pars) {
console.log("refreStatus: pars=" + pars);
- cldsModelService.processRefresh();
}, function(data) {
});
@@ -566,9 +567,13 @@ function($scope, $rootScope, $timeout, dialogs) {
+ selected_model);
cldsModelService.toggleDeploy(uiAction, selected_model).then(
function(pars) {
+ cldsModelService.getModel(selected_model).then(function(pars) {
+ $rootScope.refreshLoopLog();
+ }, function(data) {
+ });
}, function(data) {
-
});
+
}
$scope.ToscaModelWindow = function (tosca_model) {
diff --git a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
index ee602b99..994e4a76 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js
@@ -94,7 +94,7 @@ function getLastUpdatedStatus() {
return cl_props["lastComputedState"];
}
-function setLastUpdatedStatus(status) {
+function setLastComputedState(status) {
cl_props["lastComputedState"] = status;
}
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index 4d3c6b38..0d6d3cb2 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -606,8 +606,6 @@
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request successfully executed','INFO',${exchangeProperty[loopObject]})" />
<to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
- <to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
<doCatch>
<exception>java.lang.Exception</exception>
@@ -622,6 +620,10 @@
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request failed','ERROR',${exchangeProperty[loopObject]})" />
</doCatch>
+ <doFinally>
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ </doFinally>
</doTry>
</route>
</get>