Remove ECOMP in headers
[clamp.git] / src / main / resources / META-INF / resources / designer / scripts / DashboardCtrl.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
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                 changecolor(selected_model);
91         };
92         $scope.selectActivityTestSet = function() {
93                 console.log("selectActivityTestSet");
94                 $rootScope.isPalette = false;
95                 $rootScope.isRequirementCoverage = false;
96                 $rootScope.isTestset = true;
97                 document.getElementById("modeler_name").textContent = "UTM Test Set";
98                 // document.getElementById('propertyExplorer').classList.add('visible');
99                 // $( "#propertyExplorer" ).prev().css( "display" ,"none");
100                 $('div').find('.k-collapse-next').click();
101                 $rootScope.modeltestset = list_model_test_sets[selected_model];
102                 $rootScope.$apply();
103
104         };
105         $scope.showPalette = function() {
106                 console.log("showPalette");
107                 // alert("showPalette()");
108                 $rootScope.isModel = true;
109                 // $rootScope.isPalette = true;
110
111         };
112
113         $rootScope.filterRouter = 'partials/DashboardFilters.html';
114         $scope.isActivePROD = true;
115         $scope.isActiveQC = false;
116         $rootScope.reload = function(env) {
117                 console.log("reload");
118         };
119
120         $scope.showTDSSView = true;
121
122 }
123 function changecolor(selected_model) {
124         console.log("changecolor");
125
126         var i = 0;
127         // var modelNames =[];
128
129         $(".models").each(function(i) {
130                 console.log("each");
131                 var model_value = $(this).text().trim();
132                 // modelName.push(model_value);
133                 if (model_value == selected_model || model_value == "") {
134                         $(this).addClass("selectedcolor");
135                 } else {
136                         $(this).removeClass("selectedcolor");
137
138                 }
139
140                 i++;
141         });
142 }