b0b34533a16af91b3224165521fc18261cc99fd2
[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
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                                             $rootScope.isNewClosed = false;
247                                     } else {
248                                             return false;
249                                     }
250                             });
251                     }
252                     function isSaveCheck(name) {
253
254                             if (name == "User Info") {
255                                     $scope.extraUserInfo();
256                             } else if (name == "Wiki") {
257                                     window.open(value);
258                             } else if (name == "Contact Us") {
259                                     $rootScope.contactUs();
260                             } else if (name == "Close Model") {
261                                     $scope.cldsClose();
262                             } else if (name == "Open CL") {
263                                     $scope.cldsOpenModel();
264                             } else if (name == "Submit") {
265                                     $scope.cldsConfirmPerformAction("SUBMIT");
266                             } else if (name == "Update") {
267                                     $scope.cldsConfirmPerformAction("UPDATE");
268                             } else if (name == "Delete") {
269                                     $scope.cldsConfirmPerformAction("DELETE");
270                             } else if (name == "Stop") {
271                                     $scope.cldsConfirmPerformAction("STOP");
272                             } else if (name == "Restart") {
273                                     $scope.cldsConfirmPerformAction("RESTART");
274                             } else if (name == "Refresh Status") {
275                                     $scope.refreshStatus();
276                             } else if (name == "Properties CL") {
277                                     $scope.cldsOpenModelProperties();
278                             } else if (name == "Deploy") {
279                                     $scope.cldsAskDeployParametersPerformAction();
280                             } else if (name == "UnDeploy") {
281                                     $scope.cldsConfirmToggleDeployPerformAction("UnDeploy");
282                             } else {
283                                     $rootScope.screenName = name;
284                                     $scope.updatebreadcrumb(value);
285                                     $location.path(value);
286                             }
287                     }
288             };
289             $rootScope.impAlerts = function() {
290
291             };
292             $scope.tabs = {
293                 "Closed Loop" : [ {
294                     link : "/cldsOpenModel",
295                     name : "Open CL"
296                 }, {
297                     link : "/cldsOpenModelProperties",
298                     name : "Properties CL"
299                 }, {
300                     link : "/Close",
301                     name : "Close Model"
302                 } ],
303                 "Manage" : [ {
304                     link : "/cldsSubmit",
305                     name : "Submit"
306                 }, {
307                 // disabled for Dublin since Policy doesn't support updating in this release
308                     //   link : "/cldsUpdate",
309                 //    name : "Update"
310                 //}, {
311                     link : "/cldsStop",
312                     name : "Stop"
313                 }, {
314                     link : "/cldsRestart",
315                     name : "Restart"
316                 }, {
317                     link : "/cldsDelete",
318                     name : "Delete"
319                 }, {
320                     link : "/cldsDeploy",
321                     name : "Deploy"
322                 }, {
323                     link : "/cldsUnDeploy",
324                     name : "UnDeploy"
325                 } ],
326                 "View" : [ {
327                     link : "/refreshStatus",
328                     name : "Refresh Status"
329                 } ],
330                 "Help" : [ {
331                     link : "http://wiki.onap.org",
332                     name : "Wiki"
333                 }, {
334                     link : "/contact_us",
335                     name : "Contact Us"
336                 }, {
337                     link : "/extraUserInfo",
338                     name : "User Info"
339                 } ]
340             };
341             if (!Object.keys) {
342                     Object.keys = function(obj) {
343
344                             var keys = [];
345                             for ( var i in obj) {
346                                     if (obj.hasOwnProperty(i)) {
347                                             keys.push(i);
348                                     }
349                             }
350                             return keys;
351                     };
352                     $scope.keyList = Object.keys($scope.tabs);
353             } else {
354                     $scope.keyList = Object.keys($scope.tabs);
355             }
356             $scope.updatebreadcrumb = function(path) {
357
358                     var currentURL = $location.path();
359                     if (path != undefined) {
360                             currentURL = path;
361                     }
362                     if (currentURL == "/dashboard") {
363                             $rootScope.screenName = "Universal Test Modeler";
364                             $rootScope.parentMenu = "Home";
365                             $rootScope.rightTabName = "UTM Build Configuration";
366                     } else {
367                             var found = false;
368                             angular.forEach($scope.keyList, function(value, key) {
369
370                                     if (!found) {
371                                             $rootScope.parentMenu = value;
372                                             angular.forEach($scope.tabs[value],
373                                             function(value, key) {
374
375                                                     if (currentURL == value.link) {
376                                                             $rootScope.screenName = value.name;
377                                                             found = true;
378                                                     }
379                                             });
380                                     }
381                             });
382                     }
383             };
384             $scope.updatebreadcrumb();
385             $scope.homePage = function() {
386
387                     $location.path('/dashboard');
388             };
389             $scope.propertyExplorerErrorMessage = function(msg) {
390
391                     var dlg = dialogs.notify('Error', msg);
392             }
393             $scope.reviewTestSet = function() {
394
395                     $rootScope.modeltestset = list_model_test_sets[selected_model];
396                     $rootScope.isPalette = false;
397                     $rootScope.isTestset = true;
398                     $rootScope.isRequirementCoverage = false;
399                     document.getElementById("modeler_name").textContent = "UTM Test Set";
400                     $('div').find('.k-collapse-next').click();
401             };
402             $scope.requirementCoverage = function() {
403
404                     $rootScope.testCaseRequirements = [];
405                     $rootScope.validTestRequirementArray = [];
406                     $rootScope.validTestRequirements = {};
407                     $rootScope.modeltestset = list_model_test_sets[selected_model];
408                     var allPathDetails = [];
409                     $scope.currentSelectedModel = {};
410                     $rootScope.pathDetailsList = list_model_path_details[selected_model];
411                     for (var x = 0; x < allPathDetails.length; x++) {
412                             var tempPathDetails = allPathDetails[x];
413                             if (tempPathDetails != null) {
414                                     for (var i = 0; i < tempPathDetails.length; i++) {
415                                             var pathDetails = tempPathDetails[i];
416                                             if (pathDetails.requirement !== ''
417                                             && pathDetails.requirement !== null) {
418                                                     $rootScope.testCaseRequirements
419                                                     .push(pathDetails.requirement);
420                                             }
421                                     }
422                             }
423                     }
424                     for (var p = 0; p < $rootScope.modeltestset.activityTestCases.length; p++) {
425                             var activityTestCases = $rootScope.modeltestset.activityTestCases[p];
426                             if (activityTestCases.mappedRequirements != null) {
427                                     for (var i = 0; i < activityTestCases.mappedRequirements.length; i++) {
428                                             var testCaseNames = $rootScope.validTestRequirements[activityTestCases.mappedRequirements[i]];
429                                             if (testCaseNames == null) {
430                                                     testCaseNames = [];
431                                             }
432                                             if (activityTestCases.version != null)
433                                                     var testCase = activityTestCases.testCaseName + "_"
434                                                     + activityTestCases.version;
435                                             else
436                                                     var testCase = activityTestCases.testCaseName;
437                                             testCaseNames.push(testCase);
438                                             $rootScope.validTestRequirements[activityTestCases.mappedRequirements[i]] = testCaseNames;
439                                     }
440                             }
441                     }
442                     $rootScope.isPalette = false;
443                     $rootScope.isTestset = false;
444                     $rootScope.isRequirementCoverage = true;
445                     document.getElementById("modeler_name").textContent = "Test Case / Requirement Coverage";
446                     $('div').find('.k-collapse-next').click();
447             };
448             $scope.activityModelling = function() {
449
450             };
451             $scope.cldsClose = function() {
452
453                     var dlg = dialogs.create(
454                     'partials/portfolios/confirmation_window.html',
455                     'CldsOpenModelCtrl', {
456                         closable : true,
457                         draggable : true
458                     }, {
459                         size : 'lg',
460                         keyboard : true,
461                         backdrop : 'static',
462                         windowClass : 'my-class'
463                     });
464                     dlg.result.then(function(name) {
465
466                             // $scope.name = name;
467                     }, function() {
468
469                             // if(angular.equals($scope.name,''))
470                             // $scope.name = 'You did not enter in your
471                             // name!';
472                     });
473             };
474             $scope.saveConfirmationNotificationPopUp = function(callBack) {
475
476                     var dlg = dialogs.create(
477                     'partials/portfolios/save_confirmation.html',
478                     'saveConfirmationModalPopUpCtrl', {
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                             callBack("OK");
490                     }, function() {
491
492                             callBack(null);
493                     });
494             };
495             $rootScope.cldsOpenModelProperties = function() {
496
497                     var dlg = dialogs.create(
498                     'partials/portfolios/global_properties.html',
499                     'GlobalPropertiesCtrl', {}, {
500                         size : 'lg',
501                         keyboard : true,
502                         backdrop : 'static',
503                         windowClass : 'my-class'
504                     });
505                     dlg.result.then(function(name) {
506
507                     }, function() {
508
509                     });
510             };
511             $scope.cldsOpenModel = function() {
512
513                     var dlg = dialogs.create(
514                     'partials/portfolios/clds_open_model.html', 'CldsOpenModelCtrl', {
515                         closable : true,
516                         draggable : true
517                     }, {
518                         size : 'lg',
519                         keyboard : true,
520                         backdrop : 'static',
521                         windowClass : 'my-class'
522                     });
523                     dlg.result.then(function(name) {
524
525                     }, function() {
526
527                     });
528             };
529             $scope.extraUserInfo = function() {
530
531                     var dlg = dialogs.create(
532                     'partials/portfolios/extra_user_info.html', 'ExtraUserInfoCtrl', {
533                         closable : true,
534                         draggable : true
535                     }, {
536                         size : 'lg',
537                         keyboard : true,
538                         backdrop : 'static',
539                         windowClass : 'my-class'
540                     });
541                     dlg.result.then(function(name) {
542
543                     }, function() {
544
545                     });
546             };
547             $scope.cldsPerformAction = function(uiAction) {
548
549                     var modelName = selected_model;
550                     var controlNamePrefix = "ClosedLoop-";
551                     var bpmnText = modelXML;
552                     // serialize model properties
553                     var propText = JSON.stringify(elementMap);
554                     var templateName = selected_template
555                     var svgXml = $("#svgContainer").html();
556                     console.log("cldsPerformAction: " + uiAction + " modelName="
557                     + modelName);
558                     console.log("cldsPerformAction: " + uiAction
559                     + " controlNamePrefix=" + controlNamePrefix);
560                     console.log("cldsPerformAction: " + uiAction + " bpmnText="
561                     + bpmnText);
562                     console.log("cldsPerformAction: " + uiAction + " propText="
563                     + propText);
564                     console.log("cldsPerformAction: " + uiAction + " typeID=" + typeID);
565                     console.log("cldsPerformAction: " + uiAction + " deploymentId="
566                     + deploymentId);
567                     cldsModelService.processAction(uiAction, modelName,
568                     controlNamePrefix, bpmnText, propText, svgXml, templateName,
569                     typeID, deploymentId).then(function(pars) {
570
571                             console.log("cldsPerformAction: pars=" + pars);
572                             cldsModelService.processRefresh(pars);
573                     }, function(data) {
574
575                     });
576             };
577             $scope.refreshStatus = function() {
578
579                     var modelName = selected_model;
580                     var svgXml = $("#svgContainer").html();
581                     console.log("refreStatus modelName=" + modelName);
582                     cldsModelService.getModel(modelName).then(function(pars) {
583
584                             console.log("refreStatus: pars=" + pars);
585                             cldsModelService.processRefresh(pars);
586                     }, function(data) {
587
588                     });
589             };
590             $scope.cldsConfirmPerformAction = function(uiAction) {
591
592                     var dlg = dialogs.confirm('Message', 'Do you want to '
593                     + uiAction.toLowerCase() + ' the closed loop?');
594                     dlg.result.then(function(btn) {
595
596                             $scope.cldsPerformAction(uiAction);
597                     }, function(btn) {
598
599                     });
600             };
601             $scope.cldsAskDeployParametersPerformAction = function() {
602
603                     var dlg = dialogs.create(
604                     'partials/portfolios/deploy_parameters.html', 'DeploymentCtrl', {},
605                     {
606                         keyboard : true,
607                         backdrop : true,
608                         windowClass : 'deploy-parameters'
609                     });
610                     dlg.result.then(function() {
611
612                             var confirm = dialogs.confirm('Deploy',
613                             'Are you sure you want to deploy the closed loop?');
614                             confirm.result.then(function() {
615
616                                     cldsToggleDeploy("deploy");
617                             });
618                     });
619             };
620             $scope.cldsConfirmToggleDeployPerformAction = function(uiAction) {
621
622                     var dlg = dialogs.confirm('Message', 'Do you want to '
623                     + uiAction.toLowerCase() + ' the closed loop?');
624                     dlg.result.then(function(btn) {
625
626                             cldsToggleDeploy(uiAction.toLowerCase());
627                     }, function(btn) {
628
629                     });
630             };
631             function cldsToggleDeploy(uiAction) {
632
633                     var modelName = selected_model;
634                     var controlNamePrefix = "ClosedLoop-";
635                     var bpmnText = modelXML;
636                     // serialize model properties
637                     var propText = JSON.stringify(elementMap);
638                     var templateName = selected_template;
639                     var svgXml = $("#svgContainer").html();
640                     console.log("cldsPerformAction: " + uiAction + " modelName="
641                     + modelName);
642                     console.log("cldsPerformAction: " + uiAction
643                     + " controlNamePrefix=" + controlNamePrefix);
644                     console.log("cldsPerformAction: " + uiAction + " bpmnText="
645                     + bpmnText);
646                     console.log("cldsPerformAction: " + uiAction + " propText="
647                     + propText);
648                     console.log("cldsPerformAction: " + uiAction
649                     + " modelEventService=" + modelEventService);
650                     console.log("cldsPerformAction: " + uiAction + " typeID=" + typeID);
651                     console.log("cldsPerformAction: " + uiAction + " deploymentId="
652                     + deploymentId);
653                     cldsModelService.toggleDeploy(uiAction, modelName,
654                     controlNamePrefix, bpmnText, propText, svgXml, templateName,
655                     typeID, controlNameUuid, modelEventService, deploymentId).then(
656                     function(pars) {
657
658                             var cldsObject = pars.body;
659                             typeID = cldsObject.typeId;
660                             controlNameUuid = cldsObject.controlNameUuid;
661                             selected_template = cldsObject.templateName;
662                             modelEventService = cldsObject.event;
663                             actionStateCd = cldsObject.event.actionStateCd;
664                             deploymentId = cldsObject.deploymentId;
665                             cldsModelService.processActionResponse(modelName, cldsObject);
666                     }, function(data) {
667
668                     });
669             }
670             $scope.ToscaModelWindow = function (tosca_model) {
671
672                 var dlg = dialogs.create('partials/portfolios/tosca_model_properties.html','ToscaModelCtrl',{closable:true,draggable:true},{size:'lg',keyboard: true,backdrop: 'static',windowClass: 'my-class'});
673                 dlg.result.then(function(name){
674                 },function(){
675                 });
676             };
677             $scope.PolicyWindow = function(policy) {
678
679                     var dlg = dialogs.create(
680                     'partials/portfolios/PolicyWindow_properties.html',
681                     'operationalPolicyCtrl', {
682                         closable : true,
683                         draggable : true
684                     }, {
685                         size : 'lg',
686                         keyboard : true,
687                         backdrop : 'static',
688                         windowClass : 'my-class'
689                     });
690                     dlg.result.then(function(name) {
691
692                     }, function() {
693
694                     });
695             };
696     } ]);
697 app.service('MenuService', [ '$http', '$q', function($http, $q) {
698
699 } ]);
700 app.directive('focus', function($timeout) {
701
702         return {
703             scope : {
704                     trigger : '@focus'
705             },
706             link : function(scope, element) {
707
708                     scope.$watch('trigger', function(value) {
709
710                             if (value === "true") {
711                                     $timeout(function() {
712
713                                             element[0].focus();
714                                     });
715                             }
716                     });
717             }
718         };
719 });
720 app.directive('draggable', function($document) {
721
722         return function(scope, element, attr) {
723
724                 var startX = 0, startY = 0, x = 0, y = 0;
725                 element.css({
726                     position : 'relative',
727                     backgroundColor : 'white',
728                     cursor : 'move',
729                     display : 'block',
730                 });
731                 element.on('mousedown', function(event) {
732
733                         startX = event.screenX - x;
734                         startY = event.screenY - y;
735                         $document.on('mousemove', mousemove);
736                         $document.on('mouseup', mouseup);
737                 });
738                 function mousemove(event) {
739
740                         y = event.screenY - startY;
741                         x = event.screenX - startX;
742                         element.css({
743                             top : y + 'px',
744                             left : x + 'px'
745                         });
746                 }
747                 function mouseup() {
748
749                         $document.off('mousemove', mousemove);
750                         $document.off('mouseup', mouseup);
751                 }
752         };
753 });
754 app.factory('myHttpInterceptor', function($q, $window) {
755
756         return function(promise) {
757
758                 return promise.then(function(response) {
759
760                         return response;
761                 }, function(response) {
762
763                         return $q.reject(response);
764                 });
765         };
766 });
767 app.run([ '$route', function($route) {
768
769         $route.reload();
770 } ]);
771
772 function F5Window() {
773
774         angular.element(document.getElementById('navbar')).scope().F5Window();
775 }
776 function GOCWindow() {
777
778         angular.element(document.getElementById('navbar')).scope().GOCWindow();
779 }
780 function ToscaModelWindow() {
781     angular.element(document.getElementById('navbar')).scope().ToscaModelWindow();
782 }
783 function PolicyWindow(PolicyWin) {
784
785         angular.element(document.getElementById('navbar')).scope().PolicyWindow(
786         PolicyWin);
787 }
788 function pathDetails(bpmnElementID, bpmnElementName, pathIdentifiers) {
789
790         angular.element(document.getElementById('navbar')).scope().pathDetails(
791         bpmnElementID, bpmnElementName, pathIdentifiers);
792 }
793 function setdefaultvalue() {
794
795         angular.element(document.getElementById('navbar')).scope()
796         .setDefaultValue();
797 }
798 function saveProject() {
799
800         angular.element(document.getElementById('navbar')).scope().saveProject();
801 }
802
803 function defineServiceAcronym() {
804
805         angular.element(document.getElementById('navbar')).scope()
806         .defineServiceAcronym();
807 }
808 function errorProperty(msg) {
809
810         angular.element(document.getElementById('navbar')).scope()
811         .propertyExplorerErrorMessage(msg);
812 }
813 function invisiblepropertyExplorer() {
814
815         angular.element(document.getElementById('navbar')).scope()
816         .invisibleproperty();
817 }
818 function updateDecisionLabel(originalLabel, newLabel) {
819
820         angular.element(document.getElementById('navbar')).scope()
821         .updateDecisionLabels(originalLabel, newLabel);
822 }
823 // Used to logout the session , when browser window was closed
824 window.onunload = function() {
825
826         window.localStorage.removeItem("isAuth");
827         window.localStorage.removeItem("loginuser");
828         window.localStorage.removeItem("invalidUser");
829 };