ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject git commit: AMBARI-7893 Slider View: Updating view params in UI breaks masked params. (atkach)
Date Wed, 22 Oct 2014 14:55:19 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk e5f9fbb04 -> 4fb2a8e02


AMBARI-7893 Slider View: Updating view params in UI breaks masked params. (atkach)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4fb2a8e0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4fb2a8e0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4fb2a8e0

Branch: refs/heads/trunk
Commit: 4fb2a8e021d65f5a7b5dfc4b26ca007226ceb6d1
Parents: e5f9fbb
Author: atkach <atkach@hortonworks.com>
Authored: Wed Oct 22 17:54:59 2014 +0300
Committer: atkach <atkach@hortonworks.com>
Committed: Wed Oct 22 17:54:59 2014 +0300

----------------------------------------------------------------------
 .../controllers/ambariViews/ViewsEditCtrl.js    | 32 +++++++++++++-------
 1 file changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4fb2a8e0/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
index b179a70..cbd235c 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
@@ -33,19 +33,22 @@ angular.module('ambariAdminConsole')
         'description': $scope.instance.ViewInstanceInfo.description
       };
 
-      $scope.configuration = angular.copy($scope.instance.ViewInstanceInfo.properties);
-      for(var confName in $scope.configuration){
-        if( $scope.configuration.hasOwnProperty(confName) ){
-          $scope.configuration[confName] = $scope.configuration[confName] === 'null' ? ''
: $scope.configuration[confName];
-        }
-      }
-      $scope.isConfigurationEmpty = angular.equals({}, $scope.configuration);
+        initConfigurations();
+        $scope.isConfigurationEmpty = angular.equals({}, $scope.configuration);
     })
     .catch(function(data) {
       Alert.error('Cannot load instance info', data.data.message);
     });
   }
 
+  function initConfigurations() {
+    $scope.configuration = angular.copy($scope.instance.ViewInstanceInfo.properties);
+    for (var confName in $scope.configuration) {
+      if ($scope.configuration.hasOwnProperty(confName)) {
+        $scope.configuration[confName] = $scope.configuration[confName] === 'null' ? '' :
$scope.configuration[confName];
+      }
+    }
+  }
 
   // Get META for properties
   View.getMeta($routeParams.viewId, $routeParams.version).then(function(data) {
@@ -114,9 +117,16 @@ angular.module('ambariAdminConsole')
 
   
   $scope.editConfigurationDisabled = true;
-  $scope.togglePropertiesEditing = function() {
-     $scope.editConfigurationDisabled = !$scope.editConfigurationDisabled;
-  }
+  $scope.togglePropertiesEditing = function () {
+    $scope.editConfigurationDisabled = !$scope.editConfigurationDisabled;
+    if (!$scope.editConfigurationDisabled) {
+      $scope.configurationMeta.forEach(function (element) {
+        if (element.masked) {
+          $scope.configuration[element.name] = '';
+        }
+      });
+    }
+  };
   $scope.saveConfiguration = function() {
     if( $scope.propertiesForm.$valid ){
       return View.updateInstance($routeParams.viewId, $routeParams.version, $routeParams.instanceId,
{
@@ -134,7 +144,7 @@ angular.module('ambariAdminConsole')
     }
   };
   $scope.cancelConfiguration = function() {
-    $scope.configuration = angular.copy($scope.instance.ViewInstanceInfo.properties);
+    initConfigurations();
     $scope.editConfigurationDisabled = true;
     $scope.propertiesForm.$setPristine();
   };


Mime
View raw message