diff options
author | sebdet <sebastien.determe@intl.att.com> | 2019-05-23 17:34:07 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2019-06-05 11:05:35 +0200 |
commit | 09bc8450b2b0c4f60eb4a241efc548d13c5c9912 (patch) | |
tree | addd899e38e02946a6dfa3997b7a43264bd0276a /src/main/resources/META-INF | |
parent | c7b7368b08fa4e75919d6f7282dee526ccedf398 (diff) |
Rework the loop state
Rework the state loop so there is no bug in the loop state anymore, now
the components are scanned + upgrade to 4.0.4
Issue-ID: CLAMP-384
Change-Id: If7649238ee52864c84bfb9b6b8471d1738752e29
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main/resources/META-INF')
4 files changed, 47 insertions, 94 deletions
diff --git a/src/main/resources/META-INF/resources/designer/modeler/dist/index.html b/src/main/resources/META-INF/resources/designer/modeler/dist/index.html index ab337de8f..cd7d6668b 100644 --- a/src/main/resources/META-INF/resources/designer/modeler/dist/index.html +++ b/src/main/resources/META-INF/resources/designer/modeler/dist/index.html @@ -59,15 +59,17 @@ <thead> <tr> <th><span align="left" class="text">Date</span></th> - <th><span align="center" class="text">Type</span></th> + <th><span align="left" class="text">Type</span></th> + <th><span align="left" class="text">Component</span></th> <th><span align="right" class="text">Log</span></th> </tr> </thead> <tbody> <tr ng-repeat="log in loop_logs" ng-class="{reverse: reverse}"> - <td width="20%">{{log.logInstant}}</td> + <td width="10%">{{log.logInstant}}</td> <td width="10%" ng-class="log.logType">{{log.logType}}</td> - <td width="70">{{log.message}}</td> + <td width="10%">{{log.logComponent}}</td> + <td width="70%">{{log.message}}</td> </tr> </tbody> </table> 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 0cc5c38f3..2b27a7fd5 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js +++ b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js @@ -41,32 +41,8 @@ app ToscaModelWindow(); } } - this.toggleDeploy = function(uiAction, modelName) { - var svcAction = uiAction.toLowerCase(); - var deployUrl = "/restservices/clds/v2/loop/" + svcAction + "Loop/" + modelName; - var def = $q.defer(); - var sets = []; - $http.put(deployUrl).success( - function(data) { - def.resolve(data); - alertService.alertMessage("Action Successful: " + svcAction, 1) - // update deploymentID, lastUpdatedStatus - setLastComputedState(data.lastComputedState); - setDeploymentStatusURL(data.dcaeDeploymentStatusUrl); - setDeploymentID(data.dcaeDeploymentId); - setStatus(data.lastComputedState); - enableDisableMenuOptions(); - }).error( - function(data) { - def.resolve(data); - alertService.alertMessage("Action Failure: " + svcAction, 2); - def.reject(svcAction + " not successful"); - }); - return def.promise; - } this.getModel = function(modelName) { var def = $q.defer(); - var sets = []; var svcUrl = "/restservices/clds/v2/loop/" + modelName; $http.get(svcUrl).success(function(data) { cl_props = data; @@ -79,7 +55,6 @@ app }; this.getSavedModel = function() { var def = $q.defer(); - var sets = []; var svcUrl = "/restservices/clds/v2/loop/getAllNames"; $http.get(svcUrl).success(function(data) { @@ -92,7 +67,6 @@ app }; this.processAction = function(uiAction, modelName) { var def = $q.defer(); - var sets = []; var svcAction = uiAction.toLowerCase(); var svcUrl = "/restservices/clds/v2/loop/" + svcAction + "/" + modelName; @@ -100,10 +74,6 @@ app function(data) { def.resolve(data); alertService.alertMessage("Action Successful: " + svcAction, 1) - // update deploymentID, lastUpdatedStatus - setLastComputedState(data.lastComputedState); - setDeploymentStatusURL(data.dcaeDeploymentStatusUrl); - setDeploymentID(data.dcaeDeploymentId); }).error( function(data) { def.resolve(data); @@ -116,7 +86,6 @@ app this.manageAction = function(modelName, typeId, typeName) { var def = $q.defer(); - var sets = []; var config = { url : "/restservices/clds/v1/clds/getDispatcherInfo", method : "GET", @@ -143,37 +112,34 @@ app }; this.refreshStatus = function(modelName) { var def = $q.defer(); - var sets = []; var svcUrl = "/restservices/clds/v2/loop/getstatus/" + modelName; $http.get(svcUrl).success(function(data) { + cl_props = data; setStatus(data.lastComputedState); def.resolve(data); }).error(function(data) { def.reject("Refresh Status not successful"); }); return def.promise; - enableDisableMenuOptions(); } 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() === "SUBMITTED") { + statusColor = 'blue' + } else if (status.trim() === "DEPLOYED") { + statusColor = 'blue' + } else if (status.trim() === "RUNNING") { statusColor = 'green' } else if (status.trim() === "STOPPED") { - statusColor = 'red' - } else if (status.trim() === "DELETING") { - statusColor = 'pink' - } else if (status.trim() === "ERROR") { statusColor = 'orange' - } else if (status.trim() === "UNKNOWN") { - statusColor = 'blue' - } else { - statusColor = null; - } + } else if (status.trim() === "IN_ERROR") { + statusColor = 'red' + } else if (status.trim() === "WAITING") { + statusColor = 'greenyellow' + } var statusMsg = '<span style="background-color:' + statusColor + ';-moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px;"> ' @@ -185,6 +151,22 @@ app .append( '<span id="status_clds" style="position: absolute; left: 61%;top: 151px; font-size:20px;">Status: ' + statusMsg + '</span>'); + + var statusTable = '<table id="status_components_table" style="width:100%"><tr><th><span align="left" class="text">Component</span></th><th><span align="center" class="text">State</span></th><th><span align="right" class="text">Description</span></th></tr>'; + + $.each(cl_props['components'], function(componentIndex, componentValue) { + statusTable+='<tr><td>'+componentIndex+'</td>'; + statusTable+='<td>'+componentValue['componentState']['stateName']+'</td>'; + statusTable+='<td>'+componentValue['componentState']['description']+'</td></tr>'; + }); + statusTable+= '</table>'; + if ($("#status_components").length >= 1) + $("#status_components").remove(); + $("#activity_modeler") + .append( + '<span id="status_components" style="position: absolute; left: 61%;top: 191px; font-size:10px;">' + + statusTable + '</span>'); + } function manageCLImage(modelName) { getModelImage(modelName).then(function(pars) { @@ -203,13 +185,12 @@ app }, function(data) { }); } - enableDisableMenuOptions = function() { + function enableDisableMenuOptions () { enableDefaultMenu(); enableAllActionMenu(); } - getModelImage = function(modelName) { + function getModelImage(modelName) { var def = $q.defer(); - var sets = []; var svcUrl = "/restservices/clds/v2/loop/svgRepresentation/" + modelName; $http.get(svcUrl).success(function(data) { def.resolve(data); 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 5597bd992..7dda84799 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/app.js +++ b/src/main/resources/META-INF/resources/designer/scripts/app.js @@ -388,7 +388,7 @@ function($scope, $rootScope, $timeout, dialogs) { }; $scope.propertyExplorerErrorMessage = function(msg) { - var dlg = dialogs.notify('Error', msg); + dialogs.notify('Error', msg); } $scope.activityModelling = function() { @@ -505,7 +505,8 @@ function($scope, $rootScope, $timeout, dialogs) { cldsModelService.processAction(uiAction, modelName).then(function(pars) { console.log("cldsPerformAction: pars=" + pars); - cldsModelService.getModel(modelName).then(function(pars) { + cldsModelService.refreshStatus(modelName).then(function(pars) { + console.log("refreshStatus: pars=" + pars); $rootScope.refreshLoopLog(); }, function(data) { }); @@ -514,9 +515,10 @@ function($scope, $rootScope, $timeout, dialogs) { }; $scope.refreshStatus = function() { var modelName = selected_model; - console.log("refreStatus modelName=" + modelName); + console.log("refreshStatus modelName=" + modelName); cldsModelService.refreshStatus(modelName).then(function(pars) { - console.log("refreStatus: pars=" + pars); + console.log("refreshStatus: pars=" + pars); + $rootScope.refreshLoopLog(); }, function(data) { }); @@ -547,7 +549,7 @@ function($scope, $rootScope, $timeout, dialogs) { 'Are you sure you want to deploy the closed loop?'); confirm.result.then(function() { - cldsToggleDeploy("deploy"); + $scope.cldsPerformAction("deploy"); }); }); }; @@ -557,24 +559,12 @@ function($scope, $rootScope, $timeout, dialogs) { + uiAction.toLowerCase() + ' the closed loop?'); dlg.result.then(function(btn) { - cldsToggleDeploy(uiAction.toLowerCase()); + $scope.cldsPerformAction(uiAction.toLowerCase()); }, function(btn) { }); }; - function cldsToggleDeploy(uiAction) { - console.log("cldsPerformAction: " + uiAction + " modelName=" - + 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) { var dlg = dialogs.create('partials/portfolios/tosca_model_properties.html','ToscaModelCtrl',{closable:true,draggable:true},{size:'lg',keyboard: true,backdrop: 'static',windowClass: 'my-class'}); 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 a8aa83c06..0323529ee 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/propertyController.js +++ b/src/main/resources/META-INF/resources/designer/scripts/propertyController.js @@ -91,30 +91,6 @@ function getMsUI(type) { return null; } -function getLastUpdatedStatus() { - return cl_props["lastComputedState"]; -} - -function setLastComputedState(status) { - cl_props["lastComputedState"] = status; -} - -function getDeploymentID() { - return cl_props["dcaeDeploymentId"]; -} - -function setDeploymentID(deploymentId) { - cl_props["dcaeDeploymentId"] = deploymentId; -} - -function getDeploymentStatusURL() { - return cl_props["dcaeDeploymentStatusUrl"]; -} - -function setDeploymentStatusURL(deploymentStatusURL) { - cl_props["dcaeDeploymentStatusUrl"] = deploymentStatusURL; -} - function getResourceDetailsVfProperty() { return cl_props["modelPropertiesJson"]["resourceDetails"]["VF"]; } @@ -127,4 +103,8 @@ function getLoopLogsArray() { return cl_props.loopLogs; } -module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getLastUpdatedStatus,getDeploymentID,getDeploymentStatusURL,getResourceDetailsVfProperty,getResourceDetailsVfModuleProperty }; +function getComponentStates() { + return cl_props.components; +} + +module.exports = { getOperationalPolicyProperty,getGlobalProperty,getMsProperty,getMsUI,getResourceDetailsVfProperty,getResourceDetailsVfModuleProperty }; |