Remove datatable lib
[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 function DashboardCtrl($scope, $rootScope, $resource, $http, $timeout,
27                 $location, $interval, $q, Datafactory) {
28         console.log("//////////////DashboardCtrl");
29         $scope.autosaveInterval = 1800000;
30         $rootScope.isModel = false;
31         $rootScope.isPalette = false;
32         $rootScope.isTestSet = false;
33         $rootScope.isRequirementCoverage = false;
34         $rootScope.ispropertyExplorer = false;
35         $rootScope.parameters;
36         $scope.orientation = "horizontal";
37         $rootScope.ispropertyExplorer = false;
38         $rootScope.isActive = true;
39         $rootScope.models = [];
40         $scope.selectedParent = {};
41         $rootScope.utmModels = {};
42         $rootScope.selectedModelName;
43         $rootScope.dialogName = "";
44
45         $interval(function() {
46                 console.log("interval");
47                 /*
48                  * AutosaveProject($scope,$rootScope,$resource, $http, $timeout,
49                  * $location, $interval, $q, Datafactory);
50                  */
51         }, $scope.autosaveInterval);
52
53         $rootScope.onSelectActivityModel = function(obj) {
54                 console.log("onSelectActivityModel");
55
56                 $rootScope.isPalette = true;
57                 $rootScope.isTestSet = false;
58                 $rootScope.isRequirementCoverage = false;
59                 $rootScope.ispropertyExplorer = false;
60                 // document.getElementById('propertyExplorer').classList.remove('visible');
61
62                 // $( "#propertyExplorer" ).prev().css( "display" ,"block");
63                 $("#activity_modeler").prev().css("display", "block");
64                 $('div').find('.k-expand-next').click();
65
66                 if (obj == undefined) {
67                         document.getElementById("modeler_name").textContent = "Activity Modeler";
68                 } else {
69                         selected_model = obj;
70                         document.getElementById("modeler_name").textContent = "Activity Modeler"
71                                         + "  - " + selected_model;
72                 }
73
74                 $rootScope.modelName = selected_model;
75
76                 $rootScope.modeltestset = list_model_test_sets[selected_model];
77                 if (list_model_schema_extensions[selected_model] == null) {
78                         if (list_model_schema_extensions[$rootScope.utmModels.name] != null) {
79                                 list_model_schema_extensions[selected_model] = jQuery
80                                                 .extend(
81                                                                 true,
82                                                                 {},
83                                                                 list_model_schema_extensions[$rootScope.utmModels.name]);
84                         } else {
85                                 list_model_schema_extensions[selected_model] = {};
86                         }
87                 }
88
89                 $rootScope.initProjectExplorer();
90
91                 visibility_model();
92                 changecolor(selected_model);
93
94         };
95         $scope.selectActivityTestSet = function() {
96                 console.log("selectActivityTestSet");
97                 $rootScope.isPalette = false;
98                 $rootScope.isRequirementCoverage = false;
99                 $rootScope.isTestset = true;
100                 document.getElementById("modeler_name").textContent = "UTM Test Set";
101                 // document.getElementById('propertyExplorer').classList.add('visible');
102                 // $( "#propertyExplorer" ).prev().css( "display" ,"none");
103                 $('div').find('.k-collapse-next').click();
104                 $rootScope.modeltestset = list_model_test_sets[selected_model];
105                 $rootScope.$apply();
106
107         };
108         $scope.showPalette = function() {
109                 console.log("showPalette");
110                 // alert("showPalette()");
111                 $rootScope.isModel = true;
112                 // $rootScope.isPalette = true;
113
114         };
115
116         $rootScope.filterRouter = 'partials/DashboardFilters.html';
117         $scope.isActivePROD = true;
118         $scope.isActiveQC = false;
119         $rootScope.reload = function(env) {
120                 console.log("reload");
121         };
122
123         $scope.showTDSSView = true;
124
125 }
126 function changecolor(selected_model) {
127         console.log("changecolor");
128
129         var i = 0;
130         // var modelNames =[];
131
132         $(".models").each(function(i) {
133                 console.log("each");
134                 var model_value = $(this).text().trim();
135                 // modelName.push(model_value);
136                 if (model_value == selected_model || model_value == "") {
137                         $(this).addClass("selectedcolor");
138                 } else {
139                         $(this).removeClass("selectedcolor");
140
141                 }
142
143                 i++;
144         });
145 }