Quellcode durchsuchen

AMBARI-17365 Add-host wizard on large clusters is painfully slow. (atkach)

Andrii Tkach vor 9 Jahren
Ursprung
Commit
32448be8fe

+ 4 - 0
ambari-web/app/utils/ajax/ajax.js

@@ -2532,6 +2532,10 @@ var urls = {
       };
     }
   },
+  'hosts.confirmed.minimal': {
+    'real': '/clusters/{clusterName}/hosts?fields=host_components/HostRoles/state&minimal_response=true',
+    'mock': '/data/hosts/HDP2/hosts.json'
+  },
   'host_components.all': {
     'real': '/clusters/{clusterName}/host_components?fields=HostRoles/host_name&minimal_response=true',
     'mock': ''

+ 1 - 4
ambari-web/app/views/main/host/add_view.js

@@ -38,7 +38,7 @@ App.AddHostView = Em.View.extend(App.WizardMenuMixin, {
 
   loadHosts: function () {
     App.ajax.send({
-      name: 'hosts.confirmed',
+      name: 'hosts.confirmed.minimal',
       sender: this,
       data: {},
       success: 'loadHostsSuccessCallback',
@@ -52,9 +52,6 @@ App.AddHostView = Em.View.extend(App.WizardMenuMixin, {
     response.items.forEach(function (item) {
       installedHosts[item.Hosts.host_name] = {
         name: item.Hosts.host_name,
-        cpu: item.Hosts.cpu_count,
-        memory: item.Hosts.total_mem,
-        disk_info: item.Hosts.disk_info,
         bootStatus: "REGISTERED",
         isInstalled: true,
         hostComponents: item.host_components

+ 3 - 12
ambari-web/test/views/main/host/add_view_test.js

@@ -61,9 +61,9 @@ describe('App.AddHostView', function () {
 
     it("App.ajax.send should be called", function() {
       view.loadHosts();
-      var args = testHelpers.filterAjaxRequests('name', 'hosts.confirmed');
+      var args = testHelpers.filterAjaxRequests('name', 'hosts.confirmed.minimal');
       expect(args[0][0]).to.eql({
-        name: 'hosts.confirmed',
+        name: 'hosts.confirmed.minimal',
         sender: view,
         data: {},
         success: 'loadHostsSuccessCallback',
@@ -85,10 +85,7 @@ describe('App.AddHostView', function () {
       var response = {items: [
         {
           Hosts: {
-            host_name: 'host1',
-            cpu_count: 1,
-            total_mem: 1024,
-            disk_info: {}
+            host_name: 'host1'
           },
           host_components: [
             {
@@ -102,9 +99,6 @@ describe('App.AddHostView', function () {
       expect(view.get('controller').setDBProperty.calledWith('hosts', {
         host1: {
           name: 'host1',
-          cpu: 1,
-          memory: 1024,
-          disk_info: {},
           bootStatus: "REGISTERED",
           isInstalled: true,
           hostComponents: [
@@ -117,9 +111,6 @@ describe('App.AddHostView', function () {
       expect(view.get('controller.content.hosts')).to.eql({
         host1: {
           name: 'host1',
-          cpu: 1,
-          memory: 1024,
-          disk_info: {},
           bootStatus: "REGISTERED",
           isInstalled: true,
           hostComponents: [