Ver Fonte

AMBARI-17264. Ranger Tagsync shows under Summary Tab after upgrade from 2.4 to 2.5
(akovalenko)

Aleksandr Kovalenko há 9 anos atrás
pai
commit
0942cc0bbf

+ 3 - 3
ambari-web/app/models/service/ranger.js

@@ -18,9 +18,9 @@
 var App = require('app');
 
 App.RangerService = App.Service.extend({
-  rangerTagsyncsStarted: DS.attr('number'),
-  rangerTagsyncsInstalled: DS.attr('number'),
-  rangerTagsyncsTotal: DS.attr('number')
+  rangerTagsyncsStarted: DS.attr('number', {defaultValue: 0}),
+  rangerTagsyncsInstalled: DS.attr('number', {defaultValue: 0}),
+  rangerTagsyncsTotal: DS.attr('number', {defaultValue: 0})
 });
 
 App.RangerService.FIXTURES = [];

+ 20 - 18
ambari-web/app/templates/main/service/services/hbase.hbs

@@ -19,25 +19,27 @@
 <!-- HBase Master Server -->
 {{view view.dashboardMasterComponentView}}
 <!-- RegionServers -->
-<tr {{bindAttr class=":component view.regionServerComponent.componentName"}}>
-  <td class="summary-label"><a
-          href="#" {{action filterHosts view.regionServerComponent}}>{{t dashboard.services.hbase.regionServers}}</a>
-  </td>
-  <td class="summary-value">
-    {{#if App.router.clusterController.isServiceContentFullyLoaded}}
-      <span>
-        {{#view App.ComponentLiveTextView liveComponentsBinding="view.service.regionServersStarted" totalComponentsBinding="view.service.regionServersTotal"}}
-          {{view.liveComponents}}/{{view.totalComponents}}
-        {{/view}}
-      </span>
-      {{t services.service.summary.RegionServersLIVE}}
-    {{else}}
-      {{t common.loading.eclipses}}
-    {{/if}}
-  </td>
-</tr>
+{{#if view.isRegionServerCreated}}
+  <tr {{bindAttr class=":component view.regionServerComponent.componentName"}}>
+    <td class="summary-label"><a
+            href="#" {{action filterHosts view.regionServerComponent}}>{{t dashboard.services.hbase.regionServers}}</a>
+    </td>
+    <td class="summary-value">
+      {{#if App.router.clusterController.isServiceContentFullyLoaded}}
+        <span>
+          {{#view App.ComponentLiveTextView liveComponentsBinding="view.service.regionServersStarted" totalComponentsBinding="view.service.regionServersTotal"}}
+            {{view.liveComponents}}/{{view.totalComponents}}
+          {{/view}}
+        </span>
+        {{t services.service.summary.RegionServersLIVE}}
+      {{else}}
+        {{t common.loading.eclipses}}
+      {{/if}}
+    </td>
+  </tr>
+{{/if}}
 <!-- PhoenixServers -->
-{{#if view.showPhoenixInfo}}
+{{#if view.isPhoenixQueryServerCreated}}
   <tr {{bindAttr class=":component view.phoenixServerComponent.componentName"}}>
     <td class="summary-label"><a
             href="#" {{action filterHosts view.phoenixServerComponent}}>{{t dashboard.services.hbase.phoenixServers}}</a>

+ 20 - 18
ambari-web/app/templates/main/service/services/hdfs.hbs

@@ -18,23 +18,25 @@
 
 {{view view.dashboardMasterComponentView}}
 <!-- Data Nodes -->
-<tr {{bindAttr class=":component view.dataNodeComponent.componentName"}}>
-  <td class="summary-label"><a
-          href="#" {{action filterHosts view.dataNodeComponent}}>{{t dashboard.services.hdfs.datanodes}}</a>
-  </td>
-  <td class="summary-value">
-    {{#if App.router.clusterController.isServiceContentFullyLoaded}}
-      <span>
-        {{#view App.ComponentLiveTextView liveComponentsBinding="view.service.dataNodesStarted" totalComponentsBinding="view.service.dataNodesTotal"}}
-          {{view.liveComponents}}/{{view.totalComponents}}
-        {{/view}}
-      </span>
-      {{t common.started}}
-    {{else}}
-      {{t common.loading.eclipses}}
-    {{/if}}
-  </td>
-</tr>
+{{#if view.isDataNodeCreated}}
+  <tr {{bindAttr class=":component view.dataNodeComponent.componentName"}}>
+    <td class="summary-label"><a
+            href="#" {{action filterHosts view.dataNodeComponent}}>{{t dashboard.services.hdfs.datanodes}}</a>
+    </td>
+    <td class="summary-value">
+      {{#if App.router.clusterController.isServiceContentFullyLoaded}}
+        <span>
+          {{#view App.ComponentLiveTextView liveComponentsBinding="view.service.dataNodesStarted" totalComponentsBinding="view.service.dataNodesTotal"}}
+            {{view.liveComponents}}/{{view.totalComponents}}
+          {{/view}}
+        </span>
+        {{t common.started}}
+      {{else}}
+        {{t common.loading.eclipses}}
+      {{/if}}
+    </td>
+  </tr>
+{{/if}}
 <!-- Data Node Counts -->
 <tr class="datanode-count">
   <td class="summary-label">{{t dashboard.services.hdfs.datanodecounts}}</td>
@@ -52,7 +54,7 @@
   {{/if}}
 </tr>
 <!-- JournalNodes -->
-{{#if view.showJournalNodes}}
+{{#if view.isJournalNodeCreated}}
   <tr {{bindAttr class=":component view.journalNodeComponent.componentName"}}>
     <td class="summary-label">
       <a href="#" {{action filterHosts view.journalNodeComponent}}>{{t dashboard.services.hdfs.journalnodes}}</a>

+ 1 - 1
ambari-web/app/templates/main/service/services/ranger.hbs

@@ -19,7 +19,7 @@
 {{view view.dashboardMasterComponentView}}
 
 <!-- Ranger Tagsyncs -->
-{{#if view.isRangerTagsyncInStack}}
+{{#if view.isRangerTagsyncCreated}}
   <tr {{bindAttr class=":component view.rangerTagsyncComponent.componentName"}}>
     <td class="summary-label">
       <a href="#" {{action filterHosts view.rangerTagsyncComponent}}>{{t dashboard.services.ranger.rangerTagsyncs}}</a>

+ 20 - 19
ambari-web/app/templates/main/service/services/storm.hbs

@@ -17,25 +17,26 @@
 }}
 
 {{view App.SummaryMasterComponentsView mastersCompBinding="view.parentView.mastersObj"}}
-<tr class="component SUPERVISOR">
-  <td class="summary-label">
-    <a href="#" {{action filterHosts view.filterComponent}}>
-      {{t dashboard.services.storm.supervisors}}
-    </a>
-  </td>
-  <td class="summary-value">
-    {{#if App.router.clusterController.isServiceContentFullyLoaded}}
-      <span>
-        {{#view App.ComponentLiveTextView liveComponentsBinding="view.superVisorsLive" totalComponentsBinding="view.superVisorsTotal"}}
-          {{view.liveComponents}}/{{view.totalComponents}}
-        {{/view}}
-      </span> {{t services.service.summary.SupervisorsLIVE}}
-    {{else}}
-      {{t common.loading.eclipses}}
-    {{/if}}
-  </td>
-</tr>
-
+{{#if view.isSupervisorCreated}}
+  <tr class="component SUPERVISOR">
+    <td class="summary-label">
+      <a href="#" {{action filterHosts view.filterComponent}}>
+        {{t dashboard.services.storm.supervisors}}
+      </a>
+    </td>
+    <td class="summary-value">
+      {{#if App.router.clusterController.isServiceContentFullyLoaded}}
+        <span>
+          {{#view App.ComponentLiveTextView liveComponentsBinding="view.superVisorsLive" totalComponentsBinding="view.superVisorsTotal"}}
+            {{view.liveComponents}}/{{view.totalComponents}}
+          {{/view}}
+        </span> {{t services.service.summary.SupervisorsLIVE}}
+      {{else}}
+        {{t common.loading.eclipses}}
+      {{/if}}
+    </td>
+  </tr>
+{{/if}}
 <!-- Divider-- make the remaining summary info on 2nd table-->
 </tbody>
 </table>

+ 18 - 16
ambari-web/app/templates/main/service/services/yarn.hbs

@@ -18,22 +18,24 @@
 {{view view.dashboardMasterComponentView}}
 
 <!-- NodeManagers -->
-<tr {{bindAttr class=":component view.nodeManagerComponent.componentName"}}>
-  <td class="summary-label">
-    <a href="#" {{action filterHosts view.nodeManagerComponent}}>{{t dashboard.services.yarn.nodeManagers}}</a>
-  </td>
-  <td class="summary-value">
-    {{#if App.router.clusterController.isServiceContentFullyLoaded}}
-      <span>
-        {{#view App.ComponentLiveTextView liveComponentsBinding="view.service.nodeManagersStarted" totalComponentsBinding="view.service.nodeManagersTotal"}}
-          {{view.liveComponents}}/{{view.totalComponents}}
-        {{/view}}
-      </span>{{t common.started}}
-    {{else}}
-      {{t common.loading.eclipses}}
-    {{/if}}
-  </td>
-</tr>
+{{#if view.isNodeManagerCreated}}
+  <tr {{bindAttr class=":component view.nodeManagerComponent.componentName"}}>
+    <td class="summary-label">
+      <a href="#" {{action filterHosts view.nodeManagerComponent}}>{{t dashboard.services.yarn.nodeManagers}}</a>
+    </td>
+    <td class="summary-value">
+      {{#if App.router.clusterController.isServiceContentFullyLoaded}}
+        <span>
+          {{#view App.ComponentLiveTextView liveComponentsBinding="view.service.nodeManagersStarted" totalComponentsBinding="view.service.nodeManagersTotal"}}
+            {{view.liveComponents}}/{{view.totalComponents}}
+          {{/view}}
+        </span>{{t common.started}}
+      {{else}}
+        {{t common.loading.eclipses}}
+      {{/if}}
+    </td>
+  </tr>
+{{/if}}
 <!-- NodeManagers status -->
 <tr class="nodemanager-status">
   <td class="summary-label">{{t dashboard.services.yarn.nodeManagers.status}}</td>

+ 13 - 1
ambari-web/app/views/main/service/service.js

@@ -167,7 +167,19 @@ App.MainDashboardServiceView = Em.View.extend(App.MainDashboardServiceViewWrappe
       title: this.t(template).format(len),
       component: clients.objectAt(0)
     };
-  }.property('service')
+  }.property('service'),
+
+  /**
+   * Check if service component is created
+   * @param componentName
+   * @returns {Boolean}
+   */
+  isServiceComponentCreated: function (componentName) {
+    return App.MasterComponent.find().mapProperty('componentName').concat(
+        App.ClientComponent.find().mapProperty('componentName'),
+        App.SlaveComponent.find().mapProperty('componentName')
+    ).contains(componentName);
+  }
 
 });
 

+ 9 - 3
ambari-web/app/views/main/service/services/hbase.js

@@ -50,8 +50,6 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
 
   phoenixServersText: Em.computed.countBasedMessage('service.phoenixServersTotal', '', Em.I18n.t('services.service.summary.viewHost'), Em.I18n.t('services.service.summary.viewHosts')),
 
-  showPhoenixInfo: Em.computed.bool('service.phoenixServersTotal'),
-
   /**
    * One(!) active master component
    */
@@ -93,5 +91,13 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
 
   phoenixServerComponent: Em.Object.create({
     componentName: 'PHOENIX_QUERY_SERVER'
-  })
+  }),
+
+  isRegionServerCreated: function () {
+    return this.isServiceComponentCreated('HBASE_REGIONSERVER');
+  }.property('App.router.clusterController.isComponentsStateLoaded'),
+
+  isPhoenixQueryServerCreated: function () {
+    return this.isServiceComponentCreated('PHOENIX_QUERY_SERVER');
+  }.property('App.router.clusterController.isComponentsStateLoaded')
 });

+ 9 - 4
ambari-web/app/views/main/service/services/hdfs.js

@@ -85,8 +85,6 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
 
   dataNodesDead: Em.computed.alias('service.dataNodesInstalled'),
 
-  showJournalNodes: Em.computed.gt('service.journalNodes.length', 0),
-
   journalNodesLive: function () {
     return this.get('service.journalNodes').filterProperty("workStatus", "STARTED").get("length");
   }.property("service.journalNodes.@each.workStatus"),
@@ -152,7 +150,7 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
   isNfsInStack: function () {
     return App.StackServiceComponent.find().someProperty('componentName', 'NFS_GATEWAY');
   }.property(),
-  
+
   journalNodeComponent: Em.computed.alias('service.journalNodes.firstObject'),
 
   /**
@@ -190,6 +188,13 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
    */
   isUpgradeStatusWarning: function () {
     return this.get('service.upgradeStatus') == 'false' && this.get('service.healthStatus') == 'green';
-  }.property('service.upgradeStatus', 'service.healthStatus')
+  }.property('service.upgradeStatus', 'service.healthStatus'),
+
+  isDataNodeCreated: function () {
+    return this.isServiceComponentCreated('DATANODE');
+  }.property('App.router.clusterController.isComponentsStateLoaded'),
 
+  isJournalNodeCreated: function () {
+    return this.isServiceComponentCreated('JOURNALNODE');
+  }.property('App.router.clusterController.isComponentsStateLoaded')
 });

+ 3 - 7
ambari-web/app/views/main/service/services/ranger.js

@@ -27,13 +27,9 @@ App.MainDashboardServiceRangerView = App.MainDashboardServiceView.extend({
     componentName: 'RANGER_TAGSYNC'
   }),
 
-  /**
-   * Define if RANGER_TAGSYNC is present in the installed stack
-   * @type {Boolean}
-   */
-  isRangerTagsyncInStack: function () {
-    return App.StackServiceComponent.find().someProperty('componentName', 'RANGER_TAGSYNC');
-  }.property(),
+  isRangerTagsyncCreated: function () {
+    return this.isServiceComponentCreated('RANGER_TAGSYNC');
+  }.property('App.router.clusterController.isComponentsStateLoaded'),
 
   didInsertElement: function () {
     this.set('controller.isRangerUpdateWorking', true);

+ 5 - 1
ambari-web/app/views/main/service/services/storm.js

@@ -36,5 +36,9 @@ App.MainDashboardServiceStormView = App.MainDashboardServiceView.extend({
 
   nimbusUptimeFormatted: function() {
     return this.get('service.nimbusUptime') || Em.I18n.t('services.service.summary.notRunning');
-  }.property('service.nimbusUptime')
+  }.property('service.nimbusUptime'),
+
+  isSupervisorCreated: function () {
+    return this.isServiceComponentCreated('SUPERVISOR');
+  }.property('App.router.clusterController.isComponentsStateLoaded')
 });

+ 5 - 1
ambari-web/app/views/main/service/services/yarn.js

@@ -86,5 +86,9 @@ App.MainDashboardServiceYARNView = App.MainDashboardServiceView.extend({
 
   willDestroyElement: function(){
     $("[rel='queue-tooltip']").tooltip('destroy');
-  }
+  },
+
+  isNodeManagerCreated: function () {
+    return this.isServiceComponentCreated('NODEMANAGER');
+  }.property('App.router.clusterController.isComponentsStateLoaded')
 });

+ 1 - 3
ambari-web/test/views/main/service/services/hdfs_test.js

@@ -35,8 +35,6 @@ describe('App.MainDashboardServiceHdfsView', function () {
 
   App.TestAliases.testAsComputedAlias(getView(), 'journalNodesTotal', 'service.journalNodes.length', 'number');
 
-  App.TestAliases.testAsComputedGt(getView(), 'showJournalNodes', 'service.journalNodes.length', 0);
-
   describe("#Chart", function() {
     var chartView;
 
@@ -368,4 +366,4 @@ describe('App.MainDashboardServiceHdfsView', function () {
   });
 
 
-});
+});

+ 0 - 23
ambari-web/test/views/main/service/services/ranger_test.js

@@ -44,27 +44,4 @@ describe('App.MainDashboardServiceRangerView', function () {
       expect(view.get('controller.isRangerUpdateWorking')).to.be.false;
     });
   });
-
-  describe("#isRangerTagsyncInStack", function() {
-
-    beforeEach(function() {
-      this.mock = sinon.stub(App.StackServiceComponent, 'find');
-    });
-    afterEach(function() {
-      this.mock.restore();
-    });
-
-    it("no RANGER_TAGSYNC component", function() {
-      this.mock.returns([]);
-      view.propertyDidChange('isRangerTagsyncInStack');
-      expect(view.get('isRangerTagsyncInStack')).to.be.false;
-    });
-
-    it("NFS_GATEWAY component present", function() {
-      this.mock.returns([{componentName: 'RANGER_TAGSYNC'}]);
-      view.propertyDidChange('isRangerTagsyncInStack');
-      expect(view.get('isRangerTagsyncInStack')).to.be.true;
-    });
-  });
-
 });