瀏覽代碼

AMBARI-14809 Ambari Admin: Incorrect handling of unsaved changes in Roles section. (atkach)

Andrii Tkach 9 年之前
父節點
當前提交
f4edad887f
共有 1 個文件被更改,包括 9 次插入0 次删除
  1. 9 0
      ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/editableList.js

+ 9 - 0
ambari-admin/src/main/resources/ui/admin-web/app/scripts/directives/editableList.js

@@ -111,6 +111,13 @@ angular.module('ambariAdminConsole')
             break;
         }
       });
+
+      $elem.find('.editable-list-container').on('reset', function(event) {
+        $scope.editMode = false;
+        $scope.items = angular.copy($scope.itemsSource);
+        $scope.input = '';
+        event.stopPropagation();
+      });
     },
     controller: ['$scope', '$injector', '$modal', function($scope, $injector, $modal) {
       var $resource = $injector.get($scope.resourceType);
@@ -175,6 +182,8 @@ angular.module('ambariAdminConsole')
 
       $scope.enableEditMode = function(event) {
         if( $scope.editable && !$scope.editMode){
+          //only one editable-list could be in edit mode at once
+          $('.cluster-manage-access-pane div.edit-mode').trigger('reset');
           $scope.editMode = true;
           $scope.focusOnInput();
         }