diff options
author | xg353y <xg353y@intl.att.com> | 2019-03-25 15:23:41 +0100 |
---|---|---|
committer | xg353y <xg353y@intl.att.com> | 2019-03-25 15:23:41 +0100 |
commit | c62d1b74275b8d5e9d4cef6c308ef16440cfa500 (patch) | |
tree | 1641e0652e79f51a3b35cfbe143f5a150eafd692 /src | |
parent | bb393ee2f520254b6fa47d282108790eeda95725 (diff) |
Rework the UI
Rework the UI to submit/stop/restart the closed loop based on the new
data model
Issue-ID: CLAMP-313
Change-Id: Ide9be22f5ffc4faa2cd257a7f7eec895ab81f5de
Signed-off-by: xg353y <xg353y@intl.att.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js | 66 | ||||
-rw-r--r-- | src/main/resources/META-INF/resources/designer/scripts/app.js | 23 |
2 files changed, 21 insertions, 68 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 3dc4d003..a71e6caa 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js +++ b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js @@ -80,10 +80,8 @@ app return def.promise; }; this.getSavedModel = function() { - var def = $q.defer(); var sets = []; - //var svcUrl = "/restservices/clds/v1/clds/model-names"; var svcUrl = "/restservices/clds/v2/loop/getAllNames"; $http.get(svcUrl).success(function(data) { @@ -94,53 +92,29 @@ app }); return def.promise; }; - this.setModel = function(modelName, controlNamePrefixIn, bpmnTextIn, - propTextIn) { - - var def = $q.defer(); - var sets = []; - var svcUrl = "/restservices/clds/v1/clds/model/" + modelName; - var svcRequest = { - name : modelName, - controlNamePrefix : controlNamePrefixIn, - bpmnText : bpmnTextIn, - propText : propTextIn - }; - $http.put(svcUrl, svcRequest).success(function(data) { - def.resolve(data); - }).error(function(data) { - - def.reject("Save Model not successful"); - }); - return def.promise; - }; - this.processAction = function(uiAction, modelName, controlNamePrefixIn, - bpmnTextIn, propTextIn, svgXmlIn, - templateName, typeID, deploymentId) { - + this.processAction = function(uiAction, modelName) { var def = $q.defer(); var sets = []; - // console.log(svgXmlIn); - var svcUrl = "/restservices/clds/v1/clds/"; var svcAction = uiAction.toLowerCase(); - if (svcAction == "save" || svcAction == "refresh") { - svcUrl = svcUrl + "model/" + modelName; - } else if (svcAction == "test") { - svcUrl = svcUrl + "action/submit/" + modelName + "?test=true"; - } else { - svcUrl = svcUrl + "action/" + svcAction + "/" + modelName; - } - var svcRequest = { - name : modelName, - controlNamePrefix : controlNamePrefixIn, - bpmnText : bpmnTextIn, - propText : propTextIn, - imageText : svgXmlIn, - templateName : templateName, - typeId : typeID, - deploymentId : deploymentId - }; - handleQueryToBackend(def, svcAction, svcUrl, svcRequest); + var svcUrl = "/restservices/clds/v2/loop/" + "action/" + svcAction + "/" + modelName; + + $http.put(svcUrl).success( + function(data) { + def.resolve(data); + alertService.alertMessage("Action Successful: " + svcAction, 1) + // update deploymentID, lastUpdatedStatus + setLastUpdatedStatus(data.lastUpdatedStatus); + setDeploymentStatusURL(data.dcaeDeploymentStatusUrl); + setDeploymentID(data.dcaeDeploymentId); + setStatus(); + enableDisableMenuOptions(); + }).error( + function(data) { + def.resolve(data); + alertService.alertMessage("Action Failure: " + svcAction, 2); + def.reject(svcAction + " not successful"); + }); + return def.promise; }; this.manageAction = function(modelName, typeId, typeName) { 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 1b77bf82..9ba7b82c 100644 --- a/src/main/resources/META-INF/resources/designer/scripts/app.js +++ b/src/main/resources/META-INF/resources/designer/scripts/app.js @@ -545,39 +545,18 @@ function($scope, $rootScope, $timeout, dialogs) { }); }; $scope.cldsPerformAction = function(uiAction) { - var modelName = selected_model; - var controlNamePrefix = "ClosedLoop-"; - var bpmnText = modelXML; - // serialize model properties - var propText = JSON.stringify(elementMap); - var templateName = selected_template - var svgXml = $("#svgContainer").html(); console.log("cldsPerformAction: " + uiAction + " modelName=" + modelName); - console.log("cldsPerformAction: " + uiAction - + " controlNamePrefix=" + controlNamePrefix); - console.log("cldsPerformAction: " + uiAction + " bpmnText=" - + bpmnText); - console.log("cldsPerformAction: " + uiAction + " propText=" - + propText); - console.log("cldsPerformAction: " + uiAction + " typeID=" + typeID); - console.log("cldsPerformAction: " + uiAction + " deploymentId=" - + deploymentId); - cldsModelService.processAction(uiAction, modelName, - controlNamePrefix, bpmnText, propText, svgXml, templateName, - typeID, deploymentId).then(function(pars) { + cldsModelService.processAction(uiAction, modelName).then(function(pars) { console.log("cldsPerformAction: pars=" + pars); - cldsModelService.processRefresh(pars); }, function(data) { }); }; $scope.refreshStatus = function() { - var modelName = selected_model; - var svgXml = $("#svgContainer").html(); console.log("refreStatus modelName=" + modelName); cldsModelService.getModel(modelName).then(function(pars) { console.log("refreStatus: pars=" + pars); |