ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [1/3] ambari git commit: AMBARI-11572. Admin View UI does not allow cluster association all the time (alexantonenko)
Date Sun, 31 May 2015 20:08:45 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f3d49fade -> 23604e3a1


AMBARI-11572. Admin View UI does not allow cluster association all the time (alexantonenko)


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

Branch: refs/heads/trunk
Commit: f4631d7045fe6d76309f61f2a0adf7ce797d7b96
Parents: f3d49fa
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Sun May 31 21:32:19 2015 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Sun May 31 23:02:55 2015 +0300

----------------------------------------------------------------------
 .../ambariViews/CreateViewInstanceCtrl.js         | 18 +++++++++++++++++-
 .../controllers/ambariViews/ViewsEditCtrl.js      |  2 +-
 .../admin-web/app/views/ambariViews/create.html   |  2 +-
 .../ui/admin-web/app/views/ambariViews/edit.html  |  8 ++++----
 4 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f4631d70/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
index 902a593..9ee7cf7 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js
@@ -64,9 +64,24 @@ angular.module('ambariAdminConsole')
     }
   });
 
+  $scope.enableLocalCluster = function () {
+    if($scope.errorKeys.length > 0) {
+      $scope.errorKeys.forEach( function (key) {
+        try {
+          $scope.form.instanceCreateForm[key].validationError = false;
+          $scope.form.instanceCreateForm[key].validationMessage = '';
+        } catch (e) {
+          console.log('Unable to reset error message for prop:', key);
+        }
+      });
+      $scope.errorKeys = [];
+    }
+  };
+
   // $scope.view = viewVersion;
   $scope.isAdvancedClosed = true;
   $scope.instanceExists = false;
+  $scope.errorKeys = [];
 
   $scope.clusterConfigurable = false;
   $scope.clusterConfigurableErrorMsg = "";
@@ -120,7 +135,7 @@ angular.module('ambariAdminConsole')
           var errorMessage = data.message;
           var showGeneralError = true;
 
-          if (data.status >= 400) {
+          if (data.status >= 400 && !$scope.instance.isLocalCluster) {
             try {
               var errorObject = JSON.parse(errorMessage);
               errorMessage = errorObject.detail;
@@ -129,6 +144,7 @@ angular.module('ambariAdminConsole')
                 if (!item.valid) {
                   showGeneralError = false;
                   $scope.form.instanceCreateForm[key].validationMessage = item.detail;
+                  $scope.errorKeys.push(key);
                 }
               });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4631d70/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 512761c..e7f80ee 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
@@ -300,7 +300,7 @@ angular.module('ambariAdminConsole')
         //TODO: maybe the BackEnd should sanitize the string beforehand?
         errorMessage = errorMessage.substr(errorMessage.indexOf("\{"));
 
-        if (data.status >= 400) {
+        if (data.status >= 400 && !$scope.isLocalCluster) {
           try {
             var errorObject = JSON.parse(errorMessage);
             errorMessage = errorObject.detail;

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4631d70/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
index dd274a2..dffd66e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/create.html
@@ -128,7 +128,7 @@
     <div class="panel-body property-form" popover="{{clusterConfigurableErrorMsg}}" popover-trigger="mouseenter">
       <div class="checkbox create-checkbox-cluster">
         <label>
-          <input type="radio" ng-disabled="!clusterConfigurable || noClusterAvailible"
ng-model="instance.isLocalCluster" ng-value="true" class="visibilityCheckbox"> Local Ambari
Managed Cluster
+          <input type="radio" ng-disabled="!clusterConfigurable || noClusterAvailible"
ng-model="instance.isLocalCluster" ng-change="enableLocalCluster()" ng-value="true" class="visibilityCheckbox">
Local Ambari Managed Cluster
         </label>
       </div>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f4631d70/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
index b41f639..ac058c0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
@@ -211,18 +211,18 @@
   <div class="panel-body edit-view-custom-wrap">
     <form name="propertiesForm" class="form-horizontal property-form" ng-hide="isConfigurationEmpty"
novalidate>
       <fieldset>
-        <div class="form-group" ng-repeat="property in configurationMeta | filter:{clusterConfig:true}"
ng-class="{'has-error' : (!editConfigurationDisabled && ((property.required &&
propertiesForm[property.name].$error.required && !editConfigurationDisabled) || propertiesForm[property.name].validationError))}">
+        <div class="form-group" ng-repeat="property in configurationMeta | filter:{clusterConfig:true}"
ng-class="{'has-error' : (!editConfigurationDisabled && !isLocalCluster &&
((property.required && propertiesForm[property.name].$error.required && !editConfigurationDisabled)
|| propertiesForm[property.name].validationError))}">
           <label for="" class="control-label col-sm-3" ng-class="{'not-required': !property.required}">{{property.label
|| property.displayName}}{{property.required ? '*' : ''}}</label>
           <div ng-switch="property.type">
             <div class="col-sm-9 checkbox" ng-switch-when="boolean">
               <input type="checkbox" class="propertie-input" ng-disabled="isLocalCluster
|| editConfigurationDisabled" name="{{property.name}}" ng-model="configuration[property.name]"
ng-true-value="true" ng-false-value="false" popover="{{property.description}}" popover-title="{{property.name}}"
popover-trigger="mouseenter">
             </div>
             <div class="col-sm-9" ng-switch-default>
-              <input type="{{property.masked ? 'password' : 'text'}}" class="form-control
propertie-input" ng-required="property.required" ng-change="propertiesForm[property.name].validationError=''"
ng-disabled="isLocalCluster || editConfigurationDisabled" name="{{property.name}}" ng-model="configuration[property.name]"
popover="{{property.description}}" popover-title="{{property.name}}" popover-trigger="mouseenter"
placeholder="{{property.placeholder}}">
-              <div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required
&& propertiesForm[property.name].$error.required && !editConfigurationDisabled'>
+              <input type="{{property.masked ? 'password' : 'text'}}" class="form-control
propertie-input" ng-required="property.required && !isLocalCluster" ng-change="propertiesForm[property.name].validationError=''"
ng-disabled="isLocalCluster || editConfigurationDisabled" name="{{property.name}}" ng-model="configuration[property.name]"
popover="{{property.description}}" popover-title="{{property.name}}" popover-trigger="mouseenter"
placeholder="{{property.placeholder}}">
+              <div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required
&& propertiesForm[property.name].$error.required && !editConfigurationDisabled
&& !isLocalCluster'>
                 This field is required.
               </div>
-              <div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required
&& propertiesForm[property.name].validationError && !editConfigurationDisabled'>
+              <div class="alert alert-danger no-margin-bottom top-margin" ng-show='property.required
&& propertiesForm[property.name].validationError && !editConfigurationDisabled
&& !isLocalCluster'>
                 {{propertiesForm[property.name].validationMessage}}
               </div>
             </div>


Mime
View raw message