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