[CLAMP-1] Initial ONAP CLAMP seed code commit
[clamp.git] / src / main / resources / META-INF / resources / designer / scripts / DashboardCtrl.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
27 function DashboardCtrl($scope,$rootScope,$resource, $http, $timeout, $location, $interval, $q, Datafactory) 
28 {
29         console.log("//////////////DashboardCtrl");
30         $scope.autosaveInterval = 1800000;
31         $scope.testsetgendashboard = false;
32         $rootScope.isModel = false;
33         $rootScope.isPalette = false;
34         $rootScope.isTestSet = false;  
35         $rootScope.isRequirementCoverage = false;
36         $rootScope.ispropertyExplorer = false;
37         $rootScope.parameters;
38         $scope.orientation ="horizontal";
39         $rootScope.ispropertyExplorer = false;
40         $rootScope.isActive =true;
41         $rootScope.models=[];
42         $scope.selectedParent={};
43         $rootScope.utmModels={};
44         $rootScope.selectedModelName;
45         $rootScope.dialogName="";
46         
47
48         $interval( function(){
49         console.log("interval"); 
50                 AutosaveProject($scope,$rootScope,$resource, $http, $timeout, $location, $interval, $q, Datafactory);
51                 }, $scope.autosaveInterval);
52         
53         
54         $rootScope.onSelectActivityModel =function(obj)
55     {
56         console.log("onSelectActivityModel");
57         
58                 $rootScope.isPalette = true;
59                 $rootScope.isTestSet = false;  
60                 $rootScope.isRequirementCoverage = false;
61                 $rootScope.ispropertyExplorer = false;
62         //document.getElementById('propertyExplorer').classList.remove('visible');
63         
64         //$( "#propertyExplorer" ).prev().css( "display" ,"block");
65                 $( "#activity_modeler" ).prev().css( "display", "block" );
66                 $( 'div' ).find('.k-expand-next').click();
67            
68                 if(obj == undefined){
69                         document.getElementById("modeler_name").textContent="Activity Modeler" ;
70                 }else{
71                         selected_model=obj;
72                 document.getElementById("modeler_name").textContent="Activity Modeler"+"  - "+ selected_model ;                 
73                 }
74                 
75                 $rootScope.modelName = selected_model;
76         
77         $rootScope.modeltestset = list_model_test_sets[selected_model];
78         if(list_model_schema_extensions[selected_model] == null){
79                 if(list_model_schema_extensions[$rootScope.utmModels.name] != null) {
80                         list_model_schema_extensions[selected_model] = jQuery.extend(true, {}, list_model_schema_extensions[$rootScope.utmModels.name]);
81                 } else { 
82                         list_model_schema_extensions[selected_model] = {};
83                 }
84         }
85
86                 $rootScope.initProjectExplorer();
87         
88         visibility_model();
89         changecolor(selected_model);
90         
91        
92     };
93     $scope.selectActivityTestSet =function()
94     {
95         console.log("selectActivityTestSet");
96         $rootScope.isPalette = false;
97         $rootScope.isRequirementCoverage = false;
98                 $rootScope.isTestset = true;
99                 document.getElementById("modeler_name").textContent="UTM Test Set";
100                 //document.getElementById('propertyExplorer').classList.add('visible');
101                 //$( "#propertyExplorer" ).prev().css( "display" ,"none");
102                 $( 'div' ).find('.k-collapse-next').click();
103                 $rootScope.modeltestset = list_model_test_sets[selected_model];
104                 $rootScope.$apply();
105                 
106     };
107         $scope.showPalette= function(){
108                 console.log("showPalette");
109                 //alert("showPalette()");
110                 $rootScope.isModel = true;
111         //      $rootScope.isPalette = true;
112                 
113         };
114         
115         //$scope.initialShow=false;
116                         
117         if("/testsetgendashboard"==$location.url())
118         {
119                 $scope.testsetgendashboard = true;
120                 
121                 
122                 $rootScope.total_users = 0;
123                 $scope.showUserView = true;
124                 $scope.showTestExecution = true;
125                 //$rootScope.total_accounts = 606;
126                 $scope.showAccountView = true;
127
128                 $rootScope.total_creation_times = 0;
129                 $rootScope.success_rate_percent = 0;//(((data.data[0].value*1.0)/(data.data[0].value+data.data[1].value))*100).toFixed();
130                 $rootScope.total_accounts = 0;
131                 $scope.showCreation_timeView = true;
132                 $scope.showSuccess_ratePercent = true;
133                 
134                 
135                 //$scope.generalMessages= "This section will show general messages/alerts.";
136                 $scope.gridHeaderMessages= "TestData Self-Service: Select TestCase and Click on Run button!!!";
137                 
138                 //Filters' JS
139
140                     $scope.dt = new Date();
141                   $scope.clear = function () {
142                         console.log("clear");
143                     $scope.dt = null;
144                   };
145
146                   // Disable weekend selection
147                   $scope.disabled = function(date, mode) {
148                         console.log("disabled");
149                     return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) );
150                   };
151
152                   $scope.toggleMin = function() {
153                         console.log("toggleMin");
154                     $scope.minDate = $scope.minDate ? null : new Date();
155                   };
156                   $scope.toggleMin();
157
158                   $scope.open2 = function($event) {
159                         console.log("open2");
160                           $event.preventDefault();
161                     $event.stopPropagation();
162                     console.log(' herro: is the value of opened');
163                     $scope.opened = true;
164                     console.log($scope.opened + ' is the value of opened');
165                   };
166
167                   $scope.dateOptions = {
168                     formatYear: 'yy',
169                     startingDay: 1
170                   };
171
172                   $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate'];
173                   $scope.format = $scope.formats[0];
174                   
175                   $scope.disabled = function(date, mode) 
176                   {
177                         console.log("disabled");
178                 return ( mode === 'day' && ( date.getDay() === -1 || date.getDay() === 7 ) );
179               };
180
181                $scope.maxDate = new Date();
182
183
184                  $scope.open = function($event,opened) {
185                         console.log("open");
186                       $event.preventDefault();
187                       $event.stopPropagation();
188
189                       $scope[opened] = true;
190                     };
191
192
193                $scope.dateOptions = {
194                'year-format': "'yy'",
195                'starting-day': 1
196                };
197                
198                $scope.date = "29-December-2014";
199                $scope.date2 = new Date();
200                
201                $scope.printDate = function()
202                {
203                    console.log("printDate");
204                };
205                                 
206         };
207         
208         
209         
210         
211         
212         $scope.returnObjectArray = function(arrayObj)
213         {
214                 console.log("returnObjectArray");
215                 var newArrayObj = [];
216                 
217                 angular.forEach(arrayObj, function(value, key) 
218                 {
219                         console.log("arrayObj");
220                         newArrayObj.push({"data":value});
221                 });
222                 
223                 return newArrayObj;
224         };
225         
226          
227         $scope.returnTestScenarioTstObjectArray = function(arrayObj)
228          {
229           console.log("returnTestScenarioTstObjectArray");
230           var newArrayObj = [];
231           
232           angular.forEach(arrayObj, function(value, key) 
233           {
234                 console.log("arrayObj");
235                   if( value.testScenarioInstances !=undefined && value.testScenarioInstances.length !=0){
236                           var tempLabel = value.testScenarioInstances[0].label.split(":");
237                                 newArrayObj.push({"data":tempLabel[0]});
238                   }
239                         
240           });
241           
242           return newArrayObj;
243          };
244
245         
246         
247
248         $scope.returnOverRiddenObjectArray = function(arrayObj)
249         {
250                 console.log("returnOverRiddenObjectArray");
251                 var newArrayObj = [];
252                 
253                 angular.forEach(arrayObj, function(value, key) 
254                 {
255                         console.log("arrayObj");
256                         newArrayObj.push({"data":value.name});
257                 });
258                 
259                 return newArrayObj;
260         };
261         
262         
263         
264         
265         $rootScope.filterRouter = 'partials/DashboardFilters.html';
266         $scope.isActivePROD = true;
267         $scope.isActiveQC = false;
268         $rootScope.reload = function(env)
269         {
270                         console.log("reload");
271         };
272
273         $scope.showTDSSView = true;
274         
275         $scope.ReLoadDashboardFromViewResetComboBox = function(type, amount)//('Users','All') ('Accounts','All') ('Creation_times','All')
276         {
277                 console.log("ReLoadDashboardFromViewResetComboBox");
278         };
279         
280         
281         
282         //////////////////////////////////
283         
284         $scope.total_tdr_team_selected_model = [];
285         $scope.total_tdr_users_selected_model = [];
286         $scope.total_tdr_requests_selected_model = [];
287         $scope.total_tdr_entities_selected_model = [];
288         
289         $scope.reloadTDRDashboard = function(name)
290         {
291                 console.log("reloadTDRDashboard");
292                 var url = "/testdata-service/test-data-request/dashboard/counts.json?";
293                                 
294                 $http.get(url+params).success(function(data)
295                 {
296                         console.log("success");
297                         $scope.total_tdr_team_count = data.result.dashboardCountModel.teams;
298                         $scope.total_tdr_users_count = data.result.dashboardCountModel.users;
299                         $scope.total_tdr_requests_count = data.result.dashboardCountModel.requests;
300                         $scope.total_tdr_entities_count = data.result.dashboardCountModel.entities;
301                         
302                         
303                         if("team"!=name)
304                         {
305                                 $scope.total_tdr_team_array = $scope.returnObjectArray(data.result.tdrDashboardModel.teams);    
306                                 $scope.TDRTeamGridId.api().clear().draw();
307                                 $scope.TDRTeamGridId.fnAddData($scope.total_tdr_team_array);
308                         }
309                         
310                         
311                         if("users"!=name)
312                         {
313                                 $scope.total_tdr_users_array = $scope.returnObjectArray(data.result.tdrDashboardModel.users);
314                                 $scope.TDRUserGridId.api().clear().draw();
315                                 $scope.TDRUserGridId.fnAddData($scope.total_tdr_users_array);
316                         }
317                                 
318                         if("status"!=name)
319                         {
320                                 $scope.total_tdr_entities_array = $scope.returnObjectArray(data.result.tdrDashboardModel.entities);
321                                 $scope.TDREntitiesGridId.api().clear().draw();
322                                 $scope.TDREntitiesGridId.fnAddData($scope.total_tdr_entities_array);
323                         }
324                         
325                         if("request"!=name)
326                         {
327                                 $scope.total_tdr_requests_array = $scope.returnObjectArray(data.result.tdrDashboardModel.requests);
328                                 $scope.TDRNumberGridId.api().clear().draw();
329                                 $scope.TDRNumberGridId.fnAddData($scope.total_tdr_requests_array);
330                         }                       
331                 });
332                 
333         };
334         
335         
336         $scope.loadTDRDashboard = function()
337         {
338                 console.log("loadTDRDashboard");
339                 $rootScope.launch('wait'); 
340                 
341                 /* api jobs */
342                 var apiJobUrl = "/utm-service/em/jobs?timezoneOffset=420";
343                  
344                 $http.get(apiJobUrl).success(function(data)
345                 {
346                         console.log("success");
347                         $scope.total_test_scenario_count = data.length;
348                         
349
350                         $scope.TDRNumberGridId = $('#TDRNumberGridId').dataTable( {
351                                 "serverSide": false,
352                                 "aoColumns": [
353
354                                       {   "sTitle": "","mDataProp": null, "sWidth": "20px", "bSortable": false},
355                                       {   "sTitle":"Total TestScenarios","mDataProp": "data","bSortable": true}                                                      
356                           ],
357                                 //"columns": [{"data":   "data"}],
358                           "order": [[ 1, "asc" ]],
359                                 "bPaginate": false,
360                                 "bFilter": false, 
361                                 "bInfo": false,
362                             "bAutoWidth": false,
363                             "bScrollCollapse": false,
364                            "bLengthChange":false,
365                            "bJQueryUI": true,
366                            "search": {"caseInsensitive": true},
367                            "scrollY": "200px",
368                        "scrollX": "100%",
369                        "sScrollXInner": "100%",
370                            "fnCreatedRow": function( nRow, aData, iDataIndex ) 
371                            {
372                                 console.log("fnCreatedRow");
373                                 $(nRow).children("td").css("overflow", "hidden");
374                                 $(nRow).children("td").css("white-space", "nowrap");
375                                 $(nRow).children("td").css("text-overflow", "ellipsis");
376                                 
377                                 var found = false;              
378                                 
379                                 angular.forEach($scope.total_tdr_requests_selected_model, function (value) 
380                         {
381                                 console.log("total_tdr_requests_selected_model");
382                                                 if(aData.data==value.id)
383                                                 {
384                                                         found=true;
385                                                 }
386                         });
387                                 
388                                 if(found)
389                                 {
390                                         $('td:eq(0)', nRow).html( '<span class="tdr_checkbox tdr_checkbox_glyphicon_glyphicon_ok glyphicon glyphicon-ok" id="'+aData.data+'"></span>');
391                                 }
392                                 else
393                                 {
394                                         $('td:eq(0)', nRow).html( '<span class="tdr_checkbox tdr_checkbox_glyphicon_glyphicon_unchecked glyphicon glyphicon-unchecked" id="'+aData.data+'"></span>');
395                                 }
396                                 
397                                 
398                             }
399                     } );
400                         
401                         $scope.total_tdr_requests_array = $scope.returnOverRiddenObjectArray(data);
402                         
403                         if($scope.total_tdr_requests_array.length > 0)
404                         {
405                                 $scope.TDRNumberGridId.fnAddData($scope.total_tdr_requests_array);      
406                         }
407                         
408                         
409                         
410                                                 
411                         
412                         $('#TDRNumberGridId tbody').on( 'click', 'td', function () 
413                         {
414                                 console.log("click");
415                                 var position = $scope.TDRNumberGridId.fnGetPosition(this); // getting the clicked row position                          
416                         
417                          if(position[1]==1)
418                          {
419                                  
420                                         var valueX = this.innerHTML;
421                                 
422                                 $('.tdr_checkbox').each(function(i, obj) 
423                                 {        
424                                         console.log("tdr_checkbox");
425                                         var uncheck = $(obj).hasClass( "glyphicon-unchecked");
426                                         
427                                         if(valueX==obj.id && uncheck)
428                                         {
429                                                 $(obj).attr('class','tdr_checkbox tdr_checkbox_glyphicon_glyphicon_ok glyphicon glyphicon-ok');
430                                         }                                       
431                                         else if(valueX==obj.id && !uncheck)
432                                         {
433                                                 $(obj).attr('class','tdr_checkbox tdr_checkbox_glyphicon_glyphicon_unchecked glyphicon glyphicon-unchecked');
434                                         }                                                                                       
435                                 });
436                                 
437                                 
438                                  if($('.tdr_checkbox_glyphicon_glyphicon_ok').length <= 0)
439                                      {
440                                          $scope.total_tdr_requests_selected_model = [];                                  
441                                          $scope.total_tdr_requests_selected_model.push({'id':'All'});                                    
442                                  }
443                                  else
444                                          {
445                                          $scope.total_tdr_requests_selected_model = [];
446                                          
447                                                 $('.tdr_checkbox_glyphicon_glyphicon_ok').each(function(i, obj) 
448                                         {       
449                                                 console.log("tdr_checkbox_glyphicon_glyphicon_ok");
450                                                         $scope.total_tdr_requests_selected_model.push({'id':obj.id});
451                                         });
452                                                 
453                                          }
454                          }              
455                          else
456                          {
457                                 var valueX = this.innerHTML.substring(this.innerHTML.indexOf("id=\"")+4,this.innerHTML.length-9);
458                                 
459                                 $('.tdr_checkbox').each(function(i, obj) 
460                                         {        
461                                                 console.log("tdr_checkbox");
462                                         var uncheck = $(obj).hasClass( "glyphicon-unchecked");
463                                         
464                                         if(valueX==obj.id && uncheck)
465                                         {
466                                                 $(obj).attr('class','tdr_checkbox tdr_checkbox_glyphicon_glyphicon_ok glyphicon glyphicon-ok');
467                                         }                                       
468                                         else if(valueX==obj.id && !uncheck)
469                                         {
470                                                 $(obj).attr('class','tdr_checkbox tdr_checkbox_glyphicon_glyphicon_unchecked glyphicon glyphicon-unchecked');
471                                         }
472                                                                                         
473                                          });
474                                 
475                                 
476                                  if($('.tdr_checkbox_glyphicon_glyphicon_ok').length <= 0)
477                                      {
478                                          $scope.total_tdr_requests_selected_model = [];                                  
479                                          $scope.total_tdr_requests_selected_model.push({'id':'All'});   
480                                  }
481                                  else
482                                          { 
483                                          $scope.total_tdr_requests_selected_model = [];
484                                                 $('.tdr_checkbox_glyphicon_glyphicon_ok').each(function(i, obj) 
485                                         {        
486                                                 console.log("tdr_checkbox_glyphicon_glyphicon_ok");
487                                                         $scope.total_tdr_requests_selected_model.push({'id':obj.id});   
488                                         });
489                                          }
490                          }
491
492                          $scope.reloadTDRDashboard('request');
493                         });
494                         //$scope.initialShow=true;
495                         $rootScope.$broadcast('dialogs.wait.complete');
496                         
497                 
498                 });
499                 
500         };
501                 
502
503         
504         $scope.getCommaSeparatedString = function(json) 
505         { 
506                 console.log("getCommaSeparatedString");
507                 if(json==undefined || json==null)
508                 {
509                         return "All";
510                 }
511                 
512                 var result = "";
513                 var found =false;
514                 
515                 for (var dString in json) 
516                 { 
517                         result += json[dString].id + ",";
518                         found=true;
519                 }
520                                 
521                 var res = result.match(/All,/g);
522                 
523                 if(res!=null && result.split(",").length > 1)
524                 {
525                         result = result.replace("All,", "");
526                 }
527                                 
528                 if(!found || result=="")
529                 {
530                         return "All";
531                 }
532                 
533                 return result.replace(/,(\s+)?$/, '');
534         };
535         
536         
537         /*if("/dashboard"==$location.url())
538         {
539                 $scope.loadTDRDashboard();
540         }*/
541         
542         
543         
544         $scope.reloadTDRDashboardFromReset = function(name)
545         {
546                 console.log("reloadTDRDashboardFromReset");
547                 var url = "/testdata-service/test-data-request/dashboard/counts.json?";
548                 var params = "teams="+$scope.getCommaSeparatedString($scope.total_tdr_team_selected_model);
549                 params = params + "&users="+$scope.getCommaSeparatedString($scope.total_tdr_users_selected_model); 
550                 params = params + "&requests="+$scope.getCommaSeparatedString($scope.total_tdr_requests_selected_model);
551                 params = params + "&status="+$scope.getCommaSeparatedString($scope.total_tdr_entities_selected_model);
552                                 
553                 $http.get(url+params).success(function(data)
554                 {
555                         console.log("success");
556                         $scope.total_tdr_team_count = data.result.dashboardCountModel.teams;
557                         $scope.total_tdr_users_count = data.result.dashboardCountModel.users;
558                         $scope.total_tdr_requests_count = data.result.dashboardCountModel.requests;
559                         $scope.total_tdr_entities_count = data.result.dashboardCountModel.entities;
560                         
561                         $scope.total_tdr_team_array = $scope.returnObjectArray(data.result.tdrDashboardModel.teams);    
562                         $scope.TDRTeamGridId.api().clear().draw();
563                         $scope.TDRTeamGridId.fnAddData($scope.total_tdr_team_array);
564                         
565                         $scope.total_tdr_users_array = $scope.returnObjectArray(data.result.tdrDashboardModel.users);
566                         $scope.TDRUserGridId.api().clear().draw();
567                         $scope.TDRUserGridId.fnAddData($scope.total_tdr_users_array);
568                         
569                         $scope.total_tdr_entities_array = $scope.returnObjectArray(data.result.tdrDashboardModel.entities);                     
570                         $scope.TDREntitiesGridId.api().clear().draw();
571                         $scope.TDREntitiesGridId.fnAddData($scope.total_tdr_entities_array);
572                         
573                         $scope.total_tdr_requests_array = $scope.returnObjectArray(data.result.tdrDashboardModel.requests);
574                         $scope.TDRNumberGridId.api().clear().draw();
575                         $scope.TDRNumberGridId.fnAddData($scope.total_tdr_requests_array);                                              
576                 });
577                 
578         };
579         
580         
581         $scope.ReLoadTDRDashboard = function(name)
582         {
583                 console.log("ReLoadTDRDashboard");
584                 if("team"==name)
585                 {
586                         $scope.total_tdr_team_selected_model = [];
587                 }               
588                 
589                 if("users"==name)
590                 {
591                         $scope.total_tdr_users_selected_model = [];
592                 }
593                         
594                 if("status"==name)
595                 {
596                         $scope.total_tdr_entities_selected_model = [];
597                 }
598                 
599                 if("request"==name)
600                 {
601                         $scope.total_tdr_requests_selected_model = [];
602                 }       
603                 
604                 $scope.reloadTDRDashboardFromReset(name);
605                 
606         };
607         
608         $rootScope.populateUTMModelArray= function(utm_models,utmModels){
609                 console.log("populateUTMModelArray");
610                 var modelName =utmModels.name;
611                 if (utmModels != null && utmModels.name != null) {
612                         if($rootScope.oldUTMModels != null  && $rootScope.oldUTMModels.length > 0){
613                                 for(var i=0 ;i<$rootScope.oldUTMModels.length;i++ ){
614                                         var tempOldName  = $rootScope.oldUTMModels[i];
615                                         console.log("new model name from map:"+old_new_model_name[tempOldName]);
616                                         if( utmModels.name ==  old_new_model_name[tempOldName]){
617                                                 modelName = $rootScope.oldUTMModels[i];
618                                         }       
619                                 }       
620                         }
621                         var utm_model = {};
622                         utm_model.modelName = utmModels.name;
623                         utm_model.modelXML = list_models[modelName];
624                         utm_model.repeatableHeirachicalSchemaElements = {};
625                         utm_model.repeatableHeirachicalSchemaElements = list_model_repeatable_heirarchical_elements[modelName];
626                         
627                         utm_model.testManagementDetails = {};
628                         utm_model.testManagementDetails = list_model_test_management_details[modelName];
629                         
630                         var activitytestset={};
631                         activitytestset.invalidModelException=null;
632                         activitytestset.serviceName=serviceName;
633                         activitytestset.activityTestCases=[];
634                         if (list_model_test_sets[modelName] != null && list_model_test_sets[modelName].activityTestCases != null) {
635                                 activitytestset.activityTestCases=angular.copy(list_model_test_sets[modelName].activityTestCases);
636                         }       
637                         utm_model.activityTestSet = activitytestset;
638                         
639                         utm_model.utmPropertyExplorer = {};
640                         utm_model.utmPropertyExplorer.pathDetailsList = [];
641                         if (list_model_path_details[modelName] != null) {
642                                 utm_model.utmPropertyExplorer.pathDetailsList = angular.copy(list_model_path_details[modelName]);
643                         }
644                         
645                         utm_model.utmModelSchemaExtention = {};
646                         utm_model.utmModelSchemaExtention.utmSchemaExtentionMap = {};
647                         if (list_model_schema_extensions[modelName] != null) {
648                                 utm_model.utmModelSchemaExtention = angular.copy(list_model_schema_extensions[modelName]);
649                         }
650                         
651                         utm_models.push(utm_model);
652                         if(utmModels.subModels != null && utmModels.subModels.length>0){                                
653                                 for(var i=0 ; i<utmModels.subModels.length;i++) {
654                                         var subModel = {};
655                                         subModel = utmModels.subModels[i];
656                                         $scope.populateUTMModelArray(utm_models,subModel);
657                                  }
658                         }
659                 }
660         };
661         
662         
663         /*$scope.getPallette = function(){
664                 alert("nothing");
665                                 createNewDiagram();
666                                 alert("after");
667         };*/
668         
669         
670 }
671 function changecolor(selected_model)
672 {
673         console.log("changecolor");
674         
675         var i = 0;
676         //var modelNames =[];
677         
678     $(".models").each(function(i){
679         console.log("each");
680     var model_value = $(this).text().trim();
681     //modelName.push(model_value);
682     if(model_value == selected_model || model_value == "")
683     {
684          $(this).addClass("selectedcolor");
685     }
686     else
687     {
688         $(this).removeClass("selectedcolor");
689         
690     }
691         
692        i++; 
693     });
694 }
695
696