ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-11973. Missing enable HIVE plugin info in Ranger Summary page (onechiporenko)
Date Wed, 17 Jun 2015 12:53:47 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 1d40e6394 -> 80735acf8


AMBARI-11973. Missing enable HIVE plugin info in Ranger Summary page (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/80735acf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/80735acf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/80735acf

Branch: refs/heads/branch-2.1
Commit: 80735acf833c4dea69c6635e0ea5b5fd39072d80
Parents: 1d40e63
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Wed Jun 17 15:48:58 2015 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Wed Jun 17 15:53:00 2015 +0300

----------------------------------------------------------------------
 .../controllers/main/service/info/summary.js    | 35 ++++++++++++++------
 .../main/service/info/summary_test.js           | 16 +++++++--
 2 files changed, 38 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/80735acf/ambari-web/app/controllers/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/summary.js b/ambari-web/app/controllers/main/service/info/summary.js
index b26183c..cb5fe4c 100644
--- a/ambari-web/app/controllers/main/service/info/summary.js
+++ b/ambari-web/app/controllers/main/service/info/summary.js
@@ -52,27 +52,38 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
     {
       serviceName: 'HDFS',
       type: 'ranger-hdfs-plugin-properties',
-      propertyName: 'ranger-hdfs-plugin-enabled'
+      propertyName: 'ranger-hdfs-plugin-enabled',
+      valueForEnable: 'Yes'
     },
     {
       serviceName: 'HBASE',
       type: 'ranger-hbase-plugin-properties',
-      propertyName: 'ranger-hbase-plugin-enabled'
+      propertyName: 'ranger-hbase-plugin-enabled',
+      valueForEnable: 'Yes'
+    },
+    {
+      serviceName: 'HIVE',
+      type: 'hive-env',
+      propertyName: 'hive_security_authorization',
+      valueForEnable: 'Ranger'
     },
     {
       serviceName: 'KNOX',
       type: 'ranger-knox-plugin-properties',
-      propertyName: 'ranger-knox-plugin-enabled'
+      propertyName: 'ranger-knox-plugin-enabled',
+      valueForEnable: 'Yes'
     },
     {
       serviceName: 'STORM',
       type: 'ranger-storm-plugin-properties',
-      propertyName: 'ranger-storm-plugin-enabled'
+      propertyName: 'ranger-storm-plugin-enabled',
+      valueForEnable: 'Yes'
     },
     {
       serviceName: 'YARN',
       type: 'ranger-yarn-plugin-properties',
-      propertyName: 'ranger-yarn-plugin-enabled'
+      propertyName: 'ranger-yarn-plugin-enabled',
+      valueForEnable: 'Yes'
     }
   ],
 
@@ -163,11 +174,15 @@ App.MainServiceInfoSummaryController = Em.Controller.extend(App.WidgetSectionMix
     data.items.forEach(function (item) {
       var serviceName = this.get('rangerPlugins').findProperty('type', item.type).serviceName;
       var propertyName = this.get('rangerPlugins').findProperty('type', item.type).propertyName;
-      var statusMap = {
-        Yes: 'alerts.table.state.enabled',
-        No: 'alerts.table.state.disabled'
-      };
-      var statusString = statusMap[item.properties[propertyName]] || 'common.unknown';
+      var propertyValue = this.get('rangerPlugins').findProperty('type', item.type).valueForEnable;
+      var statusString;
+
+      if (item.properties[propertyName]) {
+        statusString = item.properties[propertyName] == propertyValue ? 'alerts.table.state.enabled'
: 'alerts.table.state.disabled';
+      }
+      else {
+        statusString = 'common.unknown';
+      }
       Em.set(this.get('rangerPlugins').findProperty('serviceName', serviceName), 'status',
Em.I18n.t(statusString));
     }, this);
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/80735acf/ambari-web/test/controllers/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/summary_test.js b/ambari-web/test/controllers/main/service/info/summary_test.js
index a250d33..b42175b 100644
--- a/ambari-web/test/controllers/main/service/info/summary_test.js
+++ b/ambari-web/test/controllers/main/service/info/summary_test.js
@@ -63,6 +63,9 @@ describe('App.MainServiceInfoSummaryController', function () {
         }),
         Em.Object.create({
           serviceName: 'YARN'
+        }),
+        Em.Object.create({
+          serviceName: 'HIVE'
         })
       ]);
       sinon.stub(App.StackService, 'find').returns([
@@ -77,7 +80,7 @@ describe('App.MainServiceInfoSummaryController', function () {
           serviceName: 'HIVE',
           displayName: 'Hive',
           configTypes: {
-            'ranger-hive-plugin-properties': {}
+            'hive-env': {}
           }
         }),
         Em.Object.create({
@@ -119,7 +122,7 @@ describe('App.MainServiceInfoSummaryController', function () {
         controller.set('isRangerPluginsArraySet', item.isRangerPluginsArraySet);
         App.set('router.clusterController.isLoaded', item.isLoaded);
         expect(controller.get('isRangerPluginsArraySet')).to.equal(item.expectedIsRangerPluginsArraySet);
-        expect(controller.get('rangerPlugins').filterProperty('isDisplayed').mapProperty('serviceName').sort()).to.eql(['HDFS']);
+        expect(controller.get('rangerPlugins').filterProperty('isDisplayed').mapProperty('serviceName').sort()).to.eql(['HDFS',
'HIVE']);
       });
     });
 
@@ -133,7 +136,7 @@ describe('App.MainServiceInfoSummaryController', function () {
             'ranger-hdfs-plugin-properties': {
               'tag': 'version1'
             },
-            'ranger-hive-plugin-properties': {
+            'hive-env': {
               'tag': 'version2'
             },
             'ranger-hbase-plugin-properties': {
@@ -223,6 +226,12 @@ describe('App.MainServiceInfoSummaryController', function () {
             }
           },
           {
+            'type': 'hive-env',
+            'properties': {
+              'hive_security_authorization': 'Ranger'
+            }
+          },
+          {
             'type': 'ranger-hbase-plugin-properties',
             'properties': {
               'ranger-hbase-plugin-enabled': ''
@@ -232,6 +241,7 @@ describe('App.MainServiceInfoSummaryController', function () {
       });
       expect(controller.get('isPreviousRangerConfigsCallFailed')).to.be.false;
       expect(controller.get('rangerPlugins').findProperty('serviceName', 'HDFS').status).to.equal(Em.I18n.t('alerts.table.state.enabled'));
+      expect(controller.get('rangerPlugins').findProperty('serviceName', 'HIVE').status).to.equal(Em.I18n.t('alerts.table.state.enabled'));
       expect(controller.get('rangerPlugins').findProperty('serviceName', 'HBASE').status).to.equal(Em.I18n.t('common.unknown'));
     });
   });


Mime
View raw message