Merge "Wrong function call"
[clamp.git] / src / main / resources / META-INF / resources / designer / scripts / app.js
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2017 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  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23
24 'use strict';
25
26 /* App Module */
27
28 var app = angular.module('clds-app', ['ngRoute', 
29                                           'ngResource',
30                                           'angularjs-dropdown-multiselect',
31                                           'angularjs-dropdown-multiselect-new',
32                                           'hljs',
33                                           'ui.bootstrap',
34                                           'angular-loading-bar', 
35                                           'ngAnimate',
36                                           'dialogs.main',
37                                           'ui.grid', 
38                                           'ui.grid.resizeColumns',
39                                           'ui.grid.paging',
40                                           'ui.grid.selection',
41                                           'ui.grid.cellNav',
42                                           'ui.grid.pinning',
43                                           'ngSanitize',
44                                           'ngCookies',
45                                           'ui.bootstrap.modal',
46                                           'ui.grid.exporter',
47                                           'angucomplete',
48                                           'kendo.directives',
49                                           'angular-md5'
50                                           ])
51                 .config([ 'cfpLoadingBarProvider', function(cfpLoadingBarProvider) {
52
53                         cfpLoadingBarProvider.includeBar = true;
54                         cfpLoadingBarProvider.includeSpinner = true;
55                 } ])
56                 .config(
57                                 function($httpProvider) {
58
59                                         $httpProvider.responseInterceptors
60                                                         .push('myHttpInterceptor');
61
62                                         var spinnerFunction = function spinnerFunction(data,
63                                                         headersGetter) {
64
65                                                 return data;
66                                         };
67
68                                         $httpProvider.defaults.transformRequest
69                                                         .push(spinnerFunction);
70                                 })
71                 .config(
72                                 [
73                                                 '$routeProvider',
74                                                 '$locationProvider',
75                                                 '$compileProvider',
76                                                 'cfpLoadingBarProvider',
77                                                 function($routeProvider, $locationProvider,
78                                                                 cfpLoadingBarProvider, $timeout, dialogs,
79                                                                 $cookies) {
80                                                         console
81                                                                         .log("$routeProvider','$locationProvider', '$compileProvider','cfpLoadingBarProvider','md5'")
82                                                         $locationProvider.html5Mode(false);
83                                                         // alert("App.js");
84
85                                                         $routeProvider
86                                                                         .when('/otherwise', {
87                                                                                 templateUrl : 'please_wait.html',
88                                                                                 controller : QueryParamsHandlerCtrl
89                                                                         })
90                                                                         .
91                                                                         // when('/dashboard_submit', { templateUrl:
92                                                                         // 'partials/portfolios/dashboard_submit.html',
93                                                                         // controller: CreateNewPrjCtrl }).
94                                                                         when(
95                                                                                         '/dashboard',
96                                                                                         {
97                                                                                                 templateUrl : 'partials/portfolios/clds_modelling.html',
98                                                                                                 controller : DashboardCtrl
99                                                                                         })
100                                                                         .
101                                                                         // when('/dashboard_upload', { templateUrl:
102                                                                         // 'partials/portfolios/dashboard_upload.html',
103                                                                         // controller: DashboardCtrl }).
104                                                                         when(
105                                                                                         '/activity_modelling',
106                                                                                         {
107                                                                                                 templateUrl : 'partials/portfolios/clds_modelling.html',
108                                                                                                 controller : DashboardCtrl
109                                                                                         }).when('/authenticate', {
110                                                                                 templateUrl : 'authenticate.html',
111                                                                                 controller : AuthenticateCtrl
112                                                                         }).when('/invalidlogin', {
113                                                                                 templateUrl : 'invalid_login.html',
114                                                                                 controller : PageUnderConstructionCtrl
115                                                                         }).otherwise({
116                                                                                 redirectTo : '/otherwise'
117                                                                         });
118
119                                                 } ])
120                 .controller(
121                                 'dialogCtrl',
122                                 function($scope, $rootScope, $timeout, dialogs) {
123
124                                         // -- Variables --//
125
126                                         $scope.lang = 'en-US';
127                                         $scope.language = 'English';
128
129                                         var _progress = 100;
130
131                                         $scope.name = '';
132                                         $scope.confirmed = 'No confirmation yet!';
133
134                                         $scope.custom = {
135                                                 val : 'Initial Value'
136                                         };
137
138                                         // -- Listeners & Watchers --//
139
140                                         $scope.$watch('lang', function(val, old) {
141
142                                                 switch (val) {
143                                                 case 'en-US':
144                                                         $scope.language = 'English';
145                                                         break;
146                                                 case 'es':
147                                                         $scope.language = 'Spanish';
148                                                         break;
149                                                 }
150                                         });
151
152                                         // -- Methods --//
153                                         $rootScope.testCaseRequirements = [];
154                                         $rootScope.validTestRequirements = [];
155                                         /* $rootScope.testCaseValue=[]; */
156                                         $scope.setLanguage = function(lang) {
157
158                                                 $scope.lang = lang;
159                                                 $translate.use(lang);
160                                         };
161
162                                         $rootScope.launch = function(which) {
163
164                                                 switch (which) {
165                                                 case 'error':
166                                                         dialogs.error();
167                                                         break;
168                                                 case 'wait':
169                                                         // var dlg =
170                                                         // dialogs.wait(undefined,undefined,_progress);
171                                                         // _fakeWaitProgress();
172                                                         break;
173                                                 case 'customwait':
174                                                         // var dlg = dialogs.wait('Custom Wait
175                                                         // Header','Custom Wait Message',_progress);
176                                                         // _fakeWaitProgress();
177                                                         break;
178                                                 case 'notify':
179                                                         dialogs.notify();
180                                                         break;
181                                                 case 'confirm':
182                                                         var dlg = dialogs.confirm();
183                                                         dlg.result.then(function(btn) {
184
185                                                                 $scope.confirmed = 'You confirmed "Yes."';
186                                                         }, function(btn) {
187
188                                                                 $scope.confirmed = 'You confirmed "No."';
189                                                         });
190                                                         break;
191                                                 case 'custom':
192                                                         var dlg = dialogs.create('/dialogs/custom.html',
193                                                                         'customDialogCtrl', {}, {
194                                                                                 size : 'lg',
195                                                                                 keyboard : true,
196                                                                                 backdrop : 'static',
197                                                                                 windowClass : 'my-class'
198                                                                         });
199                                                         dlg.result
200                                                                         .then(
201                                                                                         function(name) {
202
203                                                                                                 $scope.name = name;
204                                                                                         },
205                                                                                         function() {
206
207                                                                                                 if (angular.equals($scope.name,
208                                                                                                                 ''))
209                                                                                                         $scope.name = 'You did not enter in your name!';
210                                                                                         });
211                                                         break;
212                                                 case 'custom2':
213                                                         var dlg = dialogs.create('/dialogs/custom2.html',
214                                                                         'customDialogCtrl2', $scope.custom, {
215                                                                                 size : 'lg'
216                                                                         });
217                                                         break;
218                                                 case 'custom3':
219                                                         var dlg = dialogs
220                                                                         .notify(
221                                                                                         'Message',
222                                                                                         'All is not supported, Please select interface(s)/version(s) to fetch real time federated coverage report.');
223                                                         break;
224                                                 case 'custom4':
225                                                         var dlg = dialogs
226                                                                         .confirm(
227                                                                                         'Message',
228                                                                                         'You are about to fetch real time federated coverage report.This may take sometime!!!.');
229                                                         dlg.result.then(function(btn) {
230
231                                                                 $scope.confirmed = 'You confirmed "Yes."';
232                                                         }, function(btn) {
233
234                                                                 $scope.confirmed = 'You confirmed "No."';
235                                                         });
236                                                         break;
237                                                 case 'custom5':
238                                                         var dlg = dialogs.notify('Success',
239                                                                         'Request has been successfully processed.');
240                                                         break;
241                                                 case 'custom6':
242                                                         var dlg = dialogs.notify('Message',
243                                                                         'Please type Testscenario Name');
244                                                         break;
245                                                 }
246                                         }; // end launch
247
248                                         var _fakeWaitProgress = function() {
249
250                                                 $timeout(function() {
251
252                                                         if (_progress < 100) {
253                                                                 _progress += 33;
254                                                                 $rootScope.$broadcast('dialogs.wait.progress',
255                                                                                 {
256                                                                                         'progress' : _progress
257                                                                                 });
258                                                                 _fakeWaitProgress();
259                                                         } else {
260                                                                 $rootScope.$broadcast('dialogs.wait.complete');
261                                                                 _progress = 0;
262                                                         }
263                                                 }, 1000);
264                                         };
265                                 })
266                 .controller(
267                                 'MenuCtrl',
268                                 [
269                                                 '$scope',
270                                                 '$rootScope',
271                                                 '$timeout',
272                                                 'dialogs',
273                                                 '$location',
274                                                 'MenuService',
275                                                 'Datafactory',
276                                                 'userPreferencesService',
277                                                 'cldsModelService',
278                                                 'cldsTemplateService',
279                                                 'extraUserInfoService',
280                                                 function($scope, $rootScope, $timeout, dialogs,
281                                                                 $location, MenuService, Datafactory,
282                                                                 userPreferencesService, cldsModelService,
283                                                                 cldsTemplateService, extraUserInfoService) {
284                                                         console.log("MenuCtrl");
285                                                         $rootScope.screenName = "Universal Test Modeler";
286                                                         $rootScope.testSet = null;
287                                                         $rootScope.isNew = false;
288                                                         var testingType = "";
289                                                         $rootScope.contactUs = function() {
290                                                                 console.log("contactUs");
291                                                                 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.";
292                                                                 window.location.href = link;
293                                                         };
294
295                                                         extraUserInfoService
296                                                                         .getUserInfo()
297                                                                         .then(
298                                                                                         function(pars) {
299                                                                                                 $scope.userInfo = pars;
300                                                                                                 if (!($scope.userInfo["permissionUpdateTemplate"])) {
301                                                                                                         readTOnly = true;
302                                                                                                 }
303                                                                                                 ;
304                                                                                                 if (!($scope.userInfo["permissionUpdateCl"])) {
305                                                                                                         readMOnly = true;
306                                                                                                 }
307                                                                                                 ;
308                                                                                         });
309
310                                                         $scope.emptyMenuClick = function(value, name) {
311                                                                 if ($rootScope.isNew
312                                                                                 && (name != "Save Template"
313                                                                                                 && name != "Close Template" && name != "Template Properties")) {
314                                                                         saveConfirmationNotificationPopUp();
315                                                                 } else if ($rootScope.isNewClosed
316                                                                                 && name != "Save CL"
317                                                                                 && name != "Close Model"
318                                                                                 && name != "Properties CL") {
319                                                                         saveConfirmationNotificationPopUp();
320                                                                 } else {
321                                                                         isSaveCheck(name);
322                                                                 }
323
324                                                                 function saveConfirmationNotificationPopUp() {
325                                                                         $scope
326                                                                                         .saveConfirmationNotificationPopUp(function(
327                                                                                                         data) {
328                                                                                                 if (data) {
329                                                                                                         if ($rootScope.isNewClosed) {
330                                                                                                                 isSaveCheck("Save CL");
331                                                                                                         } else {
332                                                                                                                 isSaveCheck("Save Template");
333                                                                                                         }
334                                                                                                         $rootScope.isNewClosed = false;
335                                                                                                         $rootScope.isNew = false;
336                                                                                                 } else {
337                                                                                                         return false;
338                                                                                                 }
339                                                                                         });
340                                                                 }
341
342                                                                 function isSaveCheck(name) {
343                                                                         if (name == "User Info") {
344                                                                                 $scope.extraUserInfo();
345                                                                         } else if (name == "Wiki") {
346                                                                                 window.open(value);
347                                                                         } else if (name == "Contact Us") {
348                                                                                 $rootScope.contactUs();
349                                                                         } else if (name == "Log Out") {
350                                                                                 $scope.logout();
351                                                                         } else if (name == "Revert Template Changes") {
352                                                                                 $scope.cldsRevertTemplate();
353                                                                         } else if (name == "Revert Model Changes") {
354                                                                                 $scope.cldsRevertModel();
355                                                                         } else if (name == "Create Template") {
356                                                                                 $rootScope.isNew = true;
357                                                                                 $scope.cldsCreateTemplate();
358                                                                         } else if (name == "Open Template") {
359                                                                                 $scope.cldsOpenTemplate();
360                                                                         } else if (name == "Save Template") {
361                                                                                 $scope
362                                                                                                 .cldsTemplatePerformAction("SAVE");
363                                                                                 $rootScope.isNewClosed = false;
364                                                                                 $rootScope.isNew = false;
365                                                                         } else if (name == "Template Properties") {
366                                                                                 $scope.cldsOpenTemplateProperties();
367                                                                         } else if (name == "Close Model"
368                                                                                         || name == "Close Template") {
369                                                                                 $scope.cldsClose();
370                                                                         } else if (name == "Refresh ASDC") {
371                                                                                 $scope.cldsRefreshASDC();
372                                                                         } else if (name == "Create CL") {
373                                                                                 $rootScope.isNewClosed = true;
374                                                                                 $scope.cldsCreateModel();
375                                                                         } else if (name == "Open CL") {
376                                                                                 $scope.cldsOpenModel();
377                                                                         } else if (name == "Save CL") {
378                                                                                 $rootScope.isNewClosed = false;
379                                                                                 $rootScope.isNew = false;
380                                                                                 $scope.cldsPerformAction("SAVE");
381                                                                         } else if (name == "Validation Test") {
382                                                                                 $scope.cldsPerformAction("TEST");
383                                                                         } else if (name == "Submit") {
384                                                                                 $scope
385                                                                                                 .cldsConfirmPerformAction("SUBMIT");
386                                                                         } else if (name == "Resubmit") {
387                                                                                 $scope
388                                                                                                 .cldsConfirmPerformAction("RESUBMIT");
389                                                                         } else if (name == "Update") {
390                                                                                 $scope
391                                                                                                 .cldsConfirmPerformAction("UPDATE");
392                                                                         } else if (name.toLowerCase() == "delete") {
393                                                                                 $scope
394                                                                                                 .manageConfirmPerformAction("DELETE");
395                                                                         } else if (name == "Stop") {
396                                                                                 $scope.cldsConfirmPerformAction("STOP");
397                                                                         } else if (name == "Restart") {
398                                                                                 $scope
399                                                                                                 .cldsConfirmPerformAction("RESTART");
400                                                                         } else if (name == "Refresh Status") {
401                                                                                 $scope.cldsPerformAction("REFRESH");
402                                                                         } else if (name == "Properties CL") {
403                                                                                 $scope.cldsOpenModelProperties();
404                                                                         } else if (name == "Deploy") {
405                                                                                 $scope
406                                                                                                 .cldsConfirmToggleDeployPerformAction("Deploy");
407                                                                         } else if (name == "UnDeploy") {
408                                                                                 $scope
409                                                                                                 .cldsConfirmToggleDeployPerformAction("UnDeploy");
410                                                                         } else {
411                                                                                 $rootScope.screenName = name;
412                                                                                 $scope.updatebreadcrumb(value);
413                                                                                 $location.path(value);
414                                                                         }
415                                                                 }
416                                                         };
417
418                                                         $rootScope.impAlerts = function() {
419
420                                                         };
421
422                                                         $scope.tabs = {
423                                                                 "Template" : [ {
424                                                                         link : "/cldsCreateTemplate",
425                                                                         name : "Create Template"
426                                                                 }, {
427                                                                         link : "/cldsOpenTemplate",
428                                                                         name : "Open Template"
429                                                                 }, {
430                                                                         link : "/cldsSaveTemplate",
431                                                                         name : "Save Template"
432                                                                 }, {
433                                                                         link : "/cldsOpenTemplateProperties",
434                                                                         name : "Template Properties"
435                                                                 }, {
436                                                                         link : "/RevertChanges",
437                                                                         name : "Revert Template Changes"
438                                                                 }, {
439                                                                         link : "/Close",
440                                                                         name : "Close Template"
441                                                                 } ],
442
443                                                                 "Closed Loop" : [ {
444                                                                         link : "/cldsCreateModel",
445                                                                         name : "Create CL"
446                                                                 }, {
447                                                                         link : "/cldsOpenModel",
448                                                                         name : "Open CL"
449                                                                 }, {
450                                                                         link : "/cldsSaveModel",
451                                                                         name : "Save CL"
452                                                                 }, {
453                                                                         link : "/cldsOpenModelProperties",
454                                                                         name : "Properties CL"
455                                                                 }, {
456                                                                         link : "/RevertChanges",
457                                                                         name : "Revert Model Changes"
458                                                                 }, {
459                                                                         link : "/Close",
460                                                                         name : "Close Model"
461                                                                 } ],
462                                                                 "Manage" : [ {
463                                                                         link : "/cldsTestActivate",
464                                                                         name : "Validation Test"
465                                                                 }, {
466                                                                         link : "/cldsSubmit",
467                                                                         name : "Submit"
468                                                                 }, {
469                                                                         link : "/cldsResubmit",
470                                                                         name : "Resubmit"
471                                                                 }, {
472                                                                         link : "/cldsUpdate",
473                                                                         name : "Update"
474                                                                 }, {
475                                                                         link : "/cldsStop",
476                                                                         name : "Stop"
477                                                                 }, {
478                                                                         link : "/cldsRestart",
479                                                                         name : "Restart"
480                                                                 }, {
481                                                                         link : "/cldsDelete",
482                                                                         name : "Delete"
483                                                                 }, {
484                                                                         link : "/cldsDeploy",
485                                                                         name : "Deploy"
486                                                                 }, {
487                                                                         link : "/cldsUnDeploy",
488                                                                         name : "UnDeploy"
489                                                                 } ],
490                                                                 "View" : [ {
491                                                                         link : "/refreshStatus",
492                                                                         name : "Refresh Status"
493                                                                 }, {
494                                                                         link : "/refreshASDCProperties",
495                                                                         name : "Refresh ASDC"
496                                                                 } ],
497                                                                 "Help" : [ {
498                                                                         link : "http://wiki.onap.org",
499                                                                         name : "Wiki"
500                                                                 }, {
501                                                                         link : "/contact_us",
502                                                                         name : "Contact Us"
503                                                                 }, {
504                                                                         link : "/extraUserInfo",
505                                                                         name : "User Info"
506                                                                 } ],
507                                                                 "Log Out" : [ {
508                                                                         link : "/log_out.html",
509                                                                         name : "Log Out"
510                                                                 } ]
511                                                         };
512
513                                                         if (!Object.keys) {
514                                                                 Object.keys = function(obj) {
515                                                                         var keys = [];
516
517                                                                         for ( var i in obj) {
518                                                                                 if (obj.hasOwnProperty(i)) {
519                                                                                         keys.push(i);
520                                                                                 }
521                                                                         }
522
523                                                                         return keys;
524                                                                 };
525                                                                 $scope.keyList = Object.keys($scope.tabs);
526                                                         } else {
527                                                                 $scope.keyList = Object.keys($scope.tabs);
528                                                         }
529
530                                                         $scope.updatebreadcrumb = function(path) {
531
532                                                                 var currentURL = $location.path();
533                                                                 if (path != undefined) {
534                                                                         currentURL = path;
535                                                                 }
536
537                                                                 if (currentURL == "/dashboard") {
538                                                                         $rootScope.screenName = "Universal Test Modeler";
539                                                                         $rootScope.parentMenu = "Home";
540                                                                         $rootScope.rightTabName = "UTM Build Configuration";
541                                                                 }
542                                                                 /*
543                                                                  * else if(currentURL=="/quicksearch") {
544                                                                  * $rootScope.screenName = "Quick Search";
545                                                                  * $rootScope.parentMenu = "Home"; }
546                                                                  */
547                                                                 else {
548                                                                         var found = false;
549
550                                                                         angular
551                                                                                         .forEach(
552                                                                                                         $scope.keyList,
553                                                                                                         function(value, key) {
554
555                                                                                                                 if (!found) {
556                                                                                                                         $rootScope.parentMenu = value;
557
558                                                                                                                         angular
559                                                                                                                                         .forEach(
560                                                                                                                                                         $scope.tabs[value],
561                                                                                                                                                         function(
562                                                                                                                                                                         value,
563                                                                                                                                                                         key) {
564
565                                                                                                                                                                 if (currentURL == value.link) {
566                                                                                                                                                                         $rootScope.screenName = value.name;
567                                                                                                                                                                         found = true;
568                                                                                                                                                                 }
569                                                                                                                                                         });
570                                                                                                                 }
571                                                                                                         });
572                                                                 }
573                                                         };
574
575                                                         $scope.updatebreadcrumb();
576
577                                                         $scope.createNewProject = function() {
578
579                                                                 if ($rootScope.projectName != null) {
580                                                                         var dlg = dialogs
581                                                                                         .confirm('Message',
582                                                                                                         'Do you want to over-write  the project ?');
583
584                                                                         dlg.result
585                                                                                         .then(
586                                                                                                         function(btn) {
587
588                                                                                                                 $scope.clearProject();
589                                                                                                                 var dlg1 = dialogs
590                                                                                                                                 .create(
591                                                                                                                                                 'partials/portfolios/create_new_project.html',
592                                                                                                                                                 'CreateNewPrjCtrl',
593                                                                                                                                                 {},
594                                                                                                                                                 {
595                                                                                                                                                         size : 'sm',
596                                                                                                                                                         keyboard : true,
597                                                                                                                                                         backdrop : false,
598                                                                                                                                                         windowClass : 'my-class'
599                                                                                                                                                 });
600                                                                                                                 dlg1.result.then(
601                                                                                                                                 function(name) {
602
603                                                                                                                                         // $scope.name
604                                                                                                                                         // = name;
605                                                                                                                                 }, function() {
606
607                                                                                                                                         // if(angular.equals($scope.name,''))
608                                                                                                                                         // $scope.name
609                                                                                                                                         // = 'You
610                                                                                                                                         // did not
611                                                                                                                                         // enter in
612                                                                                                                                         // your
613                                                                                                                                         // name!';
614                                                                                                                                 });
615                                                                                                         }, function(btn) {
616
617                                                                                                                 // $modalInstance.close("closed");
618                                                                                                         });
619
620                                                                 } else {
621                                                                         var dlg = dialogs
622                                                                                         .create(
623                                                                                                         'partials/portfolios/create_new_project.html',
624                                                                                                         'CreateNewPrjCtrl',
625                                                                                                         {},
626                                                                                                         {
627                                                                                                                 size : 'lg',
628                                                                                                                 keyboard : true,
629                                                                                                                 backdrop : false,
630                                                                                                                 windowClass : 'my-class'
631                                                                                                         });
632                                                                         dlg.result.then(function(name) {
633
634                                                                                 // $scope.name = name;
635                                                                         }, function() {
636
637                                                                                 // if(angular.equals($scope.name,''))
638                                                                                 // $scope.name = 'You did not enter in
639                                                                                 // your name!';
640                                                                         });
641
642                                                                 }
643                                                         };
644
645                                                         $scope.clearProject = function() {
646
647                                                                 $rootScope.projectName = null;
648                                                                 $rootScope.revision = -1;
649                                                                 // $rootScope.models.length=0;
650                                                                 $rootScope.utmModels = $rootScope.$new(true);
651                                                                 $rootScope.serviceInfo = $rootScope.$new(true);
652                                                                 $rootScope.serviceInfo = null;
653                                                                 $rootScope.serviceInputPartInfo = $rootScope
654                                                                                 .$new(true);
655                                                                 $rootScope.serviceOutputPartInfo = $rootScope
656                                                                                 .$new(true);
657                                                                 $rootScope.servicefaultPartInfo = $rootScope
658                                                                                 .$new(true);
659                                                                 $rootScope.isModel = false;
660                                                                 $("#paletteDiv").load(
661                                                                                 './modeler/dist/index.html');
662                                                                 $rootScope.isPalette = false;
663                                                                 $rootScope.isTestset = false;
664                                                                 $rootScope.isRequirementCoverage = false;
665                                                                 $rootScope.ispropertyExplorer = false;
666                                                                 // $("#propertyDiv").load('./partials/portfolios/Property_Explorer.html');
667                                                                 $rootScope.modelName = "";
668                                                                 // document.getElementById('propertyExplorer').classList.remove('visible');
669                                                                 document.getElementById("modeler_name").textContent = "Activity Modeler";
670                                                                 // $( "#propertyExplorer" ).prev().css(
671                                                                 // "display", "block" );
672                                                                 $("#activity_modeler").prev().css("display",
673                                                                                 "block");
674                                                                 $('div').find('.k-expand-next').click();
675
676                                                                 $rootScope.$apply();
677
678                                                         };
679
680                                                         $scope.homePage = function() {
681
682                                                                 $location.path('/dashboard');
683                                                         };
684                                                         $scope.propertyExplorerErrorMessage = function(msg) {
685
686                                                                 var dlg = dialogs.notify('Error', msg);
687                                                         }
688
689                                                         // $scope.fromTstMultipleFlag=false;
690                                                         /* onclicking of review testset / generate testset */
691
692                                                         $scope.reviewTestSet = function() {
693
694                                                                 $rootScope.modeltestset = list_model_test_sets[selected_model];
695
696                                                                 $rootScope.isPalette = false;
697                                                                 $rootScope.isTestset = true;
698                                                                 $rootScope.isRequirementCoverage = false;
699                                                                 document.getElementById("modeler_name").textContent = "UTM Test Set";
700                                                                 // document.getElementById('propertyExplorer').classList.add('visible');
701
702                                                                 // $( "#propertyExplorer" ).prev().css(
703                                                                 // "display", "none" );
704                                                                 $('div').find('.k-collapse-next').click();
705
706                                                                 // $rootScope.$apply();
707
708                                                         };
709                                                         $scope.requirementCoverage = function() {
710
711                                                                 $rootScope.testCaseRequirements = [];
712                                                                 $rootScope.validTestRequirementArray = [];
713                                                                 $rootScope.validTestRequirements = {};
714                                                                 $rootScope.modeltestset = list_model_test_sets[selected_model];
715                                                                 var allPathDetails = [];
716                                                                 $scope.currentSelectedModel = {};
717                                                                 // $scope.getPathDetails($rootScope.utmModels,selected_model);
718                                                                 // $scope.populatePathDetails(allPathDetails,$scope.currentSelectedModel);
719                                                                 $rootScope.pathDetailsList = list_model_path_details[selected_model];
720                                                                 /*
721                                                                  * for(var p=0;p<100;p++){
722                                                                  * $rootScope.testCaseRequirements.push("Requirement"+p); }
723                                                                  * for(var p=0;p<100;p++){
724                                                                  * $rootScope.testCaseValue.push("TestCase"+p); }
725                                                                  */
726                                                                 for (var x = 0; x < allPathDetails.length; x++) {
727                                                                         var tempPathDetails = allPathDetails[x];
728                                                                         if (tempPathDetails != null) {
729                                                                                 for (var i = 0; i < tempPathDetails.length; i++) {
730                                                                                         var pathDetails = tempPathDetails[i];
731                                                                                         if (pathDetails.requirement !== ''
732                                                                                                         && pathDetails.requirement !== null) {
733                                                                                                 $rootScope.testCaseRequirements
734                                                                                                                 .push(pathDetails.requirement);
735                                                                                         }
736
737                                                                                         /*
738                                                                                          * for (var j = 0; j <
739                                                                                          * pathDetails.decisionIdentifiers.length;
740                                                                                          * j++) {
741                                                                                          * if(pathDetails.decisionIdentifiers[j].requirement
742                                                                                          * !== '' &&
743                                                                                          * pathDetails.decisionIdentifiers[j].requirement
744                                                                                          * !== null){
745                                                                                          * $rootScope.testCaseRequirements.push(pathDetails.decisionIdentifiers[j].requirement); } }
746                                                                                          */
747                                                                                 }
748                                                                         }
749
750                                                                 }
751                                                                 for (var p = 0; p < $rootScope.modeltestset.activityTestCases.length; p++) {
752                                                                         var activityTestCases = $rootScope.modeltestset.activityTestCases[p];
753                                                                         if (activityTestCases.mappedRequirements != null) {
754                                                                                 for (var i = 0; i < activityTestCases.mappedRequirements.length; i++) {
755                                                                                         // $rootScope.testCaseRequirements
756                                                                                         // .push(activityTestCases.mappedRequirements[i]);
757                                                                                         var testCaseNames = $rootScope.validTestRequirements[activityTestCases.mappedRequirements[i]];
758                                                                                         if (testCaseNames == null) {
759                                                                                                 testCaseNames = [];
760                                                                                         }
761                                                                                         if (activityTestCases.version != null)
762                                                                                                 var testCase = activityTestCases.testCaseName
763                                                                                                                 + "_"
764                                                                                                                 + activityTestCases.version;
765                                                                                         else
766                                                                                                 var testCase = activityTestCases.testCaseName;
767                                                                                         testCaseNames.push(testCase);
768                                                                                         $rootScope.validTestRequirements[activityTestCases.mappedRequirements[i]] = testCaseNames;
769                                                                                 }
770                                                                         }
771                                                                 }
772
773                                                                 $rootScope.isPalette = false;
774                                                                 $rootScope.isTestset = false;
775                                                                 $rootScope.isRequirementCoverage = true;
776                                                                 document.getElementById("modeler_name").textContent = "Test Case / Requirement Coverage";
777                                                                 // document.getElementById('propertyExplorer').classList.add('visible');
778                                                                 // console.log("modeltestset"+JSON.stringify($rootScope.modeltestset));
779                                                                 // $( "#propertyExplorer" ).prev().css(
780                                                                 // "display", "none" );
781                                                                 $('div').find('.k-collapse-next').click();
782                                                                 // $rootScope.$apply();
783
784                                                         };
785
786                                                         $scope.activityModelling = function() {
787
788                                                                 // window.open("./bpmn-js-examples-master/modeler/dist/index.html",
789                                                                 // "_self");
790                                                                 // $location.path('/activity_modelling');
791                                                         };
792                                                         /*
793                                                          * $scope.openProject = function(){
794                                                          * $location.path('/dashboard_upload'); };
795                                                          */
796                                                         $rootScope.cldsOpenTemplateProperties = function() {
797
798                                                                 var dlg = dialogs
799                                                                                 .create(
800                                                                                                 'partials/portfolios/global_template_properties.html',
801                                                                                                 'CldsOpenTemplateCtrl', {}, {
802                                                                                                         size : 'lg',
803                                                                                                         keyboard : true,
804                                                                                                         backdrop : 'static',
805                                                                                                         windowClass : 'my-class'
806                                                                                                 });
807
808                                                                 dlg.result.then(function(name) {
809
810                                                                         // $scope.modelName =modelName;
811                                                                         // $("#" +
812                                                                         // selected_model).addClass("selectedcolor");
813                                                                         // alert ("model name:"+$scope.modelName);
814                                                                 }, function() {
815
816                                                                         // if(angular.equals($scope.name,''))
817                                                                         // $scope.name = 'You did not enter in your
818                                                                         // name!';
819                                                                 });
820                                                         }
821
822                                                         $scope.cldsClose = function() {
823
824                                                                 var dlg = dialogs
825                                                                                 .create(
826                                                                                                 'partials/portfolios/confirmation_window.html',
827                                                                                                 'CldsOpenTemplateCtrl', {
828                                                                                                         closable : true,
829                                                                                                         draggable : true
830                                                                                                 }, {
831                                                                                                         size : 'lg',
832                                                                                                         keyboard : true,
833                                                                                                         backdrop : 'static',
834                                                                                                         windowClass : 'my-class'
835                                                                                                 });
836
837                                                                 dlg.result.then(function(name) {
838
839                                                                         // $scope.name = name;
840                                                                 }, function() {
841
842                                                                         // if(angular.equals($scope.name,''))
843                                                                         // $scope.name = 'You did not enter in your
844                                                                         // name!';
845                                                                 });
846                                                         };
847                                                         $scope.cldsOpenTemplate = function() {
848
849                                                                 var dlg = dialogs
850                                                                                 .create(
851                                                                                                 'partials/portfolios/clds_open_template.html',
852                                                                                                 'CldsOpenTemplateCtrl', {
853                                                                                                         closable : true,
854                                                                                                         draggable : true
855                                                                                                 }, {
856                                                                                                         size : 'lg',
857                                                                                                         keyboard : true,
858                                                                                                         backdrop : 'static',
859                                                                                                         windowClass : 'my-class'
860                                                                                                 });
861
862                                                                 dlg.result.then(function(name) {
863
864                                                                         // $scope.name = name;
865                                                                 }, function() {
866
867                                                                         // if(angular.equals($scope.name,''))
868                                                                         // $scope.name = 'You did not enter in your
869                                                                         // name!';
870                                                                 });
871                                                         };
872                                                         $scope.saveConfirmationNotificationPopUp = function(
873                                                                         callBack) {
874
875                                                                 var dlg = dialogs
876                                                                                 .create(
877                                                                                                 'partials/portfolios/save_confirmation.html',
878                                                                                                 'saveConfirmationModalPopUpCtrl',
879                                                                                                 {
880                                                                                                         closable : true,
881                                                                                                         draggable : true
882                                                                                                 }, {
883                                                                                                         size : 'lg',
884                                                                                                         keyboard : true,
885                                                                                                         backdrop : 'static',
886                                                                                                         windowClass : 'my-class'
887                                                                                                 });
888
889                                                                 dlg.result.then(function(name) {
890                                                                         callBack("OK");
891                                                                 }, function() {
892                                                                         callBack(null);
893                                                                 });
894
895                                                         };
896                                                         $scope.cldsCreateTemplate = function() {
897
898                                                                 var dlg = dialogs
899                                                                                 .create(
900                                                                                                 'partials/portfolios/clds_create_template.html',
901                                                                                                 'CldsOpenTemplateCtrl', {
902                                                                                                         closable : true,
903                                                                                                         draggable : true
904                                                                                                 }, {
905                                                                                                         size : 'lg',
906                                                                                                         keyboard : true,
907                                                                                                         backdrop : 'static',
908                                                                                                         windowClass : 'my-class'
909                                                                                                 });
910
911                                                                 dlg.result.then(function(name) {
912
913                                                                         // $scope.name = name;
914                                                                 }, function() {
915
916                                                                         // if(angular.equals($scope.name,''))
917                                                                         // $scope.name = 'You did not enter in your
918                                                                         // name!';
919                                                                 });
920
921                                                         };
922                                                         $scope.cldsRefreshASDC = function() {
923
924                                                                 var dlg = dialogs
925                                                                                 .create(
926                                                                                                 'partials/portfolios/refresh_asdc.html',
927                                                                                                 'CldsOpenModelCtrl', {
928                                                                                                         closable : true,
929                                                                                                         draggable : true
930                                                                                                 }, {
931                                                                                                         size : 'lg',
932                                                                                                         keyboard : true,
933                                                                                                         backdrop : 'static',
934                                                                                                         windowClass : 'my-class'
935                                                                                                 });
936                                                                 dlg.result.then(function(name) {
937
938                                                                         // $scope.name = name;
939                                                                 }, function() {
940
941                                                                         // if(angular.equals($scope.name,''))
942                                                                         // $scope.name = 'You did not enter in your
943                                                                         // name!';
944                                                                 });
945                                                         }
946                                                         $scope.cldsRevertModel = function() {
947
948                                                                 var dlg = dialogs
949                                                                                 .create(
950                                                                                                 'partials/portfolios/ConfirmRevertChanges.html',
951                                                                                                 'CldsOpenModelCtrl', {
952                                                                                                         closable : true,
953                                                                                                         draggable : true
954                                                                                                 }, {
955                                                                                                         size : 'lg',
956                                                                                                         keyboard : true,
957                                                                                                         backdrop : 'static',
958                                                                                                         windowClass : 'my-class'
959                                                                                                 });
960
961                                                                 dlg.result.then(function(name) {
962
963                                                                         // $scope.name = name;
964                                                                 }, function() {
965
966                                                                         // if(angular.equals($scope.name,''))
967                                                                         // $scope.name = 'You did not enter in your
968                                                                         // name!';
969                                                                 });
970
971                                                         };
972
973                                                         $scope.cldsRevertTemplate = function() {
974
975                                                                 var dlg = dialogs
976                                                                                 .create(
977                                                                                                 'partials/portfolios/ConfirmRevertChanges.html',
978                                                                                                 'CldsOpenTemplateCtrl', {
979                                                                                                         closable : true,
980                                                                                                         draggable : true
981                                                                                                 }, {
982                                                                                                         size : 'lg',
983                                                                                                         keyboard : true,
984                                                                                                         backdrop : 'static',
985                                                                                                         windowClass : 'my-class'
986                                                                                                 });
987
988                                                                 dlg.result.then(function(name) {
989
990                                                                         // $scope.name = name;
991                                                                 }, function() {
992
993                                                                         // if(angular.equals($scope.name,''))
994                                                                         // $scope.name = 'You did not enter in your
995                                                                         // name!';
996                                                                 });
997
998                                                         };
999                                                         $scope.cldsTemplatePerformAction = function(
1000                                                                         uiAction) {
1001
1002                                                                 var modelName = selected_model;
1003                                                                 var controlNamePrefix = "ClosedLoop-";
1004                                                                 var bpmnText = modelXML;
1005                                                                 // serialize model properties
1006                                                                 var propText = JSON.stringify(elementMap);
1007
1008                                                                 var svgXml = "";
1009                                                                 console.log(abootDiagram.saveSVG({
1010                                                                         format : true
1011                                                                 }, function(err, xml) {
1012
1013                                                                         if (err)
1014                                                                                 console.log("error")
1015                                                                         else
1016                                                                                 console.log(xml)
1017                                                                         svgXml = xml;
1018                                                                 }));
1019                                                                 console.log("cldsTemplatePerformAction: "
1020                                                                                 + uiAction + " modelName=" + modelName);
1021                                                                 console.log("cldsTemplatePerformAction: "
1022                                                                                 + uiAction + " controlNamePrefix="
1023                                                                                 + controlNamePrefix);
1024                                                                 console.log("cldsTemplatePerformAction: "
1025                                                                                 + uiAction + " bpmnText=" + bpmnText);
1026                                                                 console.log("cldsTemplatePerformAction: "
1027                                                                                 + uiAction + " propText=" + propText);
1028                                                                 cldsTemplateService
1029                                                                                 .processAction(uiAction, modelName,
1030                                                                                                 controlNamePrefix, bpmnText,
1031                                                                                                 propText, svgXml)
1032                                                                                 .then(
1033                                                                                                 function(pars) {
1034                                                                                                         console
1035                                                                                                                         .log("processAction");
1036                                                                                                         console
1037                                                                                                                         .log("cldsTemplatePerformAction: pars="
1038                                                                                                                                         + pars);
1039                                                                                                         cldsTemplateService
1040                                                                                                                         .processActionResponse(
1041                                                                                                                                         modelName,
1042                                                                                                                                         pars);
1043                                                                                                 }, function(data) {
1044
1045                                                                                                         // alert("setModel failed: "
1046                                                                                                         // + data);
1047                                                                                                 });
1048                                                         };
1049
1050                                                         $rootScope.cldsOpenModelProperties = function() {
1051
1052                                                                 var dlg = dialogs
1053                                                                                 .create(
1054                                                                                                 'partials/portfolios/global_properties.html',
1055                                                                                                 'GlobalPropertiesCtrl', {}, {
1056                                                                                                         size : 'lg',
1057                                                                                                         keyboard : true,
1058                                                                                                         backdrop : 'static',
1059                                                                                                         windowClass : 'my-class'
1060                                                                                                 });
1061
1062                                                                 dlg.result.then(function(name) {
1063                                                                 }, function() {
1064                                                                 });
1065                                                         };
1066
1067                                                         $scope.cldsOpenModel = function() {
1068
1069                                                                 var dlg = dialogs
1070                                                                                 .create(
1071                                                                                                 'partials/portfolios/clds_open_model.html',
1072                                                                                                 'CldsOpenModelCtrl', {
1073                                                                                                         closable : true,
1074                                                                                                         draggable : true
1075                                                                                                 }, {
1076                                                                                                         size : 'lg',
1077                                                                                                         keyboard : true,
1078                                                                                                         backdrop : 'static',
1079                                                                                                         windowClass : 'my-class'
1080                                                                                                 });
1081
1082                                                                 dlg.result.then(function(name) {
1083
1084                                                                         // $scope.name = name;
1085                                                                 }, function() {
1086
1087                                                                         // if(angular.equals($scope.name,''))
1088                                                                         // $scope.name = 'You did not enter in your
1089                                                                         // name!';
1090                                                                 });
1091                                                         };
1092                                                         $scope.cldsCreateModel = function() {
1093
1094                                                                 var dlg = dialogs
1095                                                                                 .create(
1096                                                                                                 'partials/portfolios/clds_create_model_off_Template.html',
1097                                                                                                 'CldsOpenModelCtrl', {
1098                                                                                                         closable : true,
1099                                                                                                         draggable : true
1100                                                                                                 }, {
1101                                                                                                         size : 'lg',
1102                                                                                                         keyboard : true,
1103                                                                                                         backdrop : 'static',
1104                                                                                                         windowClass : 'my-class'
1105                                                                                                 });
1106
1107                                                                 dlg.result.then(function(name) {
1108
1109                                                                         // $scope.name = name;
1110                                                                 }, function() {
1111
1112                                                                         // if(angular.equals($scope.name,''))
1113                                                                         // $scope.name = 'You did not enter in your
1114                                                                         // name!';
1115                                                                 });
1116
1117                                                         };
1118                                                         $scope.extraUserInfo = function() {
1119
1120                                                                 var dlg = dialogs
1121                                                                                 .create(
1122                                                                                                 'partials/portfolios/extra_user_info.html',
1123                                                                                                 'ExtraUserInfoCtrl', {
1124                                                                                                         closable : true,
1125                                                                                                         draggable : true
1126                                                                                                 }, {
1127                                                                                                         size : 'lg',
1128                                                                                                         keyboard : true,
1129                                                                                                         backdrop : 'static',
1130                                                                                                         windowClass : 'my-class'
1131                                                                                                 });
1132
1133                                                                 dlg.result.then(function(name) {
1134                                                                 }, function() {
1135                                                                 });
1136
1137                                                         };
1138                                                         $scope.cldsPerformAction = function(uiAction) {
1139
1140                                                                 var modelName = selected_model;
1141                                                                 var controlNamePrefix = "ClosedLoop-";
1142                                                                 var bpmnText = modelXML;
1143                                                                 // serialize model properties
1144                                                                 var propText = JSON.stringify(elementMap);
1145                                                                 var templateName = selected_template
1146
1147                                                                 var svgXml = "";
1148                                                                 console.log(abootDiagram.saveSVG({
1149                                                                         format : true
1150                                                                 }, function(err, xml) {
1151                                                                         if (err)
1152                                                                                 console.log("error")
1153                                                                         else
1154                                                                                 console.log(xml)
1155                                                                         svgXml = xml;
1156                                                                 }));
1157                                                                 console.log("cldsPerformAction: " + uiAction
1158                                                                                 + " modelName=" + modelName);
1159                                                                 console.log("cldsPerformAction: " + uiAction
1160                                                                                 + " controlNamePrefix="
1161                                                                                 + controlNamePrefix);
1162                                                                 console.log("cldsPerformAction: " + uiAction
1163                                                                                 + " bpmnText=" + bpmnText);
1164                                                                 console.log("cldsPerformAction: " + uiAction
1165                                                                                 + " propText=" + propText);
1166                                                                 console.log("cldsPerformAction: " + uiAction
1167                                                                                 + " typeID=" + typeID);
1168                                                                 console.log("cldsPerformAction: " + uiAction
1169                                                                                 + " deploymentId=" + deploymentId);
1170                                                                 cldsModelService
1171                                                                                 .processAction(uiAction, modelName,
1172                                                                                                 controlNamePrefix, bpmnText,
1173                                                                                                 propText, svgXml, templateName,
1174                                                                                                 typeID, deploymentId)
1175                                                                                 .then(
1176                                                                                                 function(pars) {
1177                                                                                                         console
1178                                                                                                                         .log("cldsPerformAction: pars="
1179                                                                                                                                         + pars);
1180                                                                                                         cldsModelService
1181                                                                                                                         .processRefresh(pars);
1182                                                                                                 }, function(data) {
1183
1184                                                                                                         // alert("setModel failed: "
1185                                                                                                         // + data);
1186                                                                                                 });
1187                                                         };
1188
1189                                                         $scope.cldsConfirmPerformAction = function(uiAction) {
1190                                                                 var dlg = dialogs.confirm('Message',
1191                                                                                 'Do you want to '
1192                                                                                                 + uiAction.toLowerCase()
1193                                                                                                 + ' the closed loop?');
1194                                                                 dlg.result.then(function(btn) {
1195
1196                                                                         $scope.cldsPerformAction(uiAction);
1197                                                                 }, function(btn) {
1198
1199                                                                         // $modalInstance.close("closed");
1200                                                                 });
1201                                                         };
1202
1203                                                         $scope.cldsConfirmToggleDeployPerformAction = function(
1204                                                                         uiAction) {
1205
1206                                                                 var dlg = dialogs.confirm('Message',
1207                                                                                 'Do you want to '
1208                                                                                                 + uiAction.toLowerCase()
1209                                                                                                 + ' the closed loop?');
1210                                                                 dlg.result.then(function(btn) {
1211                                                                         cldsToggleDeploy(uiAction.toLowerCase());
1212                                                                 }, function(btn) {
1213
1214                                                                         // $modalInstance.close("closed");
1215                                                                 });
1216                                                         };
1217                                                         function cldsToggleDeploy(uiAction) {
1218                                                                 var modelName = selected_model;
1219                                                                 var controlNamePrefix = "ClosedLoop-";
1220                                                                 var bpmnText = modelXML;
1221                                                                 // serialize model properties
1222                                                                 var propText = JSON.stringify(elementMap);
1223                                                                 var templateName = selected_template;
1224                                                                 var svgXml = "";
1225
1226                                                                 console.log(abootDiagram.saveSVG({
1227                                                                         format : true
1228                                                                 }, function(err, xml) {
1229                                                                         if (err)
1230                                                                                 console.log("error")
1231                                                                         else
1232                                                                                 console.log(xml)
1233                                                                         svgXml = xml;
1234                                                                 }));
1235                                                                 console.log("cldsPerformAction: " + uiAction
1236                                                                                 + " modelName=" + modelName);
1237                                                                 console.log("cldsPerformAction: " + uiAction
1238                                                                                 + " controlNamePrefix="
1239                                                                                 + controlNamePrefix);
1240                                                                 console.log("cldsPerformAction: " + uiAction
1241                                                                                 + " bpmnText=" + bpmnText);
1242                                                                 console.log("cldsPerformAction: " + uiAction
1243                                                                                 + " propText=" + propText);
1244                                                                 console.log("cldsPerformAction: " + uiAction
1245                                                                                 + " modelEventService="
1246                                                                                 + modelEventService);
1247                                                                 console.log("cldsPerformAction: " + uiAction
1248                                                                                 + " typeID=" + typeID);
1249                                                                 console.log("cldsPerformAction: " + uiAction
1250                                                                                 + " deploymentId=" + deploymentId);
1251                                                                 cldsModelService
1252                                                                                 .toggleDeploy(uiAction, modelName,
1253                                                                                                 controlNamePrefix, bpmnText,
1254                                                                                                 propText, svgXml, templateName,
1255                                                                                                 typeID, controlNameUuid,
1256                                                                                                 modelEventService, deploymentId)
1257                                                                                 .then(
1258                                                                                                 function(pars) {
1259                                                                                                         typeID = pars.typeId;
1260                                                                                                         controlNameUuid = pars.controlNameUuid;
1261                                                                                                         selected_template = pars.templateName;
1262                                                                                                         modelEventService = pars.event;
1263                                                                                                         // actionCd =
1264                                                                                                         // pars.event.actionCd;
1265                                                                                                         actionStateCd = pars.event.actionStateCd;
1266                                                                                                         deploymentId = pars.deploymentId;
1267                                                                                                         cldsModelService
1268                                                                                                                         .processActionResponse(
1269                                                                                                                                         modelName,
1270                                                                                                                                         pars);
1271
1272                                                                                                 }, function(data) {
1273
1274                                                                                                 });
1275                                                         }
1276                                                         $scope.managePerformAction = function(action) {
1277                                                                 if (action.toLowerCase() === "delete") {
1278                                                                         cldsModelService
1279                                                                                         .manageAction(
1280                                                                                                         selected_model,
1281                                                                                                         "805b9f83-261f-48d9-98c7-8011fc2cc8e8",
1282                                                                                                         "ClosedLoop-ABCD-0000.yml")
1283                                                                                         .then(function(pars) {
1284
1285                                                                                         }, function(data) {
1286
1287                                                                                                 // alert("setModel failed: " +
1288                                                                                                 // data);
1289                                                                                         });
1290                                                                 }
1291                                                         };
1292                                                         $scope.manageConfirmPerformAction = function(
1293                                                                         uiAction) {
1294
1295                                                                 var dlg = dialogs.confirm('Message',
1296                                                                                 'Do you want to '
1297                                                                                                 + uiAction.toLowerCase()
1298                                                                                                 + ' the closed loop?');
1299                                                                 dlg.result.then(function(btn) {
1300
1301                                                                         $scope.managePerformAction(uiAction);
1302                                                                 }, function(btn) {
1303
1304                                                                         // $modalInstance.close("closed");
1305                                                                 });
1306                                                         };
1307                                                         $scope.CollectorsWindow = function(collectorsWin) {
1308
1309                                                                 if (isTemplate) {
1310                                                                         var dlg = dialogs
1311                                                                                         .create(
1312                                                                                                         'partials/portfolios/Template_model.html',
1313                                                                                                         'ImportSchemaCtrl',
1314                                                                                                         collectorsWin,
1315                                                                                                         {
1316                                                                                                                 closable : true,
1317                                                                                                                 draggable : true
1318                                                                                                         },
1319                                                                                                         {
1320                                                                                                                 size : 'lg',
1321                                                                                                                 keyboard : true,
1322                                                                                                                 backdrop : 'static',
1323                                                                                                                 windowClass : 'my-class'
1324                                                                                                         });
1325                                                                         dlg.result.then(function(name) {
1326
1327                                                                         }, function() {
1328
1329                                                                                 // if(angular.equals($scope.name,''))
1330                                                                                 // $scope.name = 'You did not enter in
1331                                                                                 // your name!';
1332                                                                         });
1333                                                                 } else {
1334                                                                         var dlg = dialogs
1335                                                                                         .create(
1336                                                                                                         'partials/portfolios/Collector_properties.html',
1337                                                                                                         'ImportSchemaCtrl',
1338                                                                                                         {
1339                                                                                                                 closable : true,
1340                                                                                                                 draggable : true
1341                                                                                                         },
1342                                                                                                         {
1343                                                                                                                 size : 'lg',
1344                                                                                                                 keyboard : true,
1345                                                                                                                 backdrop : 'static',
1346                                                                                                                 windowClass : 'my-class'
1347                                                                                                         });
1348                                                                         dlg.result.then(function(name) {
1349
1350                                                                         }, function() {
1351
1352                                                                                 // if(angular.equals($scope.name,''))
1353                                                                                 // $scope.name = 'You did not enter in
1354                                                                                 // your name!';
1355                                                                         });
1356
1357                                                                 }
1358
1359                                                         };
1360                                                         $scope.StringMatchWindow = function(stringMatch) {
1361
1362                                                                 if (isTemplate) {
1363                                                                         var dlg = dialogs
1364                                                                                         .create(
1365                                                                                                         'partials/portfolios/Template_model.html',
1366                                                                                                         'ImportSchemaCtrl',
1367                                                                                                         stringMatch,
1368                                                                                                         {
1369                                                                                                                 closable : true,
1370                                                                                                                 draggable : true
1371                                                                                                         },
1372                                                                                                         {
1373                                                                                                                 size : 'lg',
1374                                                                                                                 keyboard : true,
1375                                                                                                                 backdrop : 'static',
1376                                                                                                                 windowClass : 'my-class'
1377                                                                                                         });
1378                                                                         dlg.result.then(function(name) {
1379
1380                                                                         }, function() {
1381
1382                                                                                 // if(angular.equals($scope.name,''))
1383                                                                                 // $scope.name = 'You did not enter in
1384                                                                                 // your name!';
1385                                                                         });
1386                                                                 } else {
1387
1388                                                                         var dlg = dialogs
1389                                                                                         .create(
1390                                                                                                         'partials/portfolios/stringMatch_properties.html',
1391                                                                                                         'ImportSchemaCtrl',
1392                                                                                                         {
1393                                                                                                                 closable : true,
1394                                                                                                                 draggable : true
1395                                                                                                         },
1396                                                                                                         {
1397                                                                                                                 size : 'lg',
1398                                                                                                                 keyboard : true,
1399                                                                                                                 backdrop : 'static',
1400                                                                                                                 windowClass : 'my-class'
1401                                                                                                         });
1402
1403                                                                         dlg.result.then(function(name) {
1404
1405                                                                                 // $scope.name = name;
1406                                                                         }, function() {
1407
1408                                                                                 // if(angular.equals($scope.name,''))
1409                                                                                 // $scope.name = 'You did not enter in
1410                                                                                 // your name!';
1411                                                                         });
1412
1413                                                                 }
1414                                                         };
1415                                                         $scope.VesCollectorWindow = function(vesCollector) {
1416
1417                                                                 if (isTemplate) {
1418                                                                         var dlg = dialogs
1419                                                                                         .create(
1420                                                                                                         'partials/portfolios/Template_model.html',
1421                                                                                                         'ImportSchemaCtrl',
1422                                                                                                         vesCollector,
1423                                                                                                         {
1424                                                                                                                 closable : true,
1425                                                                                                                 draggable : true
1426                                                                                                         },
1427                                                                                                         {
1428                                                                                                                 size : 'lg',
1429                                                                                                                 keyboard : true,
1430                                                                                                                 backdrop : 'static',
1431                                                                                                                 windowClass : 'my-class'
1432                                                                                                         });
1433                                                                         dlg.result.then(function(name) {
1434
1435                                                                         }, function() {
1436
1437
1438                                                                         });
1439                                                                 } else { // if (isTemplate)
1440
1441                                                                         var dlg = dialogs
1442                                                                                         .create(
1443                                                                                                         'partials/portfolios/vesCollector_properties.html',
1444                                                                                                         'ImportSchemaCtrl',
1445                                                                                                         {
1446                                                                                                                 closable : true,
1447                                                                                                                 draggable : true
1448                                                                                                         },
1449                                                                                                         {
1450                                                                                                                 size : 'lg',
1451                                                                                                                 keyboard : true,
1452                                                                                                                 backdrop : 'static',
1453                                                                                                                 windowClass : 'my-class'
1454                                                                                                         });
1455
1456                                                                         dlg.result.then(function(name) {
1457
1458                                                                         }, function() {
1459
1460                                                                         });
1461
1462                                                                 }
1463                                                         };
1464
1465                                                         $scope.HolmesWindow = function(holmes) {
1466
1467                                                                   if (isTemplate) {
1468                       var partial = 'partials/portfolios/Template_model.html'
1469                   } else {
1470                       var partial = 'partials/portfolios/holmes_properties.html'
1471                   }
1472                   
1473                                                                         var dlg = dialogs
1474                                                                                         .create(
1475                                                                                                         partial,
1476                                                                                                         'ImportSchemaCtrl',
1477                                                                                                         holmes,
1478                                                                                                         {
1479                                                                                                                   closable : true,
1480                                                                                                                   draggable : true
1481                                                                                                         },
1482                                                                                                         {
1483                                                                                                                   size : 'lg',
1484                                                                                                                   keyboard : true,
1485                                                                                                                   backdrop : 'static',
1486                                                                                                                   windowClass : 'my-class'
1487                                                                                                         });
1488                                                         };
1489                 
1490                                                         $scope.TCAWindow = function(tca) {
1491                                                                 if (isTemplate) {
1492                                                                         var dlg = dialogs
1493                                                                                         .create(
1494                                                                                                         'partials/portfolios/Template_model.html',
1495                                                                                                         'ImportSchemaCtrl',
1496                                                                                                         tca,
1497                                                                                                         {
1498                                                                                                                 closable : true,
1499                                                                                                                 draggable : true
1500                                                                                                         },
1501                                                                                                         {
1502                                                                                                                 size : 'lg',
1503                                                                                                                 keyboard : true,
1504                                                                                                                 backdrop : 'static',
1505                                                                                                                 windowClass : 'my-class'
1506                                                                                                         });
1507                                                                         dlg.result.then(function(name) {
1508                                                                         }, function() {
1509                                                                                 // if(angular.equals($scope.name,''))
1510                                                                                 // $scope.name = 'You did not enter in
1511                                                                                 // your name!';
1512                                                                         });
1513                                                                 } else {
1514                                                                         var dlg = dialogs
1515                                                                                         .create(
1516                                                                                                         'partials/portfolios/tca_properties.html',
1517                                                                                                         'ImportSchemaCtrl',
1518                                                                                                         {
1519                                                                                                                 closable : true,
1520                                                                                                                 draggable : true
1521                                                                                                         },
1522                                                                                                         {
1523                                                                                                                 size : 'lg',
1524                                                                                                                 keyboard : true,
1525                                                                                                                 backdrop : 'static',
1526                                                                                                                 windowClass : 'my-class'
1527                                                                                                         });
1528
1529                                                                         dlg.result.then(function(name) {
1530                                                                                 // $scope.name = name;
1531                                                                         }, function() {
1532                                                                                 // if(angular.equals($scope.name,''))
1533                                                                                 // $scope.name = 'You did not enter in
1534                                                                                 // your name!';
1535                                                                         });
1536                                                                 }
1537                                                         };
1538
1539                                                         $scope.PolicyWindow = function(policy) {
1540
1541                                                                 if (isTemplate) {
1542                                                                         var dlg = dialogs
1543                                                                                         .create(
1544                                                                                                         'partials/portfolios/Template_model.html',
1545                                                                                                         'ImportSchemaCtrl',
1546                                                                                                         policy,
1547                                                                                                         {
1548                                                                                                                 closable : true,
1549                                                                                                                 draggable : true
1550                                                                                                         },
1551                                                                                                         {
1552                                                                                                                 size : 'lg',
1553                                                                                                                 keyboard : true,
1554                                                                                                                 backdrop : 'static',
1555                                                                                                                 windowClass : 'my-class'
1556                                                                                                         });
1557                                                                         dlg.result.then(function(name) {
1558
1559                                                                         }, function() {
1560
1561                                                                                 // if(angular.equals($scope.name,''))
1562                                                                                 // $scope.name = 'You did not enter in
1563                                                                                 // your name!';
1564                                                                         });
1565                                                                 } else {
1566                                                                         var dlg = dialogs
1567                                                                                         .create(
1568                                                                                                         'partials/portfolios/PolicyWindow_properties.html',
1569                                                                                                         'ImportSchemaCtrl',
1570                                                                                                         {
1571                                                                                                                 closable : true,
1572                                                                                                                 draggable : true
1573                                                                                                         },
1574                                                                                                         {
1575                                                                                                                 size : 'lg',
1576                                                                                                                 keyboard : true,
1577                                                                                                                 backdrop : 'static',
1578                                                                                                                 windowClass : 'my-class'
1579                                                                                                         });
1580
1581                                                                         dlg.result.then(function(name) {
1582
1583                                                                                 // $scope.name = name;
1584                                                                         }, function() {
1585
1586                                                                                 // if(angular.equals($scope.name,''))
1587                                                                                 // $scope.name = 'You did not enter in
1588                                                                                 // your name!';
1589                                                                         });
1590
1591                                                                 }
1592                                                         };
1593
1594                                                 } ]);
1595
1596 app.service('MenuService', [ '$http', '$q', function($http, $q) {
1597
1598         /*
1599          * this.generateMDTTestSet = function(utmMDTRequest, generateTestSetMDTURL){
1600          * 
1601          * console.log("generateMDTTestSet"); //alert("In generateMDTTestSet :: " +
1602          * JSON.stringify(utmMDTRequest)); var def = $q.defer(); var sets = [];
1603          * 
1604          * $http.post(generateTestSetMDTURL, utmMDTRequest) .success(function(data){
1605          * console.log("success"); sets = data; def.resolve(data); })
1606          * .error(function(data){ console.log("error");
1607          * def.reject("GenerateMDTTestSet not successful"); });
1608          * 
1609          * return def.promise; };
1610          */
1611 } ]);
1612
1613 app.directive('focus', function($timeout) {
1614
1615         return {
1616                 scope : {
1617                         trigger : '@focus'
1618                 },
1619                 link : function(scope, element) {
1620                         scope.$watch('trigger', function(value) {
1621
1622                                 if (value === "true") {
1623                                         $timeout(function() {
1624
1625                                                 element[0].focus();
1626                                         });
1627                                 }
1628                         });
1629                 }
1630         };
1631 });
1632 app.directive('draggable', function($document) {
1633
1634         return function(scope, element, attr) {
1635
1636                 var startX = 0, startY = 0, x = 0, y = 0;
1637                 element.css({
1638                         position : 'relative',
1639
1640                         backgroundColor : 'white',
1641                         cursor : 'move',
1642                         display : 'block',
1643
1644                 });
1645                 element.on('mousedown', function(event) {
1646
1647                         // Prevent default dragging of selected content
1648                         // event.preventDefault();
1649                         startX = event.screenX - x;
1650                         startY = event.screenY - y;
1651                         $document.on('mousemove', mousemove);
1652                         $document.on('mouseup', mouseup);
1653                 });
1654
1655                 function mousemove(event) {
1656
1657                         y = event.screenY - startY;
1658                         x = event.screenX - startX;
1659                         element.css({
1660                                 top : y + 'px',
1661                                 left : x + 'px'
1662                         });
1663                 }
1664
1665                 function mouseup() {
1666
1667                         $document.off('mousemove', mousemove);
1668                         $document.off('mouseup', mouseup);
1669                 }
1670         };
1671 });
1672
1673 app.factory('myHttpInterceptor', function($q, $window) {
1674
1675         return function(promise) {
1676
1677                 return promise.then(function(response) {
1678
1679                         return response;
1680                 }, function(response) {
1681
1682                         return $q.reject(response);
1683                 });
1684         };
1685 });
1686
1687 app.run([ '$route', function($route) {
1688
1689         $route.reload();
1690 } ]);
1691 function TestCtrl($scope) {
1692
1693         $scope.msg = "Hello from a controller method.";
1694         $scope.returnHello = function() {
1695
1696                 return $scope.msg;
1697         }
1698 }
1699 function importshema() {
1700
1701         angular.element(document.getElementById('navbar')).scope().importSchema();
1702
1703 }
1704
1705 function CollectorsWindow(collectorsWin) {
1706
1707         angular.element(document.getElementById('navbar')).scope()
1708                         .CollectorsWindow(collectorsWin);
1709
1710 }
1711 function VesCollectorWindow(vesCollectorWin) {
1712     angular.element(document.getElementById('navbar')).scope()
1713         .VesCollectorWindow(vesCollectorWin);
1714 }
1715
1716 function HolmesWindow(holmesWin) {
1717     angular.element(document.getElementById('navbar')).scope()
1718         .HolmesWindow(holmesWin);
1719 }
1720
1721 function F5Window() {
1722
1723         angular.element(document.getElementById('navbar')).scope().F5Window();
1724
1725 }
1726
1727 function StringMatchWindow(stringMatch) {
1728
1729         angular.element(document.getElementById('navbar')).scope()
1730                         .StringMatchWindow(stringMatch);
1731
1732 }
1733 function TCAWindow(tca) {
1734
1735         angular.element(document.getElementById('navbar')).scope().TCAWindow(tca);
1736
1737 }
1738 function GOCWindow() {
1739
1740         angular.element(document.getElementById('navbar')).scope().GOCWindow();
1741
1742 }
1743 function PolicyWindow(PolicyWin) {
1744
1745         angular.element(document.getElementById('navbar')).scope().PolicyWindow(
1746                         PolicyWin);
1747
1748 }
1749
1750 function pathDetails(bpmnElementID, bpmnElementName, pathIdentifiers) {
1751
1752         angular.element(document.getElementById('navbar')).scope().pathDetails(
1753                         bpmnElementID, bpmnElementName, pathIdentifiers);
1754
1755 }
1756 function setdefaultvalue() {
1757
1758         angular.element(document.getElementById('navbar')).scope()
1759                         .setDefaultValue();
1760
1761 }
1762 function upgradeSchemaVersion() {
1763
1764         angular.element(document.getElementById('navbar')).scope()
1765                         .upgradeSchemaVersion();
1766
1767 }
1768 function saveProject() {
1769
1770         angular.element(document.getElementById('navbar')).scope().saveProject();
1771
1772 }
1773 function modifySchema() {
1774
1775         angular.element(document.getElementById('navbar')).scope().modifySchema();
1776
1777 }
1778
1779 function definePID() {
1780
1781         angular.element(document.getElementById('navbar')).scope().definePID();
1782
1783 }
1784 function defineServiceAcronym() {
1785
1786         angular.element(document.getElementById('navbar')).scope()
1787                         .defineServiceAcronym();
1788
1789 }
1790 function errorProperty(msg) {
1791
1792         angular.element(document.getElementById('navbar')).scope()
1793                         .propertyExplorerErrorMessage(msg);
1794 }
1795 function invisiblepropertyExplorer() {
1796
1797         angular.element(document.getElementById('navbar')).scope()
1798                         .invisibleproperty();
1799 }
1800 function updateDecisionLabel(originalLabel, newLabel) {
1801
1802         angular.element(document.getElementById('navbar')).scope()
1803                         .updateDecisionLabels(originalLabel, newLabel);
1804 }
1805
1806 // Used to logout the session , when browser window was closed
1807 window.onunload = function() {
1808         window.localStorage.removeItem("isAuth");
1809         window.localStorage.removeItem("loginuser");
1810 };