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