소스 검색

AMBARI-11390. Hosts - Set Rack doesn’t update rack in the UI, no feedback/confirmation (akovalenko)

Aleksandr Kovalenko 10 년 전
부모
커밋
256f47ab18
1개의 변경된 파일14개의 추가작업 그리고 1개의 파일을 삭제
  1. 14 1
      ambari-web/app/utils/hosts.js

+ 14 - 1
ambari-web/app/utils/hosts.js

@@ -211,8 +211,10 @@ module.exports = {
             data: {
               hostNames: hostNames.join(','),
               requestInfo: operationData.message,
-              rackId: rackId
+              rackId: rackId,
+              hostNamesArray: hostNames
             },
+            success: 'successRackId',
             error: 'errorRackId'
           });
         }
@@ -221,6 +223,17 @@ module.exports = {
     });
   },
 
+  /**
+   * Success callback for set rack id request
+   */
+  successRackId: function (response, request, params) {
+    App.Host.find().forEach(function(host){
+      if (params.hostNamesArray.contains(host.get('hostName'))) {
+        host.set('rack', params.rackId)
+      }
+    });
+  },
+
   /**
    * Warn user that the rack id will not be updated
    */