2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * Unless otherwise specified, all software contained herein is licensed
9 * under the Apache License, Version 2.0 (the "License");
10 * you may not use this software except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
21 * Unless otherwise specified, all documentation contained herein is licensed
22 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
23 * you may not use this documentation except in compliance with the License.
24 * You may obtain a copy of the License at
26 * https://creativecommons.org/licenses/by/4.0/
28 * Unless required by applicable law or agreed to in writing, documentation
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 * ============LICENSE_END============================================
36 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
41 class WidgetParameterController {
42 constructor($scope, widgetsCatalogService, userProfileService, $state,items) {
43 $scope.ngDialogData=items;
44 let widgetId = $scope.ngDialogData.widgetId;
45 $scope.modflag = false;
46 $scope.isLoadingTable = false;
47 $scope.messageInfo = false;
49 widgetsCatalogService.getWidgetCatalogParameters(widgetId).then(res => {
50 if(res.status == 'OK'){
51 $scope.isLoadingTable = true;
52 $scope.widgetParam = res.response;
53 }else if(res.status == 'WARN'){
54 $scope.messageInfo = true;
57 $log.error('WidgetParameterController::init error: ' + err);
60 $scope.setEdit = function(index) {
61 if($scope.modflag === false){
62 $scope.widgetParam[index].showEdit = true;
63 $scope.modflag = true;
67 $scope.resetDefault = function(index) {
68 var widgetParamObject = {};
69 widgetParamObject.user_value = $scope.widgetParam[parseInt(index)].default_value;
70 widgetParamObject.paramId = $scope.widgetParam[parseInt(index)].param_id;
71 widgetParamObject.widgetId = widgetId;
72 widgetsCatalogService.saveWidgetParameter(widgetParamObject)
74 if(res.status == 'OK'){
75 $scope.widgetParam[index].user_value = $scope.widgetParam[index].default_value;
80 $scope.modify = function(index) {
82 var widgetParamObject = {};
83 widgetParamObject.user_value = $scope.widgetParam[parseInt(index)].user_value;
84 widgetParamObject.paramId = $scope.widgetParam[parseInt(index)].param_id;
85 widgetParamObject.widgetId = widgetId;
87 widgetsCatalogService.saveWidgetParameter(widgetParamObject)
89 if(res.status == 'OK'){
90 $scope.modflag = false;
91 $scope.widgetParam[index].showEdit = false;
99 WidgetParameterController.$inject = ['$scope', 'widgetsCatalogService', 'userProfileService', '$state','items'];
100 angular.module('ecompApp').controller('WidgetParameterController', WidgetParameterController);