Browse Source

AMBARI-7102. Slider View: Drop yarn-site and global config sections from Configs tab of app. (akovalenko)

Aleksandr Kovalenko 10 years ago
parent
commit
a41ef2a1c0

File diff suppressed because it is too large
+ 187 - 36
contrib/views/slider/src/main/resources/ui/app/assets/data/apps/apps.json


+ 19 - 32
contrib/views/slider/src/main/resources/ui/app/models/slider_app.js

@@ -99,38 +99,25 @@ App.SliderApp = DS.Model.extend({
 
   jmx: DS.attr('object'),
 
-  /**
-   * Global configs
-   * @type {{key: string, value: *}[]}
-   */
-  globals: function() {
-    var c = this.get('configs.global');
-    return this.mapObject(c);
-  }.property('configs.@each'),
-
-  /**
-   * HBase-Site configs
-   * @type {{key: string, value: *}[]}
-   */
-  hbaseSite: function() {
-    var c = this.get('configs.hbase-site');
-    return this.mapObject(c);
-  }.property('configs.@each'),
-
-  /**
-   * Configs which are not in global or hbase-site
-   * @type {{key: string, value: *}[]}
-   */
-  otherConfigs: function() {
-    var c = this.get('configs'),
-      ret = [],
-      self = this;
-    if (Ember.typeOf(c) !== 'object') return [];
-    Ember.keys(c).forEach(function(key) {
-      if (['hbase-site', 'global'].contains(key)) return;
-      ret = ret.concat(self.mapObject(c[key]));
-    });
-    return ret;
+  // Config categories, that should be hidden on app page
+  hiddenCategories: ['yarn-site', 'global'],
+
+  /**
+   * Configs grouped to categories by site-objects
+   * @type {Array}
+   */
+  configsByCategories: function () {
+    var configs = this.get('configs'),
+        hiddenCategories = this.get('hiddenCategories'),
+        groupedConfigs = [];
+    Ember.keys(configs).forEach(function (site) {
+      groupedConfigs.push({
+        name: site,
+        configs: this.mapObject(configs[site]),
+        isVisible: !hiddenCategories.contains(site)
+      });
+    }, this);
+    return groupedConfigs;
   }.property('configs.@each'),
 
   /**

+ 23 - 61
contrib/views/slider/src/main/resources/ui/app/templates/slider_app/configs.hbs

@@ -16,65 +16,27 @@
 * limitations under the License.
 }}
 
-{{#if model.otherConfigs}}
-  {{#bs-panel heading="General" collapsible=true}}
-    <table class="table table-striped table-bordered table-condensed">
-      <thead>
-      <tr>
-        <th class="col-sm-4">{{t common.name}}</th>
-        <th>{{t common.value}}</th>
-      </tr>
-      </thead>
-      <tbody>
-        {{#each model.otherConfigs}}
-        <tr>
-          <td>{{key}}</td>
-          <td>{{formatWordBreak value}}</td>
-        </tr>
-        {{/each}}
-      </tbody>
-    </table>
-  {{/bs-panel}}
-{{/if}}
-
-{{#if model.globals}}
-  {{#bs-panel heading="Global" collapsible=true}}
-    <table class="table table-striped table-bordered table-condensed">
-      <thead>
-        <tr>
-          <th class="col-sm-4">{{t common.name}}</th>
-          <th>{{t common.value}}</th>
-        </tr>
-      </thead>
-      <tbody>
-        {{#each model.globals}}
-          <tr>
-            <td>{{key}}</td>
-            <td>{{formatWordBreak value}}</td>
-          </tr>
-        {{/each}}
-      </tbody>
-    </table>
-  {{/bs-panel}}
-{{/if}}
-
-{{#if model.hbaseSite}}
-  {{#bs-panel heading="HBase-Site" collapsible=true}}
-    <table class="table table-striped table-bordered table-condensed">
-      <thead>
-      <tr>
-        <th class="col-sm-4">{{t common.name}}</th>
-        <th>{{t common.value}}</th>
-      </tr>
-      </thead>
-      <tbody>
-        {{#each model.hbaseSite}}
-        <tr>
-          <td>{{key}}</td>
-          <td>{{formatWordBreak value}}</td>
-        </tr>
-        {{/each}}
-      </tbody>
-    </table>
-  {{/bs-panel}}
+{{#if model.configsByCategories.length}}
+  {{#each configCategory in configsByCategories}}
+    {{#if configCategory.isVisible}}
+      {{#bs-panel heading=configCategory.name collapsible=true}}
+          <table class="table table-striped table-bordered table-condensed">
+              <thead>
+              <tr>
+                  <th class="col-sm-4">{{t common.name}}</th>
+                  <th>{{t common.value}}</th>
+              </tr>
+              </thead>
+              <tbody>
+              {{#each configCategory.configs}}
+                  <tr>
+                      <td>{{key}}</td>
+                      <td>{{formatWordBreak value}}</td>
+                  </tr>
+              {{/each}}
+              </tbody>
+          </table>
+      {{/bs-panel}}
+    {{/if}}
+  {{/each}}
 {{/if}}

Some files were not shown because too many files changed in this diff