Browse Source

AMBARI-2017. Admin Misc page tweaks. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1471782 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 năm trước cách đây
mục cha
commit
7adcd39a81

+ 2 - 0
CHANGES.txt

@@ -269,6 +269,8 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-2017. Admin Misc page tweaks. (yusaku)
+
  AMBARI-2022. Service Component metric collection API takes over a minute
  on large cluster. (tbeerbower)
 

+ 16 - 5
ambari-web/app/controllers/main/admin/misc_controller.js

@@ -27,7 +27,7 @@ App.MainAdminMiscController = App.MainServiceInfoConfigsController.extend({
     serviceName: 'MISC'
   },
   loadUsers: function() {
-    this.set('selectedService', 'MISC');
+    this.set('selectedService', this.get('content.serviceName'));
     this.loadServiceConfig();
   },
   loadServiceConfig: function() {
@@ -55,10 +55,21 @@ App.MainAdminMiscController = App.MainServiceInfoConfigsController.extend({
     var configGroups = App.config.loadConfigsByTags(this.get('serviceConfigTags'));
     var configSet = App.config.mergePreDefinedWithLoaded(configGroups, [], this.get('serviceConfigTags'), serviceName);
 
-    var misc_configs = configSet.globalConfigs.filterProperty('serviceName', 'MISC').filterProperty('category', 'Users and Groups').filterProperty('isVisible', true);
-    this.set('users', misc_configs);
-    this.set('dataIsLoaded', true);
+    var misc_configs = configSet.globalConfigs.filterProperty('serviceName', this.get('selectedService')).filterProperty('category', 'Users and Groups').filterProperty('isVisible', true);
 
-  }
+    var sortOrder = this.get('configs').filterProperty('serviceName', this.get('selectedService')).filterProperty('category', 'Users and Groups').filterProperty('isVisible', true).mapProperty('name');
 
+    var sorted = [];
+
+    if(sortOrder) {
+      sortOrder.forEach(function(name) {
+        sorted.push(misc_configs.findProperty('name', name));
+      });
+      this.set('users', sorted);
+    }
+    else {
+      this.set('users', misc_configs);
+    }
+    this.set('dataIsLoaded', true);
+  }
 });

+ 1 - 1
ambari-web/app/messages.js

@@ -596,7 +596,7 @@ Em.I18n.translations = {
   'admin.cluster.upgradeAvailable':'Upgrade available',
   'admin.cluster.upgradeUnavailable':'Upgrade unavailable',
 
-  'admin.misc.header': 'Service user accounts',
+  'admin.misc.header': 'Service Users and Groups',
   'admin.misc.nothingToShow': 'No user accounts to display',
 
   'services.service.start':'Start',

+ 1 - 1
ambari-web/app/templates/common/configs/service_config.hbs

@@ -50,7 +50,7 @@
   {{#each category in selectedService.configCategories}}
     {{#if category.isCustomView}}
       {{#if App.supports.capacitySchedulerUi}}
-      {{view category.customView categoryBinding="category" serviceBinding="selectedService" canEditBinding="view.canEdit" serviceConfigsBinding="selectedService.configs"}}
+        {{view category.customView categoryBinding="category" serviceBinding="selectedService" canEditBinding="view.canEdit" serviceConfigsBinding="selectedService.configs"}}
       {{/if}}
     {{else}}
     {{#view App.ServiceConfigsByCategoryView categoryBinding="category" canEditBinding="view.canEdit" serviceBinding="selectedService" serviceConfigsBinding="selectedService.configs"}}

+ 17 - 18
ambari-web/app/views/common/configs/services_config.js

@@ -67,7 +67,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
    * This method provides all the properties which apply
    * to this category, irrespective of visibility. This
    * is helpful in Oozie/Hive database configuration, where
-   * MySQL etc. database options dont show up, because
+   * MySQL etc. database options don't show up, because
    * they were not visible initially.
    */
   categoryConfigsAll: function () {
@@ -91,7 +91,7 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
   /**
    * Filtered <code>categoryConfigs</code> array. Used to show filtered result
    */
-  filteredCategoryConfigs: function(){
+  filteredCategoryConfigs: function() {
     var filter = this.get('parentView.filter').toLowerCase();
     var isOnlyModified = this.get('parentView.columns').length && this.get('parentView.columns')[1].get('selected');
     var isOnlyOverridden = this.get('parentView.columns').length && this.get('parentView.columns')[0].get('selected');
@@ -128,20 +128,22 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
       }, this);
       return sortedArray;
 
-    }else if(filteredResult.someProperty('displayName', 'Hive Database')) {
-      var displayNameArray = ['Hive Database', 'Database Type', 'Database Name', 'Database Username', 'Database Password', 'Database Host', 'Hive Metastore host'];
-      var sortedArray = [];
-      displayNameArray.forEach(function(item){
-        var obj = filteredResult.findProperty('displayName', item);
-        if(obj) {
-          sortedArray.push(obj);
-        }
-      }, this);
-      return sortedArray;
     }
-
-    else{
-      return filteredResult;
+    else {
+      if(filteredResult.someProperty('displayName', 'Hive Database')) {
+        var displayNameArray = ['Hive Database', 'Database Type', 'Database Name', 'Database Username', 'Database Password', 'Database Host', 'Hive Metastore host'];
+        var sortedArray = [];
+        displayNameArray.forEach(function(item){
+          var obj = filteredResult.findProperty('displayName', item);
+          if(obj) {
+            sortedArray.push(obj);
+          }
+        }, this);
+        return sortedArray;
+      }
+      else {
+        return filteredResult;
+      }
     }
 
   }.property('categoryConfigs','parentView.filter', 'parentView.columns.@each.selected'),
@@ -173,9 +175,6 @@ App.ServiceConfigsByCategoryView = Ember.View.extend({
   changeFlag: Ember.Object.create({
     val: 1
   }),
-  invokeMe: function () {
-    alert("parent");
-  },
   isOneOfAdvancedSections: function () {
     var category = this.get('category');
     return category.indexOf("Advanced") != -1;