Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 035CB115E8 for ; Thu, 11 Sep 2014 19:02:23 +0000 (UTC) Received: (qmail 57190 invoked by uid 500); 11 Sep 2014 19:02:22 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 57104 invoked by uid 500); 11 Sep 2014 19:02:22 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 56878 invoked by uid 99); 11 Sep 2014 19:02:22 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 11 Sep 2014 19:02:22 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 67A7C9BD39A; Thu, 11 Sep 2014 19:02:22 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jonathanhurley@apache.org To: commits@ambari.apache.org Date: Thu, 11 Sep 2014 19:02:28 -0000 Message-Id: In-Reply-To: <5caba8d7c69a445483c0eeb878575035@git.apache.org> References: <5caba8d7c69a445483c0eeb878575035@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/26] git commit: AMBARI-7247. Slider View: App configs look inconsistent from Ambari's configs. (onechiporenko) AMBARI-7247. Slider View: App configs look inconsistent from Ambari's configs. (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9588d2a9 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9588d2a9 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9588d2a9 Branch: refs/heads/branch-alerts-dev Commit: 9588d2a9cd899193250cdc22c3cbd13dd1be969f Parents: 015e6ab Author: Oleg Nechiporenko Authored: Wed Sep 10 19:48:17 2014 +0300 Committer: Oleg Nechiporenko Committed: Wed Sep 10 19:48:17 2014 +0300 ---------------------------------------------------------------------- .../main/resources/ui/app/mixins/with_panels.js | 50 +++++++++++++++++ .../main/resources/ui/app/models/slider_app.js | 24 ++------- .../resources/ui/app/styles/application.less | 16 ++++++ .../ui/app/templates/slider_app/configs.hbs | 36 ++++++------- .../ui/app/templates/slider_app/summary.hbs | 10 ++-- .../src/main/resources/ui/app/translations.js | 3 +- .../ui/app/views/slider_app/configs_view.js | 57 ++++++++++++++++++++ 7 files changed, 152 insertions(+), 44 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9588d2a9/contrib/views/slider/src/main/resources/ui/app/mixins/with_panels.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/mixins/with_panels.js b/contrib/views/slider/src/main/resources/ui/app/mixins/with_panels.js new file mode 100644 index 0000000..b1358be --- /dev/null +++ b/contrib/views/slider/src/main/resources/ui/app/mixins/with_panels.js @@ -0,0 +1,50 @@ +/** + * 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. + */ + +/** + * Mixin for views that use Bootstrap.BsPanelComponent component + * Add caret for collapsed/expanded panels at the left of panel's title + * Usage: + * + * App.SomeView = Em.View.extend(App.WithPanels, { + * didInsertElement: function() { + * this.addCarets(); + * } + * }); + * + * @type {Em.Mixin} + */ +App.WithPanels = Ember.Mixin.create({ + + /** + * Add caret before panel's title and add handlers for expand/collapse events + * Set caret-down when panel is expanded + * Set caret-right when panel is collapsed + * @method addArrows + */ + addCarets: function() { + var panel = $('.panel'); + panel.find('.panel-heading').prepend(''); + panel.on('hidden.bs.collapse', function (e) { + $(e.delegateTarget).find('span.icon').addClass('icon-caret-right').removeClass('icon-caret-down'); + }).on('shown.bs.collapse', function (e) { + $(e.delegateTarget).find('span.icon').addClass('icon-caret-down').removeClass('icon-caret-right'); + }); + } + +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/9588d2a9/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js b/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js index 6d6bfcc..bf02f30 100644 --- a/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js +++ b/contrib/views/slider/src/main/resources/ui/app/models/slider_app.js @@ -108,24 +108,6 @@ App.SliderApp = DS.Model.extend({ 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'), - - /** * Display metrics only for running apps * @type {boolean} */ @@ -141,7 +123,11 @@ App.SliderApp = DS.Model.extend({ mapObject: function(o) { if (Ember.typeOf(o) !== 'object') return []; return Ember.keys(o).map(function(key) { - return {key: key, value: o[key]}; + return { + key: key, + value: o[key], + isMultiline: o[key].indexOf("\n") !== -1 || o[key].length > 100 + }; }); } http://git-wip-us.apache.org/repos/asf/ambari/blob/9588d2a9/contrib/views/slider/src/main/resources/ui/app/styles/application.less ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/styles/application.less b/contrib/views/slider/src/main/resources/ui/app/styles/application.less index 11ec39b..f5024a1 100644 --- a/contrib/views/slider/src/main/resources/ui/app/styles/application.less +++ b/contrib/views/slider/src/main/resources/ui/app/styles/application.less @@ -609,6 +609,22 @@ a { } } + +.app_configs { + a.accordion-toggle { + display: block; + } + .row { + margin: 10px 0; + textarea { + height: 200px; + padding-left: 5px; + padding-right: 5px; + resize: none; + } + } +} + .app-alerts { overflow-y: auto; ul { http://git-wip-us.apache.org/repos/asf/ambari/blob/9588d2a9/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/configs.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/configs.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/configs.hbs index c3597d7..6eddc8d 100644 --- a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/configs.hbs +++ b/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/configs.hbs @@ -16,27 +16,25 @@ * limitations under the License. }} -{{#if model.configsByCategories.length}} - {{#each configCategory in configsByCategories}} +
+ {{#each configCategory in view.configsByCategories}} {{#if configCategory.isVisible}} {{#bs-panel heading=configCategory.name collapsible=true}} - - - - - - - - - {{#each configCategory.configs}} - - - - - {{/each}} - -
{{t common.name}}{{t common.value}}
{{key}}{{formatWordBreak value}}
+
+ {{#each configCategory.configs}} +
+
{{formatWordBreak key devider="."}}
+
+ {{#if isMultiline}} + {{textarea disabled=true value=value classNames="col-md-6"}} + {{else}} + + {{/if}} +
+
+ {{/each}} +
{{/bs-panel}} {{/if}} {{/each}} -{{/if}} \ No newline at end of file +
\ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9588d2a9/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs b/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs index 0ba3998..cf86dc5 100644 --- a/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs +++ b/contrib/views/slider/src/main/resources/ui/app/templates/slider_app/summary.hbs @@ -67,11 +67,11 @@ {{/bs-panel}}
- Alerts + {{t common.alerts}} @@ -83,7 +83,7 @@
- +
@@ -105,11 +105,11 @@ {{#if controller.model.showMetrics}}
- Metrics + {{t common.metrics}} http://git-wip-us.apache.org/repos/asf/ambari/blob/9588d2a9/contrib/views/slider/src/main/resources/ui/app/translations.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/translations.js b/contrib/views/slider/src/main/resources/ui/app/translations.js index e5e6a79..efa3979 100644 --- a/contrib/views/slider/src/main/resources/ui/app/translations.js +++ b/contrib/views/slider/src/main/resources/ui/app/translations.js @@ -46,7 +46,8 @@ Em.I18n.translations = { 'started': 'Started', 'finished': 'Finished', 'diagnostics': 'Diagnostics', - 'description': 'Description' + 'description': 'Description', + 'alerts': 'Alerts' }, 'error.noHDFS': 'Slider applications view requires HDFS service.', http://git-wip-us.apache.org/repos/asf/ambari/blob/9588d2a9/contrib/views/slider/src/main/resources/ui/app/views/slider_app/configs_view.js ---------------------------------------------------------------------- diff --git a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/configs_view.js b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/configs_view.js new file mode 100644 index 0000000..5093fb9 --- /dev/null +++ b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/configs_view.js @@ -0,0 +1,57 @@ +/** + * 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. + */ + +App.SliderAppConfigsView = Ember.View.extend(App.WithPanels, { + + /** + * List of configs group by categories + * @type {Object[]} + */ + configsByCategories: Em.A([]), + + /** + * Observer for model's configs + * Updates configsByCategories + * @method configsObserver + */ + configsObserver: function() { + var model = this.get('controller.content'), + configs = model.get('.configs'), + configsByCategories = this.get('configsByCategories'), + hiddenCategories = model.get('hiddenCategories'); + Em.keys(configs).forEach(function (site) { + if (configsByCategories.mapBy('name').contains(site)) { + var c = configsByCategories.findBy('name', site); + c.set('configs', model.mapObject(configs[site])); + c.set('isVisible', !hiddenCategories.contains(site)); + } + else { + configsByCategories.pushObject(Em.Object.create({ + name: site, + configs: model.mapObject(configs[site]), + isVisible: !hiddenCategories.contains(site) + })); + } + }); + }.observes('controller.content.configs.@each'), + + didInsertElement: function() { + this.addCarets(); + } + +});