* ===================================================================
*
*/
-
-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) {
- deploymentId = data.deploymentId;
- def.resolve(data);
- 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) {
- typeID = pars.typeId;
- deploymentId = pars.deploymentId;
- setStatus(pars);
- this.enableDisableMenuOptions(pars);
- elementMap = JSON.parse(pars.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;"> ' + status + ' </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 services = pars.service;
- asdc_Services = services
- });
-
-}]);
+app
+.service(
+'cldsModelService',
+[
+ 'alertService',
+ '$http',
+ '$q',
+ '$rootScope',
+ function(alertService, $http, $q, $rootScope) {
+
+ function checkIfElementType(name) {
+ //This will open the methods located in the app.js
+ if (undefined == name) {
+ return;
+ }else if (name.toLowerCase().indexOf("policy") >= 0){
+ PolicyWindow();
+ } else {
+ $rootScope.selectedBoxName = name;
+ 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
+ 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.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;
+ $("#loop_name").text(getLoopName());
+ 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/v2/loop/getAllNames";
+ $http.get(svcUrl).success(function(data) {
+
+ def.resolve(data);
+ }).error(function(data) {
+
+ def.reject("Open Model not successful");
+ });
+ return def.promise;
+ };
+ this.processAction = function(uiAction, modelName) {
+ var def = $q.defer();
+ var sets = [];
+ var svcAction = uiAction.toLowerCase();
+ var svcUrl = "/restservices/clds/v2/loop/" + 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) {
+
+ 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.processActionResponse = function(modelName) {
+ // populate control name (prefix and uuid here)
+ var headerText = "Closed Loop Modeler - " + modelName;
+ setStatus();
+ manageCLImage(modelName);
+ enableDisableMenuOptions();
+ };
+ this.processRefresh = function() {
+ setStatus();
+ enableDisableMenuOptions();
+ }
+ function setStatus() {
+ var status = getLastUpdatedStatus();
+ // 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;"> '
+ + status + ' </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 manageCLImage(modelName) {
+ getModelImage(modelName).then(function(pars) {
+ //var svg='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/2000/svg"> <defs> <marker viewBox="0 0 20 20" markerWidth="10" markerHeight="10" orient="auto" refX="11" refY="10" id="markerSjdype4kmnw"> <path d="M 1 5 L 11 10 L 1 15 Z" style="stroke-width: 1; stroke-linecap: round; stroke-dasharray: 10000, 1;" fill="#000000" /> </marker> <marker viewBox="0 0 20 20" markerWidth="20" markerHeight="20" orient="auto" refX="6" refY="6" id="markerSjdype4kmny"> <circle cx="6" cy="6" r="3.5" style="stroke-width: 1; stroke-linecap: round; stroke-dasharray: 10000, 1;" fill="#ffffff" stroke="#000000" /> </marker> <marker viewBox="0 0 20 20" markerWidth="20" markerHeight="20" orient="auto" refX="8.5" refY="5" id="markerSjdype4kmo0"> <path d="m 1 5 l 0 -3 l 7 3 l -7 3 z" style="stroke-width: 1; stroke-linecap: butt; stroke-dasharray: 10000, 1;" fill="#ffffff" stroke="#000000" /> </marker> <marker viewBox="0 0 20 20" markerWidth="10" markerHeight="10" orient="auto" refX="11" refY="10" id="markerSjdype4kmo2"> <path d="M 1 5 L 11 10 L 1 15" style="stroke-width: 1; stroke-linecap: round; stroke-dasharray: 10000, 1;" fill="#ffffff" stroke="#000000" /> </marker> <marker viewBox="0 0 20 20" markerWidth="10" markerHeight="10" orient="auto" refX="-1" refY="10" id="markerSjdype4kmo4"> <path d="M 0 10 L 8 6 L 16 10 L 8 14 Z" style="stroke-width: 1; stroke-linecap: round; stroke-dasharray: 10000, 1;" fill="#ffffff" stroke="#000000" /> </marker> <marker viewBox="0 0 20 20" markerWidth="10" markerHeight="10" orient="auto" refX="-5" refY="10" id="markerSjdype4kmo6"> <path d="M 1 4 L 5 16" style="stroke-width: 1; stroke-linecap: round; stroke-dasharray: 10000, 1;" fill="#000000" stroke="#000000" /> </marker> </defs><g fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" font-family="'Dialog'" font-style="normal" data-element-id="start-circle" stroke-linejoin="miter" font-size="12px" image-rendering="auto" stroke-dashoffset="0"><!--Generated by the Batik Graphics2D SVG Generator--> <defs id="genericDefs"/> <g> <g shape-rendering="geometricPrecision" text-rendering="optimizeQuality" stroke-width="2"> <circle fill="none" r="17" cx="34" cy="41"/> </g> </g> </g> <g fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" font-family="'Dialog'" font-style="normal" data-element-id="Arrow_d0b22360-770d-4b05-b81c-cf148b121341" stroke-linejoin="miter" font-size="12px" image-rendering="auto" stroke-dashoffset="0"><!--Generated by the Batik Graphics2D SVG Generator--> <defs id="genericDefs"/> <g> <g shape-rendering="geometricPrecision" text-rendering="optimizeQuality" stroke-width="2"> <line y2="41" fill="none" x1="51" x2="170" y1="41"/> <polygon fill="none" points=" 166 38 166 44 172 41"/> <polygon points=" 166 38 166 44 172 41" stroke="none"/> </g> </g> </g> <g fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" font-family="'Dialog'" font-style="normal" data-element-id="VES" stroke-linejoin="miter" font-size="12px" image-rendering="auto" stroke-dashoffset="0"><!--Generated by the Batik Graphics2D SVG Generator--> <defs id="genericDefs"/> <g> <g shape-rendering="geometricPrecision" text-rendering="optimizeQuality" stroke-width="2"> <rect fill="none" x="174" width="123" y="1" height="82"/> </g> <g fill-opacity="0" fill="rgb(0,0,0)" text-rendering="optimizeQuality" shape-rendering="geometricPrecision" stroke="rgb(0,0,0)" stroke-opacity="0" stroke-width="2"> <rect x="174" width="123" y="1" height="82" stroke="none"/> </g> <g font-family="sans-serif" shape-rendering="geometricPrecision" text-rendering="optimizeQuality"> <text x="223" xml:space="preserve" y="42" stroke="none">VES</text> <line y2="83" fill="none" stroke-width="2" x1="194" x2="194" y1="1"/> </g> </g> </g> <g fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" font-family="'Dialog'" font-style="normal" data-element-id="Arrow_d4351927-d77a-4e04-82d1-cd8f2b008137" stroke-linejoin="miter" font-size="12px" image-rendering="auto" stroke-dashoffset="0"><!--Generated by the Batik Graphics2D SVG Generator--> <defs id="genericDefs"/> <g> <g text-rendering="optimizeQuality" stroke-width="2" shape-rendering="geometricPrecision" font-family="sans-serif"> <line y2="41" fill="none" x1="297" x2="416" y1="41"/> <polygon fill="none" points=" 412 38 412 44 418 41"/> <polygon points=" 412 38 412 44 418 41" stroke="none"/> </g> </g> </g> <g fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" font-family="'Dialog'" font-style="normal" data-element-id="TCA" stroke-linejoin="miter" font-size="12px" image-rendering="auto" stroke-dashoffset="0"><!--Generated by the Batik Graphics2D SVG Generator--> <defs id="genericDefs"/> <g> <g text-rendering="optimizeQuality" stroke-width="2" shape-rendering="geometricPrecision" font-family="sans-serif"> <rect fill="none" x="420" width="123" y="1" height="82"/> </g> <g fill-opacity="0" fill="rgb(0,0,0)" text-rendering="optimizeQuality" font-family="sans-serif" shape-rendering="geometricPrecision" stroke="rgb(0,0,0)" stroke-opacity="0" stroke-width="2"> <rect x="420" width="123" y="1" height="82" stroke="none"/> </g> <g font-family="sans-serif" shape-rendering="geometricPrecision" text-rendering="optimizeQuality"> <text x="470" xml:space="preserve" y="42" stroke="none">TCA</text> <line y2="62" fill="none" stroke-width="2" x1="420" x2="543" y1="62"/> </g> </g> </g> <g fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" font-family="'Dialog'" font-style="normal" data-element-id="Arrow_5ae2966f-f971-4c3b-8237-efa551beb531" stroke-linejoin="miter" font-size="12px" image-rendering="auto" stroke-dashoffset="0"><!--Generated by the Batik Graphics2D SVG Generator--> <defs id="genericDefs"/> <g> <g text-rendering="optimizeQuality" stroke-width="2" shape-rendering="geometricPrecision" font-family="sans-serif"> <line y2="41" fill="none" x1="543" x2="662" y1="41"/> <polygon fill="none" points=" 658 38 658 44 664 41"/> <polygon points=" 658 38 658 44 664 41" stroke="none"/> </g> </g> </g> <g fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" font-family="'Dialog'" font-style="normal" data-element-id="Policy" stroke-linejoin="miter" font-size="12px" image-rendering="auto" stroke-dashoffset="0"><!--Generated by the Batik Graphics2D SVG Generator--> <defs id="genericDefs"/> <g> <g text-rendering="optimizeQuality" stroke-width="2" shape-rendering="geometricPrecision" font-family="sans-serif"> <rect fill="none" x="666" width="123" y="1" height="82"/> </g> <g fill-opacity="0" fill="rgb(0,0,0)" text-rendering="optimizeQuality" font-family="sans-serif" shape-rendering="geometricPrecision" stroke="rgb(0,0,0)" stroke-opacity="0" stroke-width="2"> <rect x="666" width="123" y="1" height="82" stroke="none"/> </g> <g font-family="sans-serif" shape-rendering="geometricPrecision" text-rendering="optimizeQuality"> <text x="710" xml:space="preserve" y="42" stroke="none">Policy</text> <line y2="1" fill="none" stroke-width="2" x1="666" x2="727" y1="42"/> </g> </g> </g> <g fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" font-family="'Dialog'" font-style="normal" data-element-id="Arrow_ed5ccaed-6d8c-44e9-8245-85f66523cb44" stroke-linejoin="miter" font-size="12px" image-rendering="auto" stroke-dashoffset="0"><!--Generated by the Batik Graphics2D SVG Generator--> <defs id="genericDefs"/> <g> <g text-rendering="optimizeQuality" stroke-width="2" shape-rendering="geometricPrecision" font-family="sans-serif"> <line y2="41" fill="none" x1="789" x2="908" y1="41"/> <polygon fill="none" points=" 904 38 904 44 910 41"/> <polygon points=" 904 38 904 44 910 41" stroke="none"/> </g> </g> </g> <g fill-opacity="1" color-rendering="auto" color-interpolation="auto" text-rendering="auto" stroke="black" stroke-linecap="square" stroke-miterlimit="10" shape-rendering="auto" stroke-opacity="1" fill="black" stroke-dasharray="none" font-weight="normal" stroke-width="1" font-family="'Dialog'" font-style="normal" data-element-id="circle_stop" stroke-linejoin="miter" font-size="12px" image-rendering="auto" stroke-dashoffset="0"><!--Generated by the Batik Graphics2D SVG Generator--> <defs id="genericDefs"/> <g> <g text-rendering="optimizeQuality" stroke-width="4" shape-rendering="geometricPrecision" font-family="sans-serif"> <circle fill="none" r="17" cx="929" cy="41"/> </g> </g> </g> </svg>';
+ var svg = pars;
+ if ($("#svgContainer").length > 0)
+ $("#svgContainer").remove();
+ $("#js-canvas").append(
+ "<span id=\"svgContainer\">" + svg + "</span>");
+ $("#svgContainer svg").attr('width', '100%');
+ $("#svgContainer svg").attr('height', '100%');
+ $("#svgContainer").click(
+ function(event) {
+ var name = $($($($(event.target).parent()).parent()).parent()).attr("data-element-id")
+ checkIfElementType(name)
+ });
+ }, function(data) {
+ });
+ }
+ enableDisableMenuOptions = function() {
+ enableDefaultMenu();
+ //var status = getStatus();
+ //enableActionMenu(status);
+ enableAllActionMenu();
+ }
+ getModelImage = function(modelName) {
+ var def = $q.defer();
+ var sets = [];
+ var svcUrl = "/restservices/clds/v2/loop/svgRepresentation/" + modelName;
+ $http.get(svcUrl).success(function(data) {
+ def.resolve(data);
+ }).error(function(data) {
+ def.reject("Not able to get the model image");
+ });
+ return def.promise;
+ };
+ } ]);