You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2018/08/06 10:06:31 UTC

[ambari] branch trunk updated: AMBARI-24405. Components in hosts page should be sorted by display name (akovalenko)

This is an automated email from the ASF dual-hosted git repository.

akovalenko pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 1db1dd0  AMBARI-24405. Components in hosts page should be sorted by display name (akovalenko)
1db1dd0 is described below

commit 1db1dd06be5d55f83427bbb1f6c152ecde90ed11
Author: Aleksandr Kovalenko <ak...@apache.org>
AuthorDate: Thu Aug 2 18:57:28 2018 +0300

    AMBARI-24405. Components in hosts page should be sorted by display name (akovalenko)
---
 ambari-web/app/views/main/host/summary.js       | 20 +++-----
 ambari-web/test/views/main/host/summary_test.js | 67 +++----------------------
 2 files changed, 14 insertions(+), 73 deletions(-)

diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index 72721d4..43585d7 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -171,23 +171,19 @@ App.MainHostSummaryView = Em.View.extend(App.HiveInteractiveCheck, App.TimeRange
    * Master components first, then slaves and clients
    */
   sortedComponentsFormatter: function() {
-    const updatebleProperties = Em.A(['workStatus', 'passiveState', 'staleConfigs', 'haStatus']);
     const hostComponentViewMap = this.get('hostComponentViewMap');
-    const masters = [], slaves = [], clients = [];
-
+    let sortedComponentsArray = [];
     this.get('content.hostComponents').forEach(function (component) {
       component.set('viewClass', hostComponentViewMap[component.get('componentName')] ? hostComponentViewMap[component.get('componentName')] : App.HostComponentView);
-      if (component.get('isMaster')) {
-        masters.push(component);
-      } else if (component.get('isSlave')) {
-        slaves.push(component);
-      } else if (component.get('isClient')) {
+      if (component.get('isClient')) {
         component.set('isLast', true);
         component.set('isInstallFailed', ['INSTALL_FAILED', 'INIT'].contains(component.get('workStatus')));
-        clients.pushObject(component);
-        }
-    }, this);
-    this.set('sortedComponents', masters.concat(slaves, clients));
+      }
+      sortedComponentsArray.push(component);
+    });
+
+    sortedComponentsArray = sortedComponentsArray.sort((a, b) => a.get('displayName').localeCompare(b.get('displayName')));
+    this.set('sortedComponents', sortedComponentsArray);
   },
 
   /**
diff --git a/ambari-web/test/views/main/host/summary_test.js b/ambari-web/test/views/main/host/summary_test.js
index b456b88..52a2b4e 100644
--- a/ambari-web/test/views/main/host/summary_test.js
+++ b/ambari-web/test/views/main/host/summary_test.js
@@ -57,69 +57,14 @@ describe('App.MainHostSummaryView', function() {
       {
         content: Em.Object.create({
           hostComponents: Em.A([
-            Em.Object.create({isMaster: false, isSlave: true, componentName: 'B'}),
-            Em.Object.create({isMaster: true, isSlave: false, componentName: 'A'}),
-            Em.Object.create({isMaster: true, isSlave: false, componentName: 'C'}),
-            Em.Object.create({isMaster: false, isSlave: false, componentName: 'D'})
+            Em.Object.create({componentName: 'C', displayName: 'C'}),
+            Em.Object.create({componentName: 'A', displayName: 'A'}),
+            Em.Object.create({componentName: 'B', displayName: 'B'}),
+            Em.Object.create({componentName: 'D', displayName: 'D'})
           ])
         }),
-        m: 'List of masters, slaves and clients',
-        e: ['A', 'C', 'B']
-      },
-      {
-        content: Em.Object.create({
-          hostComponents: Em.A([
-            Em.Object.create({isMaster: false, isSlave: true, componentName: 'B'}),
-            Em.Object.create({isMaster: true, isSlave: false, componentName: 'A'}),
-            Em.Object.create({isMaster: true, isSlave: false, componentName: 'C'}),
-            Em.Object.create({isMaster: true, isSlave: false, componentName: 'D'})
-          ])
-        }),
-        m: 'List of masters and slaves',
-        e: ['A', 'C', 'D', 'B']
-      },
-      {
-        content: Em.Object.create({
-          hostComponents: Em.A([
-            Em.Object.create({isMaster: true, isSlave: false, componentName: 'B'}),
-            Em.Object.create({isMaster: true, isSlave: false, componentName: 'A'}),
-            Em.Object.create({isMaster: true, isSlave: false, componentName: 'C'}),
-            Em.Object.create({isMaster: true, isSlave: false, componentName: 'D'})
-          ])
-        }),
-        m: 'List of masters',
-        e: ['B', 'A', 'C', 'D']
-      },
-      {
-        content: Em.Object.create({
-          hostComponents: Em.A([
-            Em.Object.create({isMaster: false, isSlave: true, componentName: 'B'}),
-            Em.Object.create({isMaster: false, isSlave: true, componentName: 'A'}),
-            Em.Object.create({isMaster: false, isSlave: true, componentName: 'C'}),
-            Em.Object.create({isMaster: false, isSlave: true, componentName: 'D'})
-          ])
-        }),
-        m: 'List of slaves',
-        e: ['B', 'A', 'C', 'D']
-      },
-      {
-        content: Em.Object.create({
-          hostComponents: Em.A([])
-        }),
-        m: 'Empty list',
-        e: []
-      },
-      {
-        content: Em.Object.create({
-          hostComponents: Em.A([
-            Em.Object.create({isClient: true, componentName: 'B'}),
-            Em.Object.create({isMaster: true, componentName: 'A'}),
-            Em.Object.create({isSlave: true, componentName: 'C'}),
-            Em.Object.create({isClient: true, componentName: 'D'})
-          ])
-        }),
-        m: 'List of clients',
-        e: ['A', 'C', 'B', 'D']
+        m: 'List of components',
+        e: ['A', 'B', 'C', 'D']
       }
     ]);