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