ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject [2/2] ambari git commit: AMBARI-10184. Admin View: property validation needs to show for instance invalid (alexantonenko)
Date Tue, 24 Mar 2015 16:23:25 GMT
AMBARI-10184. Admin View: property validation needs to show for instance invalid (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 2518f87fdc9e90494ed81b7f09ea68a82d3ad825
Parents: 241f831
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Mon Mar 23 19:46:46 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Tue Mar 24 18:22:46 2015 +0200

----------------------------------------------------------------------
 .../controllers/ambariViews/CreateViewInstanceCtrl.js    |  7 +++++++
 .../ui/admin-web/app/views/ambariViews/create.html       | 11 +++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2518f87f/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 41d49d3..2492c91 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
@@ -90,6 +90,8 @@ angular.module('ambariAdminConsole')
         })
         .catch(function (data) {
           var errorMessage = data.message;
+          var showGeneralError = true;
+
           if (data.status >= 400) {
             try {
               var errorObject = JSON.parse(errorMessage);
@@ -97,9 +99,14 @@ angular.module('ambariAdminConsole')
               angular.forEach(errorObject.propertyResults, function (item, key) {
                 $scope.form.instanceCreateForm[key].validationError = !item.valid;
                 if (!item.valid) {
+                  showGeneralError = false;
                   $scope.form.instanceCreateForm[key].validationMessage = item.detail;
                 }
               });
+
+              if (showGeneralError) {
+                $scope.form.instanceCreateForm.generalValidationError = errorMessage;  
+              }
             } catch (e) {
               console.error('Unable to parse error message:', data.message);
             }

http://git-wip-us.apache.org/repos/asf/ambari/blob/2518f87f/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 db0443f..4d0b87a 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
@@ -35,13 +35,13 @@
       </div>
     </div>
   </div>
-  
+
   <div class="panel panel-default">
     <div class="panel-heading">
       <h3 class="panel-title">Details</h3>
     </div>
     <div class="panel-body">
-      <div class="form-group" 
+      <div class="form-group"
       ng-class="{'has-error' : ( (form.instanceCreateForm.instanceNameInput.$error.required
|| form.instanceCreateForm.instanceNameInput.$error.pattern) && form.instanceCreateForm.submitted)
|| instanceExists }"
       >
         <label for="" class="control-label col-sm-2">Instance Name</label>
@@ -98,6 +98,9 @@
       <h3 class="panel-title">Properties</h3>
     </div>
     <div class="panel-body property-form">
+      <div class="alert alert-danger bottom-margin top-margin" ng-show='form.instanceCreateForm.generalValidationError'>
+        {{form.instanceCreateForm.generalValidationError}}
+      </div>
       <div class="form-group" ng-repeat="parameter in instance.properties"
         ng-class="{'has-error' : ((form.instanceCreateForm[parameter.name].$error.required
&& form.instanceCreateForm.submitted) || form.instanceCreateForm[parameter.name].validationError)}"
>
         <label for="" class="col-sm-3 control-label" ng-class="{'not-required': !parameter.required}">{{parameter.label
|| parameter.displayName}}{{parameter.required ? '*' : ''}}</label>
@@ -121,11 +124,11 @@
       </div>
     </div>
   </div>
-  
+
   <div class="col-sm-12 ">
     <button class="btn btn-primary pull-right left-margin save-button"
             ng-class="{'disabled' : (form.instanceCreateForm.isSaving)}" ng-click="save()"
type="submit">Save</button>
     <a href ng-click="cancel()" class="btn btn-default pull-right cancel-button">Cancel</a>
   </div>
-    
+
 </form>


Mime
View raw message