d01016aef8708ce8ffced7a11e27ababa8de40f3
[clamp.git] / src / main / resources / META-INF / resources / designer / scripts / app.js
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  * 
22  */
23 'use strict';
24 /* App Module */
25 var app = angular
26 .module(
27 'clds-app',
28 [ 'ngRoute', 'ngResource', 'ui.bootstrap', 'angular-loading-bar', 'ngAnimate',
29 'dialogs.main', 'ngSanitize', 'ngCookies', 'ui.bootstrap.modal' ])
30 .config([ 'cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
31         cfpLoadingBarProvider.includeBar = true;
32         cfpLoadingBarProvider.includeSpinner = true;
33 } ])
34 .config(function($httpProvider) {
35         $httpProvider.interceptors.push('myHttpInterceptor');
36         var spinnerFunction = function spinnerFunction(data, headersGetter) {
37                 return data;
38         };
39         $httpProvider.defaults.transformRequest.push(spinnerFunction);
40 })
41 .config(
42 [
43 '$routeProvider',
44 '$locationProvider',
45 '$compileProvider',
46 'cfpLoadingBarProvider',
47 function($routeProvider, $locationProvider, cfpLoadingBarProvider, $timeout,
48          dialogs, $cookies) {
49         $locationProvider.html5Mode(false);
50         $routeProvider.when('/otherwise', {
51         templateUrl : 'please_wait.html',
52         controller : 'QueryParamsHandlerCtrl'
53         }).when('/dashboard', {
54         templateUrl : 'partials/portfolios/clds_modelling.html',
55         controller : 'DashboardCtrl'
56         }).when('/activity_modelling', {
57         templateUrl : 'partials/portfolios/clds_modelling.html',
58         controller : 'DashboardCtrl'
59         }).when('/authenticate', {
60         templateUrl : 'authenticate.html',
61         controller : 'AuthenticateCtrl'
62         }).when('/invalidlogin', {
63         templateUrl : 'invalid_login.html',
64         controller : 'PageUnderConstructionCtrl'
65         }).otherwise({
66                 redirectTo : '/otherwise'
67         });
68 } ])
69 .controller(
70 'dialogCtrl',
71 function($scope, $rootScope, $timeout, dialogs) {
72         // -- Variables --//
73         $scope.lang = 'en-US';
74         $scope.language = 'English';
75         var _progress = 100;
76         $scope.name = '';
77         $scope.confirmed = 'No confirmation yet!';
78         $scope.custom = {
79                 val : 'Initial Value'
80         };
81         // -- Listeners & Watchers --//
82         $scope.$watch('lang', function(val, old) {
83                 switch (val) {
84                         case 'en-US':
85                                 $scope.language = 'English';
86                                 break;
87                         case 'es':
88                                 $scope.language = 'Spanish';
89                                 break;
90                 }
91         });
92         // -- Methods --//
93         $rootScope.testCaseRequirements = [];
94         $rootScope.validTestRequirements = [];
95         $scope.setLanguage = function(lang) {
96                 $scope.lang = lang;
97                 $translate.use(lang);
98         };
99         $rootScope.launch = function(which) {
100                 switch (which) {
101                         case 'error':
102                                 dialogs.error();
103                                 break;
104                         case 'wait':
105                                 break;
106                         case 'customwait':
107                                 break;
108                         case 'notify':
109                                 dialogs.notify();
110                                 break;
111                         case 'confirm':
112                                 var dlg = dialogs.confirm();
113                                 dlg.result.then(function(btn) {
114                                         $scope.confirmed = 'You confirmed "Yes."';
115                                 }, function(btn) {
116                                         $scope.confirmed = 'You confirmed "No."';
117                                 });
118                                 break;
119                         case 'custom':
120                                 var dlg = dialogs.create('/dialogs/custom.html',
121                                 'customDialogCtrl', {}, {
122                                 size : 'lg',
123                                 keyboard : true,
124                                 backdrop : 'static',
125                                 windowClass : 'my-class'
126                                 });
127                                 dlg.result.then(function(name) {
128                                         $scope.name = name;
129                                 }, function() {
130                                         if (angular.equals($scope.name, ''))
131                                                 $scope.name = 'You did not enter in your name!';
132                                 });
133                                 break;
134                         case 'custom2':
135                                 var dlg = dialogs.create('/dialogs/custom2.html',
136                                 'customDialogCtrl2', $scope.custom, {
137                                         size : 'lg'
138                                 });
139                                 break;
140                         case 'custom3':
141                                 var dlg = dialogs
142                                 .notify(
143                                 'Message',
144                                 'All is not supported, Please select interface(s)/version(s) to fetch real time federated coverage report.');
145                                 break;
146                         case 'custom4':
147                                 var dlg = dialogs
148                                 .confirm(
149                                 'Message',
150                                 'You are about to fetch real time federated coverage report.This may take sometime!!!.');
151                                 dlg.result.then(function(btn) {
152                                         $scope.confirmed = 'You confirmed "Yes."';
153                                 }, function(btn) {
154                                         $scope.confirmed = 'You confirmed "No."';
155                                 });
156                                 break;
157                         case 'custom5':
158                                 var dlg = dialogs.notify('Success',
159                                 'Request has been successfully processed.');
160                                 break;
161                         case 'custom6':
162                                 var dlg = dialogs.notify('Message',
163                                 'Please type Testscenario Name');
164                                 break;
165                 }
166         }; // end launch
167         var _fakeWaitProgress = function() {
168                 $timeout(function() {
169                         if (_progress < 100) {
170                                 _progress += 33;
171                                 $rootScope.$broadcast('dialogs.wait.progress', {
172                                         'progress' : _progress
173                                 });
174                                 _fakeWaitProgress();
175                         } else {
176                                 $rootScope.$broadcast('dialogs.wait.complete');
177                                 _progress = 0;
178                         }
179                 }, 1000);
180         };
181 })
182 .controller(
183 'MenuCtrl',
184 [
185 '$scope',
186 '$rootScope',
187 '$timeout',
188 'dialogs',
189 '$location',
190 'MenuService',
191 'Datafactory',
192 'userPreferencesService',
193 'cldsModelService',
194 'extraUserInfoService',
195 function($scope, $rootScope, $timeout, dialogs, $location, MenuService,
196          Datafactory, userPreferencesService, cldsModelService,
197          extraUserInfoService) {
198         console.log("MenuCtrl");
199         $rootScope.screenName = "Universal Test Modeler";
200         $rootScope.testSet = null;
201         var testingType = "";
202         $rootScope.contactUs = function() {
203                 console.log("contactUs");
204                 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.";
205                 window.location.href = link;
206         };
207         extraUserInfoService.getUserInfo().then(function(pars) {
208                 $scope.userInfo = pars;
209                 if (!($scope.userInfo["permissionUpdateCl"])) {
210                         readMOnly = true;
211                 }
212                 ;
213         });
214         $scope.emptyMenuClick = function(value, name) {
215                 if ($rootScope.isNewClosed && name != "Save CL"
216                 && name != "Close Model" && name != "Properties CL") {
217                         saveConfirmationNotificationPopUp();
218                 } else {
219                         isSaveCheck(name);
220                 }
221                 function saveConfirmationNotificationPopUp() {
222                         $scope.saveConfirmationNotificationPopUp(function(data) {
223                                 if (data) {
224                                         if ($rootScope.isNewClosed) {
225                                                 isSaveCheck("Save CL");
226                                         }
227                                         $rootScope.isNewClosed = false;
228                                 } else {
229                                         return false;
230                                 }
231                         });
232                 }
233                 function isSaveCheck(name) {
234                         if (name == "User Info") {
235                                 $scope.extraUserInfo();
236                         } else if (name == "Wiki") {
237                                 window.open(value);
238                         } else if (name == "Contact Us") {
239                                 $rootScope.contactUs();
240                         } else if (name == "Revert Model Changes") {
241                                 $scope.cldsRevertModel();
242                         } else if (name == "Close Model") {
243                                 $scope.cldsClose();
244                         } else if (name == "Refresh ASDC") {
245                                 $scope.cldsRefreshASDC();
246                         } else if (name == "Create CL") {
247                                 $rootScope.isNewClosed = true;
248                                 $scope.cldsCreateModel();
249                         } else if (name == "Open CL") {
250                                 $scope.cldsOpenModel();
251                         } else if (name == "Save CL") {
252                                 $rootScope.isNewClosed = false;
253                                 $scope.cldsPerformAction("SAVE");
254                         } else if (name == "Validation Test") {
255                                 $scope.cldsPerformAction("TEST");
256                         } else if (name == "Submit") {
257                                 $scope.cldsConfirmPerformAction("SUBMIT");
258                         } else if (name == "Resubmit") {
259                                 $scope.cldsConfirmPerformAction("RESUBMIT");
260                         } else if (name == "Update") {
261                                 $scope.cldsConfirmPerformAction("UPDATE");
262                         } else if (name == "Delete") {
263                                 $scope.cldsConfirmPerformAction("DELETE");
264                         } else if (name == "Stop") {
265                                 $scope.cldsConfirmPerformAction("STOP");
266                         } else if (name == "Restart") {
267                                 $scope.cldsConfirmPerformAction("RESTART");
268                         } else if (name == "Refresh Status") {
269                                 $scope.refreshStatus();
270                         } else if (name == "Properties CL") {
271                                 $scope.cldsOpenModelProperties();
272                         } else if (name == "Deploy") {
273                                 $scope.cldsAskDeployParametersPerformAction();
274                         } else if (name == "UnDeploy") {
275                                 $scope.cldsConfirmToggleDeployPerformAction("UnDeploy");
276                         } else {
277                                 $rootScope.screenName = name;
278                                 $scope.updatebreadcrumb(value);
279                                 $location.path(value);
280                         }
281                 }
282         };
283         $rootScope.impAlerts = function() {
284         };
285         $scope.tabs = {
286         "Closed Loop" : [ {
287         link : "/cldsCreateModel",
288         name : "Create CL"
289         }, {
290         link : "/cldsOpenModel",
291         name : "Open CL"
292         }, {
293         link : "/cldsSaveModel",
294         name : "Save CL"
295         }, {
296         link : "/cldsOpenModelProperties",
297         name : "Properties CL"
298         }, {
299         link : "/RevertChanges",
300         name : "Revert Model Changes"
301         }, {
302         link : "/Close",
303         name : "Close Model"
304         } ],
305         "Manage" : [ {
306         link : "/cldsTestActivate",
307         name : "Validation Test"
308         }, {
309         link : "/cldsSubmit",
310         name : "Submit"
311         }, {
312         link : "/cldsResubmit",
313         name : "Resubmit"
314         }, {
315         link : "/cldsUpdate",
316         name : "Update"
317         }, {
318         link : "/cldsStop",
319         name : "Stop"
320         }, {
321         link : "/cldsRestart",
322         name : "Restart"
323         }, {
324         link : "/cldsDelete",
325         name : "Delete"
326         }, {
327         link : "/cldsDeploy",
328         name : "Deploy"
329         }, {
330         link : "/cldsUnDeploy",
331         name : "UnDeploy"
332         } ],
333         "View" : [ {
334         link : "/refreshStatus",
335         name : "Refresh Status"
336         }, {
337         link : "/cldsRefreshASDC",
338         name : "Refresh ASDC"
339         } ],
340         "Help" : [ {
341         link : "http://wiki.onap.org",
342         name : "Wiki"
343         }, {
344         link : "/contact_us",
345         name : "Contact Us"
346         }, {
347         link : "/extraUserInfo",
348         name : "User Info"
349         } ]
350         };
351         if (!Object.keys) {
352                 Object.keys = function(obj) {
353                         var keys = [];
354                         for ( var i in obj) {
355                                 if (obj.hasOwnProperty(i)) {
356                                         keys.push(i);
357                                 }
358                         }
359                         return keys;
360                 };
361                 $scope.keyList = Object.keys($scope.tabs);
362         } else {
363                 $scope.keyList = Object.keys($scope.tabs);
364         }
365         $scope.updatebreadcrumb = function(path) {
366                 var currentURL = $location.path();
367                 if (path != undefined) {
368                         currentURL = path;
369                 }
370                 if (currentURL == "/dashboard") {
371                         $rootScope.screenName = "Universal Test Modeler";
372                         $rootScope.parentMenu = "Home";
373                         $rootScope.rightTabName = "UTM Build Configuration";
374                 } else {
375                         var found = false;
376                         angular.forEach($scope.keyList, function(value, key) {
377                                 if (!found) {
378                                         $rootScope.parentMenu = value;
379                                         angular.forEach($scope.tabs[value], function(value, key) {
380                                                 if (currentURL == value.link) {
381                                                         $rootScope.screenName = value.name;
382                                                         found = true;
383                                                 }
384                                         });
385                                 }
386                         });
387                 }
388         };
389         $scope.updatebreadcrumb();
390         $scope.homePage = function() {
391                 $location.path('/dashboard');
392         };
393         $scope.propertyExplorerErrorMessage = function(msg) {
394                 var dlg = dialogs.notify('Error', msg);
395         }
396         $scope.reviewTestSet = function() {
397                 $rootScope.modeltestset = list_model_test_sets[selected_model];
398                 $rootScope.isPalette = false;
399                 $rootScope.isTestset = true;
400                 $rootScope.isRequirementCoverage = false;
401                 document.getElementById("modeler_name").textContent = "UTM Test Set";
402                 $('div').find('.k-collapse-next').click();
403         };
404         $scope.requirementCoverage = function() {
405                 $rootScope.testCaseRequirements = [];
406                 $rootScope.validTestRequirementArray = [];
407                 $rootScope.validTestRequirements = {};
408                 $rootScope.modeltestset = list_model_test_sets[selected_model];
409                 var allPathDetails = [];
410                 $scope.currentSelectedModel = {};
411                 $rootScope.pathDetailsList = list_model_path_details[selected_model];
412                 for (var x = 0; x < allPathDetails.length; x++) {
413                         var tempPathDetails = allPathDetails[x];
414                         if (tempPathDetails != null) {
415                                 for (var i = 0; i < tempPathDetails.length; i++) {
416                                         var pathDetails = tempPathDetails[i];
417                                         if (pathDetails.requirement !== ''
418                                         && pathDetails.requirement !== null) {
419                                                 $rootScope.testCaseRequirements
420                                                 .push(pathDetails.requirement);
421                                         }
422                                 }
423                         }
424                 }
425                 for (var p = 0; p < $rootScope.modeltestset.activityTestCases.length; p++) {
426                         var activityTestCases = $rootScope.modeltestset.activityTestCases[p];
427                         if (activityTestCases.mappedRequirements != null) {
428                                 for (var i = 0; i < activityTestCases.mappedRequirements.length; i++) {
429                                         var testCaseNames = $rootScope.validTestRequirements[activityTestCases.mappedRequirements[i]];
430                                         if (testCaseNames == null) {
431                                                 testCaseNames = [];
432                                         }
433                                         if (activityTestCases.version != null)
434                                                 var testCase = activityTestCases.testCaseName + "_"
435                                                 + activityTestCases.version;
436                                         else
437                                                 var testCase = activityTestCases.testCaseName;
438                                         testCaseNames.push(testCase);
439                                         $rootScope.validTestRequirements[activityTestCases.mappedRequirements[i]] = testCaseNames;
440                                 }
441                         }
442                 }
443                 $rootScope.isPalette = false;
444                 $rootScope.isTestset = false;
445                 $rootScope.isRequirementCoverage = true;
446                 document.getElementById("modeler_name").textContent = "Test Case / Requirement Coverage";
447                 $('div').find('.k-collapse-next').click();
448         };
449         $scope.activityModelling = function() {
450         };
451         $scope.cldsClose = function() {
452                 var dlg = dialogs.create(
453                 'partials/portfolios/confirmation_window.html', 'CldsOpenModelCtrl', {
454                 closable : true,
455                 draggable : true
456                 }, {
457                 size : 'lg',
458                 keyboard : true,
459                 backdrop : 'static',
460                 windowClass : 'my-class'
461                 });
462                 dlg.result.then(function(name) {
463                         // $scope.name = name;
464                 }, function() {
465                         // if(angular.equals($scope.name,''))
466                         // $scope.name = 'You did not enter in your
467                         // name!';
468                 });
469         };
470         $scope.saveConfirmationNotificationPopUp = function(callBack) {
471                 var dlg = dialogs.create('partials/portfolios/save_confirmation.html',
472                 'saveConfirmationModalPopUpCtrl', {
473                 closable : true,
474                 draggable : true
475                 }, {
476                 size : 'lg',
477                 keyboard : true,
478                 backdrop : 'static',
479                 windowClass : 'my-class'
480                 });
481                 dlg.result.then(function(name) {
482                         callBack("OK");
483                 }, function() {
484                         callBack(null);
485                 });
486         };
487         $scope.cldsRefreshASDC = function() {
488                 var dlg = dialogs.create('partials/portfolios/refresh_asdc.html',
489                 'CldsOpenModelCtrl', {
490                 closable : true,
491                 draggable : true
492                 }, {
493                 size : 'lg',
494                 keyboard : true,
495                 backdrop : 'static',
496                 windowClass : 'my-class'
497                 });
498                 dlg.result.then(function(name) {
499                 }, function() {
500                 });
501         }
502         $scope.cldsRevertModel = function() {
503                 var dlg = dialogs.create(
504                 'partials/portfolios/ConfirmRevertChanges.html', 'CldsOpenModelCtrl', {
505                 closable : true,
506                 draggable : true
507                 }, {
508                 size : 'lg',
509                 keyboard : true,
510                 backdrop : 'static',
511                 windowClass : 'my-class'
512                 });
513                 dlg.result.then(function(name) {
514                 }, function() {
515                 });
516         };
517         $rootScope.cldsOpenModelProperties = function() {
518                 var dlg = dialogs.create('partials/portfolios/global_properties.html',
519                 'GlobalPropertiesCtrl', {}, {
520                 size : 'lg',
521                 keyboard : true,
522                 backdrop : 'static',
523                 windowClass : 'my-class'
524                 });
525                 dlg.result.then(function(name) {
526                 }, function() {
527                 });
528         };
529         $scope.cldsOpenModel = function() {
530                 var dlg = dialogs.create('partials/portfolios/clds_open_model.html',
531                 'CldsOpenModelCtrl', {
532                 closable : true,
533                 draggable : true
534                 }, {
535                 size : 'lg',
536                 keyboard : true,
537                 backdrop : 'static',
538                 windowClass : 'my-class'
539                 });
540                 dlg.result.then(function(name) {
541                 }, function() {
542                 });
543         };
544         $scope.cldsCreateModel = function() {
545                 var dlg = dialogs.create(
546                 'partials/portfolios/clds_create_model_off_Template.html',
547                 'CldsOpenModelCtrl', {
548                 closable : true,
549                 draggable : true
550                 }, {
551                 size : 'lg',
552                 keyboard : true,
553                 backdrop : 'static',
554                 windowClass : 'my-class'
555                 });
556                 dlg.result.then(function(name) {
557                 }, function() {
558                 });
559         };
560         $scope.extraUserInfo = function() {
561                 var dlg = dialogs.create('partials/portfolios/extra_user_info.html',
562                 'ExtraUserInfoCtrl', {
563                 closable : true,
564                 draggable : true
565                 }, {
566                 size : 'lg',
567                 keyboard : true,
568                 backdrop : 'static',
569                 windowClass : 'my-class'
570                 });
571                 dlg.result.then(function(name) {
572                 }, function() {
573                 });
574         };
575         $scope.cldsPerformAction = function(uiAction) {
576                 var modelName = selected_model;
577                 var controlNamePrefix = "ClosedLoop-";
578                 var bpmnText = modelXML;
579                 // serialize model properties
580                 var propText = JSON.stringify(elementMap);
581                 var templateName = selected_template
582                 var svgXml = $("#svgContainer").html();
583                 console.log("cldsPerformAction: " + uiAction + " modelName="
584                 + modelName);
585                 console.log("cldsPerformAction: " + uiAction + " controlNamePrefix="
586                 + controlNamePrefix);
587                 console.log("cldsPerformAction: " + uiAction + " bpmnText=" + bpmnText);
588                 console.log("cldsPerformAction: " + uiAction + " propText=" + propText);
589                 console.log("cldsPerformAction: " + uiAction + " typeID=" + typeID);
590                 console.log("cldsPerformAction: " + uiAction + " deploymentId="
591                 + deploymentId);
592                 cldsModelService.processAction(uiAction, modelName, controlNamePrefix,
593                 bpmnText, propText, svgXml, templateName, typeID, deploymentId).then(
594                 function(pars) {
595                         console.log("cldsPerformAction: pars=" + pars);
596                         cldsModelService.processRefresh(pars);
597                 }, function(data) {
598                 });
599         };
600         $scope.refreshStatus = function() {
601                 var modelName = selected_model;
602                 var svgXml = $("#svgContainer").html();
603                 console.log("refreStatus modelName=" + modelName);
604                 cldsModelService.getModel(modelName).then(function(pars) {
605                         console.log("refreStatus: pars=" + pars);
606                         cldsModelService.processRefresh(pars);
607                 }, function(data) {
608                 });
609         };
610         $scope.cldsConfirmPerformAction = function(uiAction) {
611                 var dlg = dialogs.confirm('Message', 'Do you want to '
612                 + uiAction.toLowerCase() + ' the closed loop?');
613                 dlg.result.then(function(btn) {
614                         $scope.cldsPerformAction(uiAction);
615                 }, function(btn) {
616                 });
617         };
618         $scope.cldsAskDeployParametersPerformAction = function() {
619                 var dlg = dialogs.create('partials/portfolios/deploy_parameters.html',
620                 'DeploymentCtrl', {}, {
621                 keyboard : true,
622                 backdrop : true,
623                 windowClass : 'deploy-parameters'
624                 });
625                 dlg.result.then(function() {
626                         var confirm = dialogs.confirm('Deploy',
627                         'Are you sure you want to deploy the closed loop?');
628                         confirm.result.then(function() {
629                                 cldsToggleDeploy("deploy");
630                         });
631                 });
632         };
633         $scope.cldsConfirmToggleDeployPerformAction = function(uiAction) {
634                 var dlg = dialogs.confirm('Message', 'Do you want to '
635                 + uiAction.toLowerCase() + ' the closed loop?');
636                 dlg.result.then(function(btn) {
637                         cldsToggleDeploy(uiAction.toLowerCase());
638                 }, function(btn) {
639                 });
640         };
641         function cldsToggleDeploy(uiAction) {
642                 var modelName = selected_model;
643                 var controlNamePrefix = "ClosedLoop-";
644                 var bpmnText = modelXML;
645                 // serialize model properties
646                 var propText = JSON.stringify(elementMap);
647                 var templateName = selected_template;
648                 var svgXml = $("#svgContainer").html();
649                 console.log("cldsPerformAction: " + uiAction + " modelName="
650                 + modelName);
651                 console.log("cldsPerformAction: " + uiAction + " controlNamePrefix="
652                 + controlNamePrefix);
653                 console.log("cldsPerformAction: " + uiAction + " bpmnText=" + bpmnText);
654                 console.log("cldsPerformAction: " + uiAction + " propText=" + propText);
655                 console.log("cldsPerformAction: " + uiAction + " modelEventService="
656                 + modelEventService);
657                 console.log("cldsPerformAction: " + uiAction + " typeID=" + typeID);
658                 console.log("cldsPerformAction: " + uiAction + " deploymentId="
659                 + deploymentId);
660                 cldsModelService.toggleDeploy(uiAction, modelName, controlNamePrefix,
661                 bpmnText, propText, svgXml, templateName, typeID, controlNameUuid,
662                 modelEventService, deploymentId).then(function(pars) {
663                         typeID = pars.typeId;
664                         controlNameUuid = pars.controlNameUuid;
665                         selected_template = pars.templateName;
666                         modelEventService = pars.event;
667                         actionStateCd = pars.event.actionStateCd;
668                         deploymentId = pars.deploymentId;
669                         cldsModelService.processActionResponse(modelName, pars);
670                 }, function(data) {
671                 });
672         }
673
674         $scope.VesCollectorWindow = function(vesCollector) {
675                 var dlg = dialogs.create(
676                 'partials/portfolios/vesCollector_properties.html', 'ImportSchemaCtrl',
677                 {
678                 closable : true,
679                 draggable : true
680                 }, {
681                 size : 'lg',
682                 keyboard : true,
683                 backdrop : 'static',
684                 windowClass : 'my-class'
685                 });
686                 dlg.result.then(function(name) {
687                 }, function() {
688                 });
689         };
690         $scope.HolmesWindow = function(holmes) {
691                 var partial = 'partials/portfolios/holmes_properties.html'
692                 var dlg = dialogs.create(partial, 'ImportSchemaCtrl', holmes, {
693                 closable : true,
694                 draggable : true
695                 }, {
696                 size : 'lg',
697                 keyboard : true,
698                 backdrop : 'static',
699                 windowClass : 'my-class'
700                 });
701         };
702         $scope.TCAWindow = function(tca) {
703                 var dlg = dialogs.create('partials/portfolios/tca_properties.html',
704                 'ImportSchemaCtrl', {
705                 closable : true,
706                 draggable : true
707                 }, {
708                 size : 'lg',
709                 keyboard : true,
710                 backdrop : 'static',
711                 windowClass : 'my-class'
712                 });
713                 dlg.result.then(function(name) {
714                 }, function() {
715                 });
716         };
717         $scope.PolicyWindow = function(policy) {
718                 var dlg = dialogs.create(
719                 'partials/portfolios/PolicyWindow_properties.html', 'ImportSchemaCtrl',
720                 {
721                 closable : true,
722                 draggable : true
723                 }, {
724                 size : 'lg',
725                 keyboard : true,
726                 backdrop : 'static',
727                 windowClass : 'my-class'
728                 });
729                 dlg.result.then(function(name) {
730                 }, function() {
731                 });
732         };
733 } ]);
734 app.service('MenuService', [ '$http', '$q', function($http, $q) {
735 } ]);
736 app.directive('focus', function($timeout) {
737         return {
738         scope : {
739                 trigger : '@focus'
740         },
741         link : function(scope, element) {
742                 scope.$watch('trigger', function(value) {
743                         if (value === "true") {
744                                 $timeout(function() {
745                                         element[0].focus();
746                                 });
747                         }
748                 });
749         }
750         };
751 });
752 app.directive('draggable', function($document) {
753         return function(scope, element, attr) {
754                 var startX = 0, startY = 0, x = 0, y = 0;
755                 element.css({
756                 position : 'relative',
757                 backgroundColor : 'white',
758                 cursor : 'move',
759                 display : 'block',
760                 });
761                 element.on('mousedown', function(event) {
762                         startX = event.screenX - x;
763                         startY = event.screenY - y;
764                         $document.on('mousemove', mousemove);
765                         $document.on('mouseup', mouseup);
766                 });
767                 function mousemove(event) {
768                         y = event.screenY - startY;
769                         x = event.screenX - startX;
770                         element.css({
771                         top : y + 'px',
772                         left : x + 'px'
773                         });
774                 }
775                 function mouseup() {
776                         $document.off('mousemove', mousemove);
777                         $document.off('mouseup', mouseup);
778                 }
779         };
780 });
781 app.factory('myHttpInterceptor', function($q, $window) {
782         return function(promise) {
783                 return promise.then(function(response) {
784                         return response;
785                 }, function(response) {
786                         return $q.reject(response);
787                 });
788         };
789 });
790 app.run([ '$route', function($route) {
791         $route.reload();
792 } ]);
793 function TestCtrl($scope) {
794         $scope.msg = "Hello from a controller method.";
795         $scope.returnHello = function() {
796                 return $scope.msg;
797         }
798 }
799 function importshema() {
800         angular.element(document.getElementById('navbar')).scope().importSchema();
801 }
802 function VesCollectorWindow(vesCollectorWin) {
803         angular.element(document.getElementById('navbar')).scope()
804         .VesCollectorWindow(vesCollectorWin);
805 }
806 function HolmesWindow(holmesWin) {
807         angular.element(document.getElementById('navbar')).scope().HolmesWindow(
808         holmesWin);
809 }
810 function F5Window() {
811         angular.element(document.getElementById('navbar')).scope().F5Window();
812 }
813 function TCAWindow(tca) {
814         angular.element(document.getElementById('navbar')).scope().TCAWindow(tca);
815 }
816 function GOCWindow() {
817         angular.element(document.getElementById('navbar')).scope().GOCWindow();
818 }
819 function PolicyWindow(PolicyWin) {
820         angular.element(document.getElementById('navbar')).scope().PolicyWindow(
821         PolicyWin);
822 }
823 function pathDetails(bpmnElementID, bpmnElementName, pathIdentifiers) {
824         angular.element(document.getElementById('navbar')).scope().pathDetails(
825         bpmnElementID, bpmnElementName, pathIdentifiers);
826 }
827 function setdefaultvalue() {
828         angular.element(document.getElementById('navbar')).scope()
829         .setDefaultValue();
830 }
831 function upgradeSchemaVersion() {
832         angular.element(document.getElementById('navbar')).scope()
833         .upgradeSchemaVersion();
834 }
835 function saveProject() {
836         angular.element(document.getElementById('navbar')).scope().saveProject();
837 }
838 function modifySchema() {
839         angular.element(document.getElementById('navbar')).scope().modifySchema();
840 }
841 function definePID() {
842         angular.element(document.getElementById('navbar')).scope().definePID();
843 }
844 function defineServiceAcronym() {
845         angular.element(document.getElementById('navbar')).scope()
846         .defineServiceAcronym();
847 }
848 function errorProperty(msg) {
849         angular.element(document.getElementById('navbar')).scope()
850         .propertyExplorerErrorMessage(msg);
851 }
852 function invisiblepropertyExplorer() {
853         angular.element(document.getElementById('navbar')).scope()
854         .invisibleproperty();
855 }
856 function updateDecisionLabel(originalLabel, newLabel) {
857         angular.element(document.getElementById('navbar')).scope()
858         .updateDecisionLabels(originalLabel, newLabel);
859 }
860 // Used to logout the session , when browser window was closed
861 window.onunload = function() {
862         window.localStorage.removeItem("isAuth");
863         window.localStorage.removeItem("loginuser");
864         window.localStorage.removeItem("invalidUser");
865 };