Explorar o código

AMBARI-16160. Ranger Tagsync status is not shown under Summary Tab when installed (akovalenko)

Aleksandr Kovalenko %!s(int64=9) %!d(string=hai) anos
pai
achega
c91f07ea85

+ 5 - 0
ambari-web/app/mappers/components_state_mapper.js

@@ -90,6 +90,11 @@ App.componentsStateMapper = App.QuickDataMapper.create({
       super_visors_installed: 'INSTALLED_PATH',
       super_visors_total: 'TOTAL_PATH'
     },
+    'RANGER_TAGSYNC': {
+      ranger_tagsyncs_started: 'STARTED_PATH',
+      ranger_tagsyncs_installed: 'INSTALLED_PATH',
+      ranger_tagsyncs_total: 'TOTAL_PATH'
+    },
     'MAPREDUCE2_CLIENT': {
       map_reduce2_clients: 'INSTALLED_PATH'
     },

+ 21 - 4
ambari-web/app/mappers/service_metrics_mapper.js

@@ -133,6 +133,11 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
     super_visors_installed: 'super_visors_installed',
     super_visors_total: 'super_visors_total'
   },
+  rangerConfig: {
+    ranger_tagsyncs_started: 'ranger_tagsyncs_started',
+    ranger_tagsyncs_installed: 'ranger_tagsyncs_installed',
+    ranger_tagsyncs_total: 'ranger_tagsyncs_total'
+  },
   flumeConfig: {
     flume_handlers_total: 'flume_handlers_total'
   },
@@ -299,6 +304,10 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
       finalJson.rand = Math.random();
       this.mapQuickLinks(finalJson, item);
       App.store.load(App.StormService, finalJson);
+    } else if (item && item.ServiceInfo && item.ServiceInfo.service_name == "RANGER") {
+      finalJson = this.rangerMapper(item);
+      finalJson.rand = Math.random();
+      App.store.load(App.RangerService, finalJson);
     } else {
       finalJson = this.parseIt(item, this.config);
       finalJson.rand = Math.random();
@@ -610,8 +619,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
       component.host_components[activeHostComponentIndex] = component.host_components[0];
       component.host_components[0] = tmp;
     }
-  }
-  ,
+  },
 
   /**
    * Flume is different from other services, in that the important
@@ -639,8 +647,7 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
       });
     });
     return finalJson;
-  }
-  ,
+  },
 
   /**
    * Storm mapper
@@ -674,5 +681,15 @@ App.serviceMetricsMapper = App.QuickDataMapper.create({
     });
     item.restApiComponent = restApiMetrics;
     return this.parseIt(item, finalConfig);
+  },
+
+  /**
+   * Ranger mapper
+   */
+  rangerMapper: function (item) {
+    var finalConfig = jQuery.extend({}, this.config);
+    var rangerConfig = this.rangerConfig;
+        finalConfig = jQuery.extend({}, finalConfig, rangerConfig);
+    return this.parseIt(item, finalConfig);
   }
 });

+ 2 - 0
ambari-web/app/messages.js

@@ -2725,6 +2725,8 @@ Em.I18n.translations = {
   'dashboard.services.hbase.masterStarted':'Master Started',
   'dashboard.services.hbase.masterActivated':'Master Activated',
 
+  'dashboard.services.ranger.rangerTagsyncs':'Ranger Tagsyncs',
+
   'dashboard.services.components.started':'started',
   'dashboard.services.components.stopped':'stopped',
   'dashboard.services.components.total':'in total',

+ 1 - 0
ambari-web/app/models.js

@@ -44,6 +44,7 @@ require('models/service/mapreduce2');
 require('models/service/hbase');
 require('models/service/flume');
 require('models/service/storm');
+require('models/service/ranger');
 require('models/alerts/alert_definition');
 require('models/alerts/alert_instance');
 require('models/alerts/alert_instance_local');

+ 1 - 0
ambari-web/app/models/service.js

@@ -246,6 +246,7 @@ App.Service.extendedModel = {
   'YARN': 'YARNService',
   'MAPREDUCE2': 'MapReduce2Service',
   'STORM': 'StormService',
+  'RANGER': 'RangerService',
   'FLUME': 'FlumeService'
 };
 

+ 26 - 0
ambari-web/app/models/service/ranger.js

@@ -0,0 +1,26 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+var App = require('app');
+
+App.RangerService = App.Service.extend({
+  rangerTagsyncsStarted: DS.attr('number'),
+  rangerTagsyncsInstalled: DS.attr('number'),
+  rangerTagsyncsTotal: DS.attr('number')
+});
+
+App.RangerService.FIXTURES = [];

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

@@ -18,6 +18,24 @@
 
 {{view view.dashboardMasterComponentView}}
 
+<!-- Ranger Tagsyncs -->
+<tr {{bindAttr class=":component view.rangerTagsyncComponent.componentName"}}>
+  <td class="summary-label">
+    <a href="#" {{action filterHosts view.rangerTagsyncComponent}}>{{t dashboard.services.ranger.rangerTagsyncs}}</a>
+  </td>
+  <td class="summary-value">
+    {{#if App.router.clusterController.isServiceContentFullyLoaded}}
+      <span>
+        {{#view App.ComponentLiveTextView liveComponentsBinding="view.service.rangerTagsyncsStarted" totalComponentsBinding="view.service.rangerTagsyncsTotal"}}
+          {{view.liveComponents}}/{{view.totalComponents}}
+        {{/view}}
+      </span>{{t common.started}}
+    {{else}}
+      {{t common.loading.eclipses}}
+    {{/if}}
+  </td>
+</tr>
+
 {{#each item in controller.rangerPlugins}}
   {{#if item.isDisplayed}}
     <tr class="ranger-plugin">

+ 4 - 0
ambari-web/app/views/main/service/services/ranger.js

@@ -23,6 +23,10 @@ App.MainDashboardServiceRangerView = App.MainDashboardServiceView.extend({
 
   serviceName: 'RANGER',
 
+  rangerTagsyncComponent: Em.Object.create({
+    componentName: 'RANGER_TAGSYNC'
+  }),
+
   didInsertElement: function () {
     this.set('controller.isRangerUpdateWorking', true);
     App.updater.run(this.get('controller'), 'updateRangerPluginsStatus', 'isRangerUpdateWorking', App.bgOperationsUpdateInterval);