+ 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() {
+
+ });
+ };
+ } ]);