summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Determe <sebastien.determe@intl.att.com>2018-10-11 11:50:34 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-11 11:50:34 +0000
commit8478894fe89fd50d7fd52ec73eefbe604c4321b4 (patch)
treebe62cef8cc22dc7012b465884a9bef3fd3746821
parent97705c8390a93a745a84e5a80d1f7f146d979099 (diff)
parentb7d7e6e7be399ba7acce89b552e1684aa99548d6 (diff)
Merge "Fix UI behavior"
-rw-r--r--src/main/java/org/onap/clamp/clds/model/CldsModel.java10
-rw-r--r--src/main/java/org/onap/clamp/clds/service/CldsService.java27
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js753
-rw-r--r--src/main/resources/META-INF/resources/designer/scripts/app.js1325
4 files changed, 1124 insertions, 991 deletions
diff --git a/src/main/java/org/onap/clamp/clds/model/CldsModel.java b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
index d7228cfc..47bfedc7 100644
--- a/src/main/java/org/onap/clamp/clds/model/CldsModel.java
+++ b/src/main/java/org/onap/clamp/clds/model/CldsModel.java
@@ -67,6 +67,8 @@ public class CldsModel {
private String status;
private List<String> permittedActionCd;
private List<CldsModelInstance> cldsModelInstanceList;
+ // This is a transient value used to return the failure message to UI
+ private String errorMessageForUi;
/**
* The service type Id received from DCAE by querying it
*/
@@ -520,4 +522,12 @@ public class CldsModel {
public List<String> getPermittedActionCd() {
return permittedActionCd;
}
+
+ public String getErrorMessageForUi() {
+ return errorMessageForUi;
+ }
+
+ public void setErrorMessageForUi(String errorMessageForUi) {
+ this.errorMessageForUi = errorMessageForUi;
+ }
}
diff --git a/src/main/java/org/onap/clamp/clds/service/CldsService.java b/src/main/java/org/onap/clamp/clds/service/CldsService.java
index 8d497cbc..2342e89c 100644
--- a/src/main/java/org/onap/clamp/clds/service/CldsService.java
+++ b/src/main/java/org/onap/clamp/clds/service/CldsService.java
@@ -345,7 +345,7 @@ public class CldsService extends SecureServiceBase {
util.entering(request, "CldsService: Process model action");
Date startTime = new Date();
CldsModel retrievedModel = null;
- Boolean errorCase = false;
+ String errorMessage = "";
try {
String actionCd = action.toUpperCase();
SecureServicePermission permisionManage = SecureServicePermission.create(cldsPermissionTypeClManage,
@@ -387,8 +387,8 @@ public class CldsService extends SecureServiceBase {
isTest, userId, isInsertTestEvent, model.getEvent().getActionCd());
logger.info("Starting Camel flow on request, result is: ", result);
} catch (SdcCommunicationException | PolicyClientException | BadRequestException e) {
- errorCase = true;
logger.error("Exception occured during invoking Camel process", e);
+ errorMessage=e.getMessage();
}
if (actionCd.equalsIgnoreCase(CldsEvent.ACTION_DELETE)) {
util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO,
@@ -397,7 +397,7 @@ public class CldsService extends SecureServiceBase {
} else {
retrievedModel = CldsModel.retrieve(cldsDao, modelName, false);
}
- if (!isTest && !errorCase
+ if (!isTest && errorMessage.isEmpty()
&& (actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMIT)
|| actionCd.equalsIgnoreCase(CldsEvent.ACTION_RESUBMIT)
|| actionCd.equalsIgnoreCase(CldsEvent.ACTION_SUBMITDCAE))) {
@@ -423,10 +423,13 @@ public class CldsService extends SecureServiceBase {
auditLogger.info("Process model action completed");
} catch (Exception e) {
- errorCase = true;
logger.error("Exception occured during putModelAndProcessAction", e);
+ errorMessage=e.getMessage();
}
- if (errorCase) {
+ if (!errorMessage.isEmpty()) {
+ if (retrievedModel != null) {
+ retrievedModel.setErrorMessageForUi(errorMessage);
+ }
util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "putModelAndProcessAction failed", Level.INFO,
ONAPLogConstants.ResponseStatus.ERROR);
return new ResponseEntity<>(retrievedModel, HttpStatus.INTERNAL_SERVER_ERROR);
@@ -725,7 +728,7 @@ public class CldsService extends SecureServiceBase {
public ResponseEntity<CldsModel> deployModel(String modelName, CldsModel model) {
util.entering(request, "CldsService: Deploy model");
Date startTime = new Date();
- Boolean errorCase = false;
+ String errorMessage="";
try {
fillInCldsModel(model);
String bpmnJson = cldsBpmnTransformer.doXslTransformToString(model.getBpmnText());
@@ -772,10 +775,11 @@ public class CldsService extends SecureServiceBase {
LoggingUtils.setTimeContext(startTime, new Date());
auditLogger.info("Deploy model completed");
} catch (Exception e) {
- errorCase = true;
+ errorMessage=e.getMessage();
logger.error("Exception occured during deployModel", e);
}
- if (errorCase) {
+ if (!errorMessage.isEmpty()) {
+ model.setErrorMessageForUi(errorMessage);
util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "DeployModel failed", Level.INFO,
ONAPLogConstants.ResponseStatus.ERROR);
return new ResponseEntity<>(model, HttpStatus.INTERNAL_SERVER_ERROR);
@@ -787,7 +791,7 @@ public class CldsService extends SecureServiceBase {
public ResponseEntity<CldsModel> unDeployModel(String modelName, CldsModel model) {
util.entering(request, "CldsService: Undeploy model");
Date startTime = new Date();
- Boolean errorCase = false;
+ String errorMessage = "";
try {
SecureServicePermission permisionManage = SecureServicePermission.create(cldsPermissionTypeClManage,
cldsPermissionInstance, CldsEvent.ACTION_UNDEPLOY);
@@ -821,10 +825,11 @@ public class CldsService extends SecureServiceBase {
LoggingUtils.setTimeContext(startTime, new Date());
auditLogger.info("Undeploy model completed");
} catch (Exception e) {
- errorCase = true;
+ errorMessage = e.getMessage();
logger.error("Exception occured during unDeployModel", e);
}
- if (errorCase) {
+ if (!errorMessage.isEmpty()) {
+ model.setErrorMessageForUi(errorMessage);
util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "UndeployModel failed", Level.INFO,
ONAPLogConstants.ResponseStatus.ERROR);
return new ResponseEntity<>(model, HttpStatus.INTERNAL_SERVER_ERROR);
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 9cff0453..98e8443e 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/CldsModelService.js
@@ -20,386 +20,373 @@
* ===================================================================
*
*/
-
-app.service('cldsModelService', ['alertService', '$http', '$q', function(alertService, $http, $q) {
-
- function checkIfElementType(name) {
- //This will open the methods located in the app.js
- if (undefined == name) {
- return
- }
-
- mapping = {
- 'tca': TCAWindow,
- 'policy': PolicyWindow,
- 'vescollector': VesCollectorWindow,
- 'holmes': HolmesWindow,
- };
-
- key = name.split('_')[0].toLowerCase()
- if (key in mapping) {
- mapping[key]();
- }
- }
-
- this.toggleDeploy = function(uiAction, modelName, controlNamePrefixIn,
- bpmnTextIn, propTextIn, svgXmlIn, templateName, typeID, controlNameUuid, modelEventService, deploymentId) {
-
- var def = $q.defer();
- var sets = [];
- var action = uiAction.toLowerCase();
- var deployUrl = "/restservices/clds/v1/clds/" + action + "/" + modelName;
- var requestData = {
- name: modelName,
- controlNamePrefix: controlNamePrefixIn,
- bpmnText: bpmnTextIn,
- propText: propTextIn,
- imageText: svgXmlIn,
- templateName: templateName,
- typeId: typeID,
- controlNameUuid: controlNameUuid,
- event: modelEventService,
- deploymentId: deploymentId
- };
-
- $http.put(deployUrl, requestData)
- .success(function(data) {
- var newData = data;
- if (typeof data.body !== 'undefined') {
- newData = data.body;
- }
- deploymentId = newData.deploymentId;
- def.resolve(newData);
- alertService.alertMessage("Action Successful:" + uiAction, 1)
- })
- .error(function(data) {
- alertService.alertMessage("Action Failure:" + uiAction, 2)
- def.reject("Save Model not successful");
- });
-
- return def.promise;
- };
-
- this.getASDCServices = function() {
-
-
- var def = $q.defer();
- var sets = [];
-
- var svcUrl = "/restservices/clds/v1/clds/sdc/services/";
-
- $http.get(svcUrl)
- .success(function(data) {
- def.resolve(data);
-
-
- })
- .error(function(data) {
- def.reject("sdc Services not found");
-
- });
-
- return def.promise;
- };
-
-
- this.getASDCService = function(uuid) {
-
-
- var def = $q.defer();
- var sets = [];
-
- var svcUrl = "/restservices/clds/v1/clds/sdc/services/" + uuid;
-
- $http.get(svcUrl)
- .success(function(data) {
- def.resolve(data);
-
- })
- .error(function(data) {
- def.reject("SDC service not found");
- });
-
- return def.promise;
- };
- this.getModel = function(modelName) {
-
-
- var def = $q.defer();
- var sets = [];
- var svcUrl = "/restservices/clds/v1/clds/model/" + modelName;
-
- $http.get(svcUrl)
- .success(function(data) {
- def.resolve(data);
-
- })
- .error(function(data) {
- def.reject("Open Model not successful");
- });
-
- return def.promise;
- };
- this.getSavedModel = function() {
-
- var def = $q.defer();
- var sets = [];
-
- var svcUrl = "/restservices/clds/v1/clds/model-names";
-
- $http.get(svcUrl)
- .success(function(data) {
- def.resolve(data);
-
- })
- .error(function(data) {
- def.reject("Open Model not successful");
- });
-
- 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) {
-
-
- 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
- };
-
- $http.put(svcUrl, svcRequest)
- .success(function(data) {
- def.resolve(data);
- alertService.alertMessage("Action Successful:" + uiAction, 1)
-
- })
- .error(function(data) {
- def.resolve(data);
- alertService.alertMessage("Action Failure:" + uiAction, 2);
- //def alertService.alertMessage("Action Successful:"+uiAction,1);
- def.reject(svcAction + " not successful");
- });
-
- return def.promise;
- };
- this.manageAction = function(modelName, typeId, typeName) {
- var def = $q.defer();
- var sets = [];
-
- var config = {
- url: "/restservices/clds/v1/clds/getDispatcherInfo",
- method: "GET",
- params: {
- model: modelName,
- typeId: typeId,
- typeName: typeName
- }
- };
- $http(config)
- .success(function(data) {
- def.resolve(data);
-
- })
- .error(function(data) {
- def.reject("manage action not successful");
- });
-
- return def.promise;
-
- };
- this.checkPermittedActionCd = function(permittedActionCd, menuText, actionCd) {
- if (permittedActionCd.indexOf(actionCd) > -1) {
- document.getElementById(menuText).classList.remove('ThisLink');
- } else {
- document.getElementById(menuText).classList.add('ThisLink');
- }
- };
- this.processActionResponse = function(modelName, pars) {
-
- // populate control name (prefix and uuid here)
- var controlNamePrefix = pars.controlNamePrefix;
- var controlNameUuid = pars.controlNameUuid;
- deploymentId = pars.deploymentId;
- var modelEventService = pars.modelEventService;
- typeID = pars.typeId;
-
- var headerText = "Closed Loop Modeler - " + modelName;
- if (controlNameUuid != null) {
- var actionCd = pars.event.actionCd;
- var actionStateCd = pars.event.actionStateCd;
- //headerText = headerText + " [" + controlNamePrefix + controlNameUuid + "] [" + actionCd + ":" + actionStateCd + "]";
- headerText = headerText + " [" + controlNamePrefix + controlNameUuid + "]";
- }
-
- document.getElementById("modeler_name").textContent = headerText;
- document.getElementById("templa_name").textContent = ("Template Used - " + selected_template);
- setStatus(pars)
- addSVG(pars);
- this.enableDisableMenuOptions(pars);
-
-
- };
-
- this.processRefresh = function(pars) {
- var newPars = pars;
- if (typeof pars.body !== 'undefined') {
- newPars = pars.body;
- }
- typeID = newPars.typeId;
- deploymentId = newPars.deploymentId;
- setStatus(newPars);
- this.enableDisableMenuOptions(newPars);
- elementMap = JSON.parse(newPars.propText);
- }
-
- function setStatus(pars) {
-
- var status = pars.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") {
- 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;
- }
-
-
- var statusMsg = '<span style="background-color:' + statusColor + ';-moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px;">&nbsp;&nbsp;&nbsp;' + status + '&nbsp;&nbsp;&nbsp;</span>';
- // display status
- if ($("#status_clds").length >= 1)
- $("#status_clds").remove();
- $("#activity_modeler").append('<span id="status_clds" style="position: absolute; left: 61%;top: 151px; font-size:20px;">Status: ' + statusMsg + '</span>');
-
-
- }
-
- function addSVG(pars) {
-
- var svg = pars.imageText.substring(pars.imageText.indexOf("<svg"))
- if ($("#svgContainer").length > 0)
- $("#svgContainer").remove();
- $("#js-canvas").append("<span id=\"svgContainer\">" + svg + "</span>");
- /* added code for height width viewBox */
- $("#svgContainer svg").removeAttr("height");
- $("#svgContainer svg").removeAttr('viewBox');
- $("#svgContainer svg").removeAttr('width');
-
- $("#svgContainer svg").attr('width', '100%');
- $("#svgContainer svg").attr('height', '100%');
-
- $("#svgContainer").click(function(event) {
- //console.log($(event.target).parent().html())
- //console.log($($(event.target).parent()).attr("data-element-id"))
- var name = $($(event.target).parent()).attr("data-element-id")
- lastElementSelected = $($(event.target).parent()).attr("data-element-id")
- checkIfElementType(name)
-
- });
- }
- this.enableDisableMenuOptions = function(pars) {
-
- var permittedActionCd = pars.permittedActionCd;
-
- //dropdown options - always true
- document.getElementById('Open CL').classList.remove('ThisLink');
-
- if (readMOnly) {
- //enable model options
- document.getElementById('Properties CL').classList.remove('ThisLink');
- document.getElementById('Close Model').classList.remove('ThisLink');
-
- //disable models options
- document.getElementById('Create CL').classList.add('ThisLink');
- document.getElementById('Save CL').classList.add('ThisLink');
- document.getElementById('Revert Model Changes').classList.add('ThisLink');
- } else {
- // enable menu options
- document.getElementById('Create CL').classList.remove('ThisLink');
- document.getElementById('Save CL').classList.remove('ThisLink');
- document.getElementById('Properties CL').classList.remove('ThisLink');
- document.getElementById('Revert Model Changes').classList.remove('ThisLink');
- document.getElementById('Close Model').classList.remove('ThisLink');
-
-
- document.getElementById('Validation Test').classList.remove('ThisLink');
- document.getElementById('Refresh Status').classList.remove('ThisLink');
- document.getElementById('Refresh ASDC').classList.remove('ThisLink');
- }
-
- // enable/disable menu options based on permittedActionCd list
- this.checkPermittedActionCd(permittedActionCd, 'Validation Test', 'TEST');
- this.checkPermittedActionCd(permittedActionCd, 'Submit', 'SUBMIT');
- this.checkPermittedActionCd(permittedActionCd, 'Resubmit', 'RESUBMIT');
- this.checkPermittedActionCd(permittedActionCd, 'Update', 'UPDATE');
- this.checkPermittedActionCd(permittedActionCd, 'Stop', 'STOP');
- this.checkPermittedActionCd(permittedActionCd, 'Restart', 'RESTART');
- this.checkPermittedActionCd(permittedActionCd, 'Delete', 'DELETE');
- this.checkPermittedActionCd(permittedActionCd, 'Deploy', 'DEPLOY');
- this.checkPermittedActionCd(permittedActionCd, 'UnDeploy', 'UNDEPLOY');
-
- }
-
-
- this.getASDCServices().then(function(pars) {
- var obj = JSON.parse(pars);
- var services = obj.service;
- asdc_Services = services
- });
-
-}]);
+app
+.service(
+'cldsModelService',
+[
+ 'alertService',
+ '$http',
+ '$q',
+ function(alertService, $http, $q) {
+
+ function checkIfElementType(name) {
+
+ // This will open the methods located in the app.js
+ if (undefined == name) {
+ return;
+ }
+ mapping = {
+ 'tca' : TCAWindow,
+ 'policy' : PolicyWindow,
+ 'vescollector' : VesCollectorWindow,
+ 'holmes' : HolmesWindow,
+ };
+ key = name.split('_')[0].toLowerCase()
+ if (key in mapping) {
+ mapping[key]();
+ }
+ }
+ function handleQueryToBackend(def, svcAction, svcUrl, svcPayload) {
+
+ $http.put(svcUrl, svcPayload).success(
+ function(data) {
+
+ def.resolve(data);
+ if (typeof data.statusCodeValue === 'undefined'
+ || data.statusCodeValue === 200) {
+ alertService.alertMessage(
+ "Action Successful: " + svcAction, 1)
+ } else {
+ if (typeof data.body !== 'undefined') {
+ alertService.alertMessage("Action Failure: "
+ + svcAction + ", " + data.body.errorMessageForUi, 2);
+ } else {
+ alertService.alertMessage("Action Failure: "
+ + svcAction, 2);
+ }
+ def.reject(svcAction + " not successful");
+ }
+ }).error(
+ function(data) {
+
+ def.resolve(data);
+ if (typeof data.body !== 'undefined') {
+ alertService.alertMessage("Action Failure: " + svcAction
+ + ", " + data.body.errorMessageForUi, 2);
+ } else {
+ alertService
+ .alertMessage("Action Failure: " + svcAction, 2);
+ }
+ def.reject(svcAction + " not successful");
+ });
+ }
+ this.toggleDeploy = function(uiAction, modelName, controlNamePrefixIn,
+ bpmnTextIn, propTextIn, svgXmlIn,
+ templateName, typeID, controlNameUuid,
+ modelEventService, deploymentId) {
+
+ var def = $q.defer();
+ var sets = [];
+ var action = uiAction.toLowerCase();
+ var deployUrl = "/restservices/clds/v1/clds/" + action + "/"
+ + modelName;
+ var requestData = {
+ name : modelName,
+ controlNamePrefix : controlNamePrefixIn,
+ bpmnText : bpmnTextIn,
+ propText : propTextIn,
+ imageText : svgXmlIn,
+ templateName : templateName,
+ typeId : typeID,
+ controlNameUuid : controlNameUuid,
+ event : modelEventService,
+ deploymentId : deploymentId
+ };
+ handleQueryToBackend(def, action, deployUrl, requestData);
+ return def.promise;
+ };
+ this.getASDCServices = function() {
+
+ var def = $q.defer();
+ var sets = [];
+ var svcUrl = "/restservices/clds/v1/clds/sdc/services/";
+ $http.get(svcUrl).success(function(data) {
+
+ def.resolve(data);
+ }).error(function(data) {
+
+ def.reject("sdc Services not found");
+ });
+ return def.promise;
+ };
+ this.getASDCService = function(uuid) {
+
+ var def = $q.defer();
+ var sets = [];
+ var svcUrl = "/restservices/clds/v1/clds/sdc/services/" + uuid;
+ $http.get(svcUrl).success(function(data) {
+
+ def.resolve(data);
+ }).error(function(data) {
+
+ def.reject("SDC service not found");
+ });
+ return def.promise;
+ };
+ this.getModel = function(modelName) {
+
+ var def = $q.defer();
+ var sets = [];
+ var svcUrl = "/restservices/clds/v1/clds/model/" + modelName;
+ $http.get(svcUrl).success(function(data) {
+
+ def.resolve(data);
+ }).error(function(data) {
+
+ def.reject("Open Model not successful");
+ });
+ return def.promise;
+ };
+ this.getSavedModel = function() {
+
+ var def = $q.defer();
+ var sets = [];
+ var svcUrl = "/restservices/clds/v1/clds/model-names";
+ $http.get(svcUrl).success(function(data) {
+
+ def.resolve(data);
+ }).error(function(data) {
+
+ def.reject("Open Model not successful");
+ });
+ 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) {
+
+ 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);
+ return def.promise;
+ };
+ this.manageAction = function(modelName, typeId, typeName) {
+
+ var def = $q.defer();
+ var sets = [];
+ var config = {
+ url : "/restservices/clds/v1/clds/getDispatcherInfo",
+ method : "GET",
+ params : {
+ model : modelName,
+ typeId : typeId,
+ typeName : typeName
+ }
+ };
+ $http(config).success(function(data) {
+
+ def.resolve(data);
+ }).error(function(data) {
+
+ def.reject("manage action not successful");
+ });
+ return def.promise;
+ };
+ this.checkPermittedActionCd = function(permittedActionCd, menuText,
+ actionCd) {
+
+ if (permittedActionCd.indexOf(actionCd) > -1) {
+ document.getElementById(menuText).classList.remove('ThisLink');
+ } else {
+ document.getElementById(menuText).classList.add('ThisLink');
+ }
+ };
+ this.processActionResponse = function(modelName, pars) {
+
+ // populate control name (prefix and uuid here)
+ var controlNamePrefix = pars.controlNamePrefix;
+ var controlNameUuid = pars.controlNameUuid;
+ deploymentId = pars.deploymentId;
+ var modelEventService = pars.modelEventService;
+ typeID = pars.typeId;
+ var headerText = "Closed Loop Modeler - " + modelName;
+ if (controlNameUuid != null) {
+ var actionCd = pars.event.actionCd;
+ var actionStateCd = pars.event.actionStateCd;
+ headerText = headerText + " [" + controlNamePrefix
+ + controlNameUuid + "]";
+ }
+ document.getElementById("modeler_name").textContent = headerText;
+ document.getElementById("templa_name").textContent = ("Template Used - " + selected_template);
+ setStatus(pars)
+ addSVG(pars);
+ this.enableDisableMenuOptions(pars);
+ };
+ this.processRefresh = function(pars) {
+
+ var newPars = pars;
+ if (typeof pars.body !== 'undefined') {
+ newPars = pars.body;
+ }
+ typeID = newPars.typeId;
+ deploymentId = newPars.deploymentId;
+ setStatus(newPars);
+ this.enableDisableMenuOptions(newPars);
+ elementMap = JSON.parse(newPars.propText);
+ }
+ function setStatus(pars) {
+
+ var status = pars.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") {
+ 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;
+ }
+ var statusMsg = '<span style="background-color:'
+ + statusColor
+ + ';-moz-border-radius: 50px; -webkit-border-radius: 50px; border-radius: 50px;">&nbsp;&nbsp;&nbsp;'
+ + status + '&nbsp;&nbsp;&nbsp;</span>';
+ // display status
+ if ($("#status_clds").length >= 1)
+ $("#status_clds").remove();
+ $("#activity_modeler")
+ .append(
+ '<span id="status_clds" style="position: absolute; left: 61%;top: 151px; font-size:20px;">Status: '
+ + statusMsg + '</span>');
+ }
+ function addSVG(pars) {
+
+ var svg = pars.imageText.substring(pars.imageText.indexOf("<svg"))
+ if ($("#svgContainer").length > 0)
+ $("#svgContainer").remove();
+ $("#js-canvas").append(
+ "<span id=\"svgContainer\">" + svg + "</span>");
+ /* added code for height width viewBox */
+ $("#svgContainer svg").removeAttr("height");
+ $("#svgContainer svg").removeAttr('viewBox');
+ $("#svgContainer svg").removeAttr('width');
+ $("#svgContainer svg").attr('width', '100%');
+ $("#svgContainer svg").attr('height', '100%');
+ $("#svgContainer").click(
+ function(event) {
+
+ // console.log($(event.target).parent().html())
+ // console.log($($(event.target).parent()).attr("data-element-id"))
+ var name = $($(event.target).parent()).attr("data-element-id")
+ lastElementSelected = $($(event.target).parent()).attr(
+ "data-element-id")
+ checkIfElementType(name)
+ });
+ }
+ this.enableDisableMenuOptions = function(pars) {
+
+ var permittedActionCd = pars.permittedActionCd;
+ // dropdown options - always true
+ document.getElementById('Open CL').classList.remove('ThisLink');
+ if (readMOnly) {
+ // enable model options
+ document.getElementById('Properties CL').classList
+ .remove('ThisLink');
+ document.getElementById('Close Model').classList
+ .remove('ThisLink');
+ // disable models options
+ document.getElementById('Create CL').classList.add('ThisLink');
+ document.getElementById('Save CL').classList.add('ThisLink');
+ document.getElementById('Revert Model Changes').classList
+ .add('ThisLink');
+ } else {
+ // enable menu options
+ document.getElementById('Create CL').classList
+ .remove('ThisLink');
+ document.getElementById('Save CL').classList.remove('ThisLink');
+ document.getElementById('Properties CL').classList
+ .remove('ThisLink');
+ document.getElementById('Revert Model Changes').classList
+ .remove('ThisLink');
+ document.getElementById('Close Model').classList
+ .remove('ThisLink');
+ document.getElementById('Validation Test').classList
+ .remove('ThisLink');
+ document.getElementById('Refresh Status').classList
+ .remove('ThisLink');
+ document.getElementById('Refresh ASDC').classList
+ .remove('ThisLink');
+ }
+ // enable/disable menu options based on permittedActionCd
+ // list
+ this.checkPermittedActionCd(permittedActionCd, 'Validation Test',
+ 'TEST');
+ this.checkPermittedActionCd(permittedActionCd, 'Submit', 'SUBMIT');
+ this.checkPermittedActionCd(permittedActionCd, 'Resubmit',
+ 'RESUBMIT');
+ this.checkPermittedActionCd(permittedActionCd, 'Update', 'UPDATE');
+ this.checkPermittedActionCd(permittedActionCd, 'Stop', 'STOP');
+ this
+ .checkPermittedActionCd(permittedActionCd, 'Restart', 'RESTART');
+ this.checkPermittedActionCd(permittedActionCd, 'Delete', 'DELETE');
+ this.checkPermittedActionCd(permittedActionCd, 'Deploy', 'DEPLOY');
+ this.checkPermittedActionCd(permittedActionCd, 'UnDeploy',
+ 'UNDEPLOY');
+ }
+ this.getASDCServices().then(function(pars) {
+
+ var obj = JSON.parse(pars);
+ var services = obj.service;
+ asdc_Services = services
+ });
+ } ]);
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 d01016ae..9dc104b1 100644
--- a/src/main/resources/META-INF/resources/designer/scripts/app.js
+++ b/src/main/resources/META-INF/resources/designer/scripts/app.js
@@ -26,49 +26,54 @@ var app = angular
.module(
'clds-app',
[ 'ngRoute', 'ngResource', 'ui.bootstrap', 'angular-loading-bar', 'ngAnimate',
-'dialogs.main', 'ngSanitize', 'ngCookies', 'ui.bootstrap.modal' ])
+ 'dialogs.main', 'ngSanitize', 'ngCookies', 'ui.bootstrap.modal' ])
.config([ 'cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
+
cfpLoadingBarProvider.includeBar = true;
cfpLoadingBarProvider.includeSpinner = true;
} ])
.config(function($httpProvider) {
+
$httpProvider.interceptors.push('myHttpInterceptor');
var spinnerFunction = function spinnerFunction(data, headersGetter) {
+
return data;
};
$httpProvider.defaults.transformRequest.push(spinnerFunction);
})
.config(
[
-'$routeProvider',
-'$locationProvider',
-'$compileProvider',
-'cfpLoadingBarProvider',
-function($routeProvider, $locationProvider, cfpLoadingBarProvider, $timeout,
- dialogs, $cookies) {
- $locationProvider.html5Mode(false);
- $routeProvider.when('/otherwise', {
- templateUrl : 'please_wait.html',
- controller : 'QueryParamsHandlerCtrl'
- }).when('/dashboard', {
- templateUrl : 'partials/portfolios/clds_modelling.html',
- controller : 'DashboardCtrl'
- }).when('/activity_modelling', {
- templateUrl : 'partials/portfolios/clds_modelling.html',
- controller : 'DashboardCtrl'
- }).when('/authenticate', {
- templateUrl : 'authenticate.html',
- controller : 'AuthenticateCtrl'
- }).when('/invalidlogin', {
- templateUrl : 'invalid_login.html',
- controller : 'PageUnderConstructionCtrl'
- }).otherwise({
- redirectTo : '/otherwise'
- });
-} ])
+ '$routeProvider',
+ '$locationProvider',
+ '$compileProvider',
+ 'cfpLoadingBarProvider',
+ function($routeProvider, $locationProvider, cfpLoadingBarProvider,
+ $timeout, dialogs, $cookies) {
+
+ $locationProvider.html5Mode(false);
+ $routeProvider.when('/otherwise', {
+ templateUrl : 'please_wait.html',
+ controller : 'QueryParamsHandlerCtrl'
+ }).when('/dashboard', {
+ templateUrl : 'partials/portfolios/clds_modelling.html',
+ controller : 'DashboardCtrl'
+ }).when('/activity_modelling', {
+ templateUrl : 'partials/portfolios/clds_modelling.html',
+ controller : 'DashboardCtrl'
+ }).when('/authenticate', {
+ templateUrl : 'authenticate.html',
+ controller : 'AuthenticateCtrl'
+ }).when('/invalidlogin', {
+ templateUrl : 'invalid_login.html',
+ controller : 'PageUnderConstructionCtrl'
+ }).otherwise({
+ redirectTo : '/otherwise'
+ });
+ } ])
.controller(
'dialogCtrl',
function($scope, $rootScope, $timeout, dialogs) {
+
// -- Variables --//
$scope.lang = 'en-US';
$scope.language = 'English';
@@ -80,6 +85,7 @@ function($scope, $rootScope, $timeout, dialogs) {
};
// -- Listeners & Watchers --//
$scope.$watch('lang', function(val, old) {
+
switch (val) {
case 'en-US':
$scope.language = 'English';
@@ -93,10 +99,12 @@ function($scope, $rootScope, $timeout, dialogs) {
$rootScope.testCaseRequirements = [];
$rootScope.validTestRequirements = [];
$scope.setLanguage = function(lang) {
+
$scope.lang = lang;
$translate.use(lang);
};
$rootScope.launch = function(which) {
+
switch (which) {
case 'error':
dialogs.error();
@@ -111,22 +119,26 @@ function($scope, $rootScope, $timeout, dialogs) {
case 'confirm':
var dlg = dialogs.confirm();
dlg.result.then(function(btn) {
+
$scope.confirmed = 'You confirmed "Yes."';
}, function(btn) {
+
$scope.confirmed = 'You confirmed "No."';
});
break;
case 'custom':
var dlg = dialogs.create('/dialogs/custom.html',
'customDialogCtrl', {}, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
});
dlg.result.then(function(name) {
+
$scope.name = name;
}, function() {
+
if (angular.equals($scope.name, ''))
$scope.name = 'You did not enter in your name!';
});
@@ -149,8 +161,10 @@ function($scope, $rootScope, $timeout, dialogs) {
'Message',
'You are about to fetch real time federated coverage report.This may take sometime!!!.');
dlg.result.then(function(btn) {
+
$scope.confirmed = 'You confirmed "Yes."';
}, function(btn) {
+
$scope.confirmed = 'You confirmed "No."';
});
break;
@@ -165,7 +179,9 @@ function($scope, $rootScope, $timeout, dialogs) {
}
}; // end launch
var _fakeWaitProgress = function() {
+
$timeout(function() {
+
if (_progress < 100) {
_progress += 33;
$rootScope.$broadcast('dialogs.wait.progress', {
@@ -182,683 +198,798 @@ function($scope, $rootScope, $timeout, dialogs) {
.controller(
'MenuCtrl',
[
-'$scope',
-'$rootScope',
-'$timeout',
-'dialogs',
-'$location',
-'MenuService',
-'Datafactory',
-'userPreferencesService',
-'cldsModelService',
-'extraUserInfoService',
-function($scope, $rootScope, $timeout, dialogs, $location, MenuService,
- Datafactory, userPreferencesService, cldsModelService,
- extraUserInfoService) {
- console.log("MenuCtrl");
- $rootScope.screenName = "Universal Test Modeler";
- $rootScope.testSet = null;
- var testingType = "";
- $rootScope.contactUs = function() {
- console.log("contactUs");
- var link = "mailto:onap-discuss@lists.onap.org?subject=CLAMP&body=Please send us suggestions or feature enhancements or defect. If possible, please send us the steps to replicate any defect.";
- window.location.href = link;
- };
- extraUserInfoService.getUserInfo().then(function(pars) {
- $scope.userInfo = pars;
- if (!($scope.userInfo["permissionUpdateCl"])) {
- readMOnly = true;
- }
- ;
- });
- $scope.emptyMenuClick = function(value, name) {
- if ($rootScope.isNewClosed && name != "Save CL"
- && name != "Close Model" && name != "Properties CL") {
- saveConfirmationNotificationPopUp();
- } else {
- isSaveCheck(name);
- }
- function saveConfirmationNotificationPopUp() {
- $scope.saveConfirmationNotificationPopUp(function(data) {
- if (data) {
- if ($rootScope.isNewClosed) {
- isSaveCheck("Save CL");
- }
- $rootScope.isNewClosed = false;
- } else {
- return false;
- }
- });
- }
- function isSaveCheck(name) {
- if (name == "User Info") {
- $scope.extraUserInfo();
- } else if (name == "Wiki") {
- window.open(value);
- } else if (name == "Contact Us") {
- $rootScope.contactUs();
- } else if (name == "Revert Model Changes") {
- $scope.cldsRevertModel();
- } else if (name == "Close Model") {
- $scope.cldsClose();
- } else if (name == "Refresh ASDC") {
- $scope.cldsRefreshASDC();
- } else if (name == "Create CL") {
- $rootScope.isNewClosed = true;
- $scope.cldsCreateModel();
- } else if (name == "Open CL") {
- $scope.cldsOpenModel();
- } else if (name == "Save CL") {
- $rootScope.isNewClosed = false;
- $scope.cldsPerformAction("SAVE");
- } else if (name == "Validation Test") {
- $scope.cldsPerformAction("TEST");
- } else if (name == "Submit") {
- $scope.cldsConfirmPerformAction("SUBMIT");
- } else if (name == "Resubmit") {
- $scope.cldsConfirmPerformAction("RESUBMIT");
- } else if (name == "Update") {
- $scope.cldsConfirmPerformAction("UPDATE");
- } else if (name == "Delete") {
- $scope.cldsConfirmPerformAction("DELETE");
- } else if (name == "Stop") {
- $scope.cldsConfirmPerformAction("STOP");
- } else if (name == "Restart") {
- $scope.cldsConfirmPerformAction("RESTART");
- } else if (name == "Refresh Status") {
- $scope.refreshStatus();
- } else if (name == "Properties CL") {
- $scope.cldsOpenModelProperties();
- } else if (name == "Deploy") {
- $scope.cldsAskDeployParametersPerformAction();
- } else if (name == "UnDeploy") {
- $scope.cldsConfirmToggleDeployPerformAction("UnDeploy");
- } else {
- $rootScope.screenName = name;
- $scope.updatebreadcrumb(value);
- $location.path(value);
- }
- }
- };
- $rootScope.impAlerts = function() {
- };
- $scope.tabs = {
- "Closed Loop" : [ {
- link : "/cldsCreateModel",
- name : "Create CL"
- }, {
- link : "/cldsOpenModel",
- name : "Open CL"
- }, {
- link : "/cldsSaveModel",
- name : "Save CL"
- }, {
- link : "/cldsOpenModelProperties",
- name : "Properties CL"
- }, {
- link : "/RevertChanges",
- name : "Revert Model Changes"
- }, {
- link : "/Close",
- name : "Close Model"
- } ],
- "Manage" : [ {
- link : "/cldsTestActivate",
- name : "Validation Test"
- }, {
- link : "/cldsSubmit",
- name : "Submit"
- }, {
- link : "/cldsResubmit",
- name : "Resubmit"
- }, {
- link : "/cldsUpdate",
- name : "Update"
- }, {
- link : "/cldsStop",
- name : "Stop"
- }, {
- link : "/cldsRestart",
- name : "Restart"
- }, {
- link : "/cldsDelete",
- name : "Delete"
- }, {
- link : "/cldsDeploy",
- name : "Deploy"
- }, {
- link : "/cldsUnDeploy",
- name : "UnDeploy"
- } ],
- "View" : [ {
- link : "/refreshStatus",
- name : "Refresh Status"
- }, {
- link : "/cldsRefreshASDC",
- name : "Refresh ASDC"
- } ],
- "Help" : [ {
- link : "http://wiki.onap.org",
- name : "Wiki"
- }, {
- link : "/contact_us",
- name : "Contact Us"
- }, {
- link : "/extraUserInfo",
- name : "User Info"
- } ]
- };
- if (!Object.keys) {
- Object.keys = function(obj) {
- var keys = [];
- for ( var i in obj) {
- if (obj.hasOwnProperty(i)) {
- keys.push(i);
- }
- }
- return keys;
- };
- $scope.keyList = Object.keys($scope.tabs);
- } else {
- $scope.keyList = Object.keys($scope.tabs);
- }
- $scope.updatebreadcrumb = function(path) {
- var currentURL = $location.path();
- if (path != undefined) {
- currentURL = path;
- }
- if (currentURL == "/dashboard") {
- $rootScope.screenName = "Universal Test Modeler";
- $rootScope.parentMenu = "Home";
- $rootScope.rightTabName = "UTM Build Configuration";
- } else {
- var found = false;
- angular.forEach($scope.keyList, function(value, key) {
- if (!found) {
- $rootScope.parentMenu = value;
- angular.forEach($scope.tabs[value], function(value, key) {
- if (currentURL == value.link) {
- $rootScope.screenName = value.name;
- found = true;
- }
- });
- }
- });
- }
- };
- $scope.updatebreadcrumb();
- $scope.homePage = function() {
- $location.path('/dashboard');
- };
- $scope.propertyExplorerErrorMessage = function(msg) {
- var dlg = dialogs.notify('Error', msg);
- }
- $scope.reviewTestSet = function() {
- $rootScope.modeltestset = list_model_test_sets[selected_model];
- $rootScope.isPalette = false;
- $rootScope.isTestset = true;
- $rootScope.isRequirementCoverage = false;
- document.getElementById("modeler_name").textContent = "UTM Test Set";
- $('div').find('.k-collapse-next').click();
- };
- $scope.requirementCoverage = function() {
- $rootScope.testCaseRequirements = [];
- $rootScope.validTestRequirementArray = [];
- $rootScope.validTestRequirements = {};
- $rootScope.modeltestset = list_model_test_sets[selected_model];
- var allPathDetails = [];
- $scope.currentSelectedModel = {};
- $rootScope.pathDetailsList = list_model_path_details[selected_model];
- for (var x = 0; x < allPathDetails.length; x++) {
- var tempPathDetails = allPathDetails[x];
- if (tempPathDetails != null) {
- for (var i = 0; i < tempPathDetails.length; i++) {
- var pathDetails = tempPathDetails[i];
- if (pathDetails.requirement !== ''
- && pathDetails.requirement !== null) {
- $rootScope.testCaseRequirements
- .push(pathDetails.requirement);
- }
- }
- }
- }
- for (var p = 0; p < $rootScope.modeltestset.activityTestCases.length; p++) {
- var activityTestCases = $rootScope.modeltestset.activityTestCases[p];
- if (activityTestCases.mappedRequirements != null) {
- for (var i = 0; i < activityTestCases.mappedRequirements.length; i++) {
- var testCaseNames = $rootScope.validTestRequirements[activityTestCases.mappedRequirements[i]];
- if (testCaseNames == null) {
- testCaseNames = [];
- }
- if (activityTestCases.version != null)
- var testCase = activityTestCases.testCaseName + "_"
- + activityTestCases.version;
- else
- var testCase = activityTestCases.testCaseName;
- testCaseNames.push(testCase);
- $rootScope.validTestRequirements[activityTestCases.mappedRequirements[i]] = testCaseNames;
- }
- }
- }
- $rootScope.isPalette = false;
- $rootScope.isTestset = false;
- $rootScope.isRequirementCoverage = true;
- document.getElementById("modeler_name").textContent = "Test Case / Requirement Coverage";
- $('div').find('.k-collapse-next').click();
- };
- $scope.activityModelling = function() {
- };
- $scope.cldsClose = function() {
- var dlg = dialogs.create(
- 'partials/portfolios/confirmation_window.html', 'CldsOpenModelCtrl', {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- // $scope.name = name;
- }, function() {
- // if(angular.equals($scope.name,''))
- // $scope.name = 'You did not enter in your
- // name!';
- });
- };
- $scope.saveConfirmationNotificationPopUp = function(callBack) {
- var dlg = dialogs.create('partials/portfolios/save_confirmation.html',
- 'saveConfirmationModalPopUpCtrl', {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- callBack("OK");
- }, function() {
- callBack(null);
- });
- };
- $scope.cldsRefreshASDC = function() {
- var dlg = dialogs.create('partials/portfolios/refresh_asdc.html',
- 'CldsOpenModelCtrl', {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- }, function() {
- });
- }
- $scope.cldsRevertModel = function() {
- var dlg = dialogs.create(
- 'partials/portfolios/ConfirmRevertChanges.html', 'CldsOpenModelCtrl', {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- }, function() {
- });
- };
- $rootScope.cldsOpenModelProperties = function() {
- var dlg = dialogs.create('partials/portfolios/global_properties.html',
- 'GlobalPropertiesCtrl', {}, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- }, function() {
- });
- };
- $scope.cldsOpenModel = function() {
- var dlg = dialogs.create('partials/portfolios/clds_open_model.html',
- 'CldsOpenModelCtrl', {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- }, function() {
- });
- };
- $scope.cldsCreateModel = function() {
- var dlg = dialogs.create(
- 'partials/portfolios/clds_create_model_off_Template.html',
- 'CldsOpenModelCtrl', {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- }, function() {
- });
- };
- $scope.extraUserInfo = function() {
- var dlg = dialogs.create('partials/portfolios/extra_user_info.html',
- 'ExtraUserInfoCtrl', {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- }, function() {
- });
- };
- $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) {
- 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);
- cldsModelService.processRefresh(pars);
- }, function(data) {
- });
- };
- $scope.cldsConfirmPerformAction = function(uiAction) {
- var dlg = dialogs.confirm('Message', 'Do you want to '
- + uiAction.toLowerCase() + ' the closed loop?');
- dlg.result.then(function(btn) {
- $scope.cldsPerformAction(uiAction);
- }, function(btn) {
- });
- };
- $scope.cldsAskDeployParametersPerformAction = function() {
- var dlg = dialogs.create('partials/portfolios/deploy_parameters.html',
- 'DeploymentCtrl', {}, {
- keyboard : true,
- backdrop : true,
- windowClass : 'deploy-parameters'
- });
- dlg.result.then(function() {
- var confirm = dialogs.confirm('Deploy',
- 'Are you sure you want to deploy the closed loop?');
- confirm.result.then(function() {
- cldsToggleDeploy("deploy");
- });
- });
- };
- $scope.cldsConfirmToggleDeployPerformAction = function(uiAction) {
- var dlg = dialogs.confirm('Message', 'Do you want to '
- + uiAction.toLowerCase() + ' the closed loop?');
- dlg.result.then(function(btn) {
- cldsToggleDeploy(uiAction.toLowerCase());
- }, function(btn) {
- });
- };
- function cldsToggleDeploy(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 + " modelEventService="
- + modelEventService);
- console.log("cldsPerformAction: " + uiAction + " typeID=" + typeID);
- console.log("cldsPerformAction: " + uiAction + " deploymentId="
- + deploymentId);
- cldsModelService.toggleDeploy(uiAction, modelName, controlNamePrefix,
- bpmnText, propText, svgXml, templateName, typeID, controlNameUuid,
- modelEventService, deploymentId).then(function(pars) {
- typeID = pars.typeId;
- controlNameUuid = pars.controlNameUuid;
- selected_template = pars.templateName;
- modelEventService = pars.event;
- actionStateCd = pars.event.actionStateCd;
- deploymentId = pars.deploymentId;
- cldsModelService.processActionResponse(modelName, pars);
- }, function(data) {
- });
- }
+ '$scope',
+ '$rootScope',
+ '$timeout',
+ 'dialogs',
+ '$location',
+ 'MenuService',
+ 'Datafactory',
+ 'userPreferencesService',
+ 'cldsModelService',
+ 'extraUserInfoService',
+ function($scope, $rootScope, $timeout, dialogs, $location, MenuService,
+ Datafactory, userPreferencesService, cldsModelService,
+ extraUserInfoService) {
- $scope.VesCollectorWindow = function(vesCollector) {
- var dlg = dialogs.create(
- 'partials/portfolios/vesCollector_properties.html', 'ImportSchemaCtrl',
- {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- }, function() {
- });
- };
- $scope.HolmesWindow = function(holmes) {
- var partial = 'partials/portfolios/holmes_properties.html'
- var dlg = dialogs.create(partial, 'ImportSchemaCtrl', holmes, {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- };
- $scope.TCAWindow = function(tca) {
- var dlg = dialogs.create('partials/portfolios/tca_properties.html',
- 'ImportSchemaCtrl', {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- }, function() {
- });
- };
- $scope.PolicyWindow = function(policy) {
- var dlg = dialogs.create(
- 'partials/portfolios/PolicyWindow_properties.html', 'ImportSchemaCtrl',
- {
- closable : true,
- draggable : true
- }, {
- size : 'lg',
- keyboard : true,
- backdrop : 'static',
- windowClass : 'my-class'
- });
- dlg.result.then(function(name) {
- }, function() {
- });
- };
-} ]);
+ console.log("MenuCtrl");
+ $rootScope.screenName = "Universal Test Modeler";
+ $rootScope.testSet = null;
+ var testingType = "";
+ $rootScope.contactUs = function() {
+
+ console.log("contactUs");
+ var link = "mailto:onap-discuss@lists.onap.org?subject=CLAMP&body=Please send us suggestions or feature enhancements or defect. If possible, please send us the steps to replicate any defect.";
+ window.location.href = link;
+ };
+ extraUserInfoService.getUserInfo().then(function(pars) {
+
+ $scope.userInfo = pars;
+ if (!($scope.userInfo["permissionUpdateCl"])) {
+ readMOnly = true;
+ }
+ ;
+ });
+ $scope.emptyMenuClick = function(value, name) {
+
+ if ($rootScope.isNewClosed && name != "Save CL"
+ && name != "Close Model" && name != "Properties CL") {
+ saveConfirmationNotificationPopUp();
+ } else {
+ isSaveCheck(name);
+ }
+ function saveConfirmationNotificationPopUp() {
+
+ $scope.saveConfirmationNotificationPopUp(function(data) {
+
+ if (data) {
+ if ($rootScope.isNewClosed) {
+ isSaveCheck("Save CL");
+ }
+ $rootScope.isNewClosed = false;
+ } else {
+ return false;
+ }
+ });
+ }
+ function isSaveCheck(name) {
+
+ if (name == "User Info") {
+ $scope.extraUserInfo();
+ } else if (name == "Wiki") {
+ window.open(value);
+ } else if (name == "Contact Us") {
+ $rootScope.contactUs();
+ } else if (name == "Revert Model Changes") {
+ $scope.cldsRevertModel();
+ } else if (name == "Close Model") {
+ $scope.cldsClose();
+ } else if (name == "Refresh ASDC") {
+ $scope.cldsRefreshASDC();
+ } else if (name == "Create CL") {
+ $rootScope.isNewClosed = true;
+ $scope.cldsCreateModel();
+ } else if (name == "Open CL") {
+ $scope.cldsOpenModel();
+ } else if (name == "Save CL") {
+ $rootScope.isNewClosed = false;
+ $scope.cldsPerformAction("SAVE");
+ } else if (name == "Validation Test") {
+ $scope.cldsPerformAction("TEST");
+ } else if (name == "Submit") {
+ $scope.cldsConfirmPerformAction("SUBMIT");
+ } else if (name == "Resubmit") {
+ $scope.cldsConfirmPerformAction("RESUBMIT");
+ } else if (name == "Update") {
+ $scope.cldsConfirmPerformAction("UPDATE");
+ } else if (name == "Delete") {
+ $scope.cldsConfirmPerformAction("DELETE");
+ } else if (name == "Stop") {
+ $scope.cldsConfirmPerformAction("STOP");
+ } else if (name == "Restart") {
+ $scope.cldsConfirmPerformAction("RESTART");
+ } else if (name == "Refresh Status") {
+ $scope.refreshStatus();
+ } else if (name == "Properties CL") {
+ $scope.cldsOpenModelProperties();
+ } else if (name == "Deploy") {
+ $scope.cldsAskDeployParametersPerformAction();
+ } else if (name == "UnDeploy") {
+ $scope.cldsConfirmToggleDeployPerformAction("UnDeploy");
+ } else {
+ $rootScope.screenName = name;
+ $scope.updatebreadcrumb(value);
+ $location.path(value);
+ }
+ }
+ };
+ $rootScope.impAlerts = function() {
+
+ };
+ $scope.tabs = {
+ "Closed Loop" : [ {
+ link : "/cldsCreateModel",
+ name : "Create CL"
+ }, {
+ link : "/cldsOpenModel",
+ name : "Open CL"
+ }, {
+ link : "/cldsSaveModel",
+ name : "Save CL"
+ }, {
+ link : "/cldsOpenModelProperties",
+ name : "Properties CL"
+ }, {
+ link : "/RevertChanges",
+ name : "Revert Model Changes"
+ }, {
+ link : "/Close",
+ name : "Close Model"
+ } ],
+ "Manage" : [ {
+ link : "/cldsTestActivate",
+ name : "Validation Test"
+ }, {
+ link : "/cldsSubmit",
+ name : "Submit"
+ }, {
+ link : "/cldsResubmit",
+ name : "Resubmit"
+ }, {
+ link : "/cldsUpdate",
+ name : "Update"
+ }, {
+ link : "/cldsStop",
+ name : "Stop"
+ }, {
+ link : "/cldsRestart",
+ name : "Restart"
+ }, {
+ link : "/cldsDelete",
+ name : "Delete"
+ }, {
+ link : "/cldsDeploy",
+ name : "Deploy"
+ }, {
+ link : "/cldsUnDeploy",
+ name : "UnDeploy"
+ } ],
+ "View" : [ {
+ link : "/refreshStatus",
+ name : "Refresh Status"
+ }, {
+ link : "/cldsRefreshASDC",
+ name : "Refresh ASDC"
+ } ],
+ "Help" : [ {
+ link : "http://wiki.onap.org",
+ name : "Wiki"
+ }, {
+ link : "/contact_us",
+ name : "Contact Us"
+ }, {
+ link : "/extraUserInfo",
+ name : "User Info"
+ } ]
+ };
+ if (!Object.keys) {
+ Object.keys = function(obj) {
+
+ var keys = [];
+ for ( var i in obj) {
+ if (obj.hasOwnProperty(i)) {
+ keys.push(i);
+ }
+ }
+ return keys;
+ };
+ $scope.keyList = Object.keys($scope.tabs);
+ } else {
+ $scope.keyList = Object.keys($scope.tabs);
+ }
+ $scope.updatebreadcrumb = function(path) {
+
+ var currentURL = $location.path();
+ if (path != undefined) {
+ currentURL = path;
+ }
+ if (currentURL == "/dashboard") {
+ $rootScope.screenName = "Universal Test Modeler";
+ $rootScope.parentMenu = "Home";
+ $rootScope.rightTabName = "UTM Build Configuration";
+ } else {
+ var found = false;
+ angular.forEach($scope.keyList, function(value, key) {
+
+ if (!found) {
+ $rootScope.parentMenu = value;
+ angular.forEach($scope.tabs[value],
+ function(value, key) {
+
+ if (currentURL == value.link) {
+ $rootScope.screenName = value.name;
+ found = true;
+ }
+ });
+ }
+ });
+ }
+ };
+ $scope.updatebreadcrumb();
+ $scope.homePage = function() {
+
+ $location.path('/dashboard');
+ };
+ $scope.propertyExplorerErrorMessage = function(msg) {
+
+ var dlg = dialogs.notify('Error', msg);
+ }
+ $scope.reviewTestSet = function() {
+
+ $rootScope.modeltestset = list_model_test_sets[selected_model];
+ $rootScope.isPalette = false;
+ $rootScope.isTestset = true;
+ $rootScope.isRequirementCoverage = false;
+ document.getElementById("modeler_name").textContent = "UTM Test Set";
+ $('div').find('.k-collapse-next').click();
+ };
+ $scope.requirementCoverage = function() {
+
+ $rootScope.testCaseRequirements = [];
+ $rootScope.validTestRequirementArray = [];
+ $rootScope.validTestRequirements = {};
+ $rootScope.modeltestset = list_model_test_sets[selected_model];
+ var allPathDetails = [];
+ $scope.currentSelectedModel = {};
+ $rootScope.pathDetailsList = list_model_path_details[selected_model];
+ for (var x = 0; x < allPathDetails.length; x++) {
+ var tempPathDetails = allPathDetails[x];
+ if (tempPathDetails != null) {
+ for (var i = 0; i < tempPathDetails.length; i++) {
+ var pathDetails = tempPathDetails[i];
+ if (pathDetails.requirement !== ''
+ && pathDetails.requirement !== null) {
+ $rootScope.testCaseRequirements
+ .push(pathDetails.requirement);
+ }
+ }
+ }
+ }
+ for (var p = 0; p < $rootScope.modeltestset.activityTestCases.length; p++) {
+ var activityTestCases = $rootScope.modeltestset.activityTestCases[p];
+ if (activityTestCases.mappedRequirements != null) {
+ for (var i = 0; i < activityTestCases.mappedRequirements.length; i++) {
+ var testCaseNames = $rootScope.validTestRequirements[activityTestCases.mappedRequirements[i]];
+ if (testCaseNames == null) {
+ testCaseNames = [];
+ }
+ if (activityTestCases.version != null)
+ var testCase = activityTestCases.testCaseName + "_"
+ + activityTestCases.version;
+ else
+ var testCase = activityTestCases.testCaseName;
+ testCaseNames.push(testCase);
+ $rootScope.validTestRequirements[activityTestCases.mappedRequirements[i]] = testCaseNames;
+ }
+ }
+ }
+ $rootScope.isPalette = false;
+ $rootScope.isTestset = false;
+ $rootScope.isRequirementCoverage = true;
+ document.getElementById("modeler_name").textContent = "Test Case / Requirement Coverage";
+ $('div').find('.k-collapse-next').click();
+ };
+ $scope.activityModelling = function() {
+
+ };
+ $scope.cldsClose = function() {
+
+ var dlg = dialogs.create(
+ 'partials/portfolios/confirmation_window.html',
+ 'CldsOpenModelCtrl', {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ // $scope.name = name;
+ }, function() {
+
+ // if(angular.equals($scope.name,''))
+ // $scope.name = 'You did not enter in your
+ // name!';
+ });
+ };
+ $scope.saveConfirmationNotificationPopUp = function(callBack) {
+
+ var dlg = dialogs.create(
+ 'partials/portfolios/save_confirmation.html',
+ 'saveConfirmationModalPopUpCtrl', {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ callBack("OK");
+ }, function() {
+
+ callBack(null);
+ });
+ };
+ $scope.cldsRefreshASDC = function() {
+
+ var dlg = dialogs.create('partials/portfolios/refresh_asdc.html',
+ 'CldsOpenModelCtrl', {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ }, function() {
+
+ });
+ }
+ $scope.cldsRevertModel = function() {
+
+ var dlg = dialogs.create(
+ 'partials/portfolios/ConfirmRevertChanges.html',
+ 'CldsOpenModelCtrl', {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ }, function() {
+
+ });
+ };
+ $rootScope.cldsOpenModelProperties = function() {
+
+ var dlg = dialogs.create(
+ 'partials/portfolios/global_properties.html',
+ 'GlobalPropertiesCtrl', {}, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ }, function() {
+
+ });
+ };
+ $scope.cldsOpenModel = function() {
+
+ var dlg = dialogs.create(
+ 'partials/portfolios/clds_open_model.html', 'CldsOpenModelCtrl', {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ }, function() {
+
+ });
+ };
+ $scope.cldsCreateModel = function() {
+
+ var dlg = dialogs.create(
+ 'partials/portfolios/clds_create_model_off_Template.html',
+ 'CldsOpenModelCtrl', {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ }, function() {
+
+ });
+ };
+ $scope.extraUserInfo = function() {
+
+ var dlg = dialogs.create(
+ 'partials/portfolios/extra_user_info.html', 'ExtraUserInfoCtrl', {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ }, function() {
+
+ });
+ };
+ $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) {
+
+ 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);
+ cldsModelService.processRefresh(pars);
+ }, function(data) {
+
+ });
+ };
+ $scope.cldsConfirmPerformAction = function(uiAction) {
+
+ var dlg = dialogs.confirm('Message', 'Do you want to '
+ + uiAction.toLowerCase() + ' the closed loop?');
+ dlg.result.then(function(btn) {
+
+ $scope.cldsPerformAction(uiAction);
+ }, function(btn) {
+
+ });
+ };
+ $scope.cldsAskDeployParametersPerformAction = function() {
+
+ var dlg = dialogs.create(
+ 'partials/portfolios/deploy_parameters.html', 'DeploymentCtrl', {},
+ {
+ keyboard : true,
+ backdrop : true,
+ windowClass : 'deploy-parameters'
+ });
+ dlg.result.then(function() {
+
+ var confirm = dialogs.confirm('Deploy',
+ 'Are you sure you want to deploy the closed loop?');
+ confirm.result.then(function() {
+
+ cldsToggleDeploy("deploy");
+ });
+ });
+ };
+ $scope.cldsConfirmToggleDeployPerformAction = function(uiAction) {
+
+ var dlg = dialogs.confirm('Message', 'Do you want to '
+ + uiAction.toLowerCase() + ' the closed loop?');
+ dlg.result.then(function(btn) {
+
+ cldsToggleDeploy(uiAction.toLowerCase());
+ }, function(btn) {
+
+ });
+ };
+ function cldsToggleDeploy(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
+ + " modelEventService=" + modelEventService);
+ console.log("cldsPerformAction: " + uiAction + " typeID=" + typeID);
+ console.log("cldsPerformAction: " + uiAction + " deploymentId="
+ + deploymentId);
+ cldsModelService.toggleDeploy(uiAction, modelName,
+ controlNamePrefix, bpmnText, propText, svgXml, templateName,
+ typeID, controlNameUuid, modelEventService, deploymentId).then(
+ function(pars) {
+
+ var cldsObject = pars.body;
+ typeID = cldsObject.typeId;
+ controlNameUuid = cldsObject.controlNameUuid;
+ selected_template = cldsObject.templateName;
+ modelEventService = cldsObject.event;
+ actionStateCd = cldsObject.event.actionStateCd;
+ deploymentId = cldsObject.deploymentId;
+ cldsModelService.processActionResponse(modelName, cldsObject);
+ }, function(data) {
+
+ });
+ }
+ $scope.VesCollectorWindow = function(vesCollector) {
+
+ var dlg = dialogs.create(
+ 'partials/portfolios/vesCollector_properties.html',
+ 'ImportSchemaCtrl', {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ }, function() {
+
+ });
+ };
+ $scope.HolmesWindow = function(holmes) {
+
+ var partial = 'partials/portfolios/holmes_properties.html'
+ var dlg = dialogs.create(partial, 'ImportSchemaCtrl', holmes, {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ };
+ $scope.TCAWindow = function(tca) {
+
+ var dlg = dialogs.create('partials/portfolios/tca_properties.html',
+ 'ImportSchemaCtrl', {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ }, function() {
+
+ });
+ };
+ $scope.PolicyWindow = function(policy) {
+
+ var dlg = dialogs.create(
+ 'partials/portfolios/PolicyWindow_properties.html',
+ 'ImportSchemaCtrl', {
+ closable : true,
+ draggable : true
+ }, {
+ size : 'lg',
+ keyboard : true,
+ backdrop : 'static',
+ windowClass : 'my-class'
+ });
+ dlg.result.then(function(name) {
+
+ }, function() {
+
+ });
+ };
+ } ]);
app.service('MenuService', [ '$http', '$q', function($http, $q) {
+
} ]);
app.directive('focus', function($timeout) {
+
return {
- scope : {
- trigger : '@focus'
- },
- link : function(scope, element) {
- scope.$watch('trigger', function(value) {
- if (value === "true") {
- $timeout(function() {
- element[0].focus();
- });
- }
- });
- }
+ scope : {
+ trigger : '@focus'
+ },
+ link : function(scope, element) {
+
+ scope.$watch('trigger', function(value) {
+
+ if (value === "true") {
+ $timeout(function() {
+
+ element[0].focus();
+ });
+ }
+ });
+ }
};
});
app.directive('draggable', function($document) {
+
return function(scope, element, attr) {
+
var startX = 0, startY = 0, x = 0, y = 0;
element.css({
- position : 'relative',
- backgroundColor : 'white',
- cursor : 'move',
- display : 'block',
+ position : 'relative',
+ backgroundColor : 'white',
+ cursor : 'move',
+ display : 'block',
});
element.on('mousedown', function(event) {
+
startX = event.screenX - x;
startY = event.screenY - y;
$document.on('mousemove', mousemove);
$document.on('mouseup', mouseup);
});
function mousemove(event) {
+
y = event.screenY - startY;
x = event.screenX - startX;
element.css({
- top : y + 'px',
- left : x + 'px'
+ top : y + 'px',
+ left : x + 'px'
});
}
function mouseup() {
+
$document.off('mousemove', mousemove);
$document.off('mouseup', mouseup);
}
};
});
app.factory('myHttpInterceptor', function($q, $window) {
+
return function(promise) {
+
return promise.then(function(response) {
+
return response;
}, function(response) {
+
return $q.reject(response);
});
};
});
app.run([ '$route', function($route) {
+
$route.reload();
} ]);
function TestCtrl($scope) {
+
$scope.msg = "Hello from a controller method.";
$scope.returnHello = function() {
+
return $scope.msg;
}
}
function importshema() {
+
angular.element(document.getElementById('navbar')).scope().importSchema();
}
function VesCollectorWindow(vesCollectorWin) {
+
angular.element(document.getElementById('navbar')).scope()
.VesCollectorWindow(vesCollectorWin);
}
function HolmesWindow(holmesWin) {
+
angular.element(document.getElementById('navbar')).scope().HolmesWindow(
holmesWin);
}
function F5Window() {
+
angular.element(document.getElementById('navbar')).scope().F5Window();
}
function TCAWindow(tca) {
+
angular.element(document.getElementById('navbar')).scope().TCAWindow(tca);
}
function GOCWindow() {
+
angular.element(document.getElementById('navbar')).scope().GOCWindow();
}
function PolicyWindow(PolicyWin) {
+
angular.element(document.getElementById('navbar')).scope().PolicyWindow(
PolicyWin);
}
function pathDetails(bpmnElementID, bpmnElementName, pathIdentifiers) {
+
angular.element(document.getElementById('navbar')).scope().pathDetails(
bpmnElementID, bpmnElementName, pathIdentifiers);
}
function setdefaultvalue() {
+
angular.element(document.getElementById('navbar')).scope()
.setDefaultValue();
}
function upgradeSchemaVersion() {
+
angular.element(document.getElementById('navbar')).scope()
.upgradeSchemaVersion();
}
function saveProject() {
+
angular.element(document.getElementById('navbar')).scope().saveProject();
}
function modifySchema() {
+
angular.element(document.getElementById('navbar')).scope().modifySchema();
}
function definePID() {
+
angular.element(document.getElementById('navbar')).scope().definePID();
}
function defineServiceAcronym() {
+
angular.element(document.getElementById('navbar')).scope()
.defineServiceAcronym();
}
function errorProperty(msg) {
+
angular.element(document.getElementById('navbar')).scope()
.propertyExplorerErrorMessage(msg);
}
function invisiblepropertyExplorer() {
+
angular.element(document.getElementById('navbar')).scope()
.invisibleproperty();
}
function updateDecisionLabel(originalLabel, newLabel) {
+
angular.element(document.getElementById('navbar')).scope()
.updateDecisionLabels(originalLabel, newLabel);
}
// Used to logout the session , when browser window was closed
window.onunload = function() {
+
window.localStorage.removeItem("isAuth");
window.localStorage.removeItem("loginuser");
window.localStorage.removeItem("invalidUser");