You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2014/08/29 20:40:41 UTC

git commit: AMBARI-7087. Slider app's summary tab has multiple section layout changes (alexantonenko)

Repository: ambari
Updated Branches:
  refs/heads/trunk 99319de44 -> 45ecfc8dd


AMBARI-7087. Slider app's summary tab has multiple section layout changes (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 45ecfc8dd45ce3fe116699c10806d32ba0e8ce5e
Parents: 99319de
Author: Alex Antonenko <hi...@gmail.com>
Authored: Fri Aug 29 20:00:15 2014 +0300
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Fri Aug 29 21:38:29 2014 +0300

----------------------------------------------------------------------
 .../app/assets/data/resource/cluster_name.json  | 12 +++++
 .../assets/data/resource/components_hosts.json  | 16 +++++++
 .../app/controllers/slider_apps_controller.js   | 50 ++++++++++++++++++++
 .../src/main/resources/ui/app/helpers/ajax.js   |  2 +
 .../resources/ui/app/styles/application.less    | 10 ++++
 .../ui/app/templates/slider_app/summary.hbs     | 48 ++++++++++++++-----
 .../src/main/resources/ui/app/translations.js   |  5 +-
 .../ui/app/views/slider_app/summary_view.js     | 21 +++++++-
 8 files changed, 151 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/45ecfc8d/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/cluster_name.json
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/cluster_name.json b/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/cluster_name.json
new file mode 100644
index 0000000..f559483
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/cluster_name.json
@@ -0,0 +1,12 @@
+{
+  "href" : "http://162.216.151.215:8080/api/v1/clusters?_=1409232826826",
+  "items" : [
+    {
+      "href" : "http://162.216.151.215:8080/api/v1/clusters/mycluster",
+      "Clusters" : {
+        "cluster_name" : "mycluster",
+        "version" : "HDP-2.1"
+      }
+    }
+  ]
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/45ecfc8d/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/components_hosts.json
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/components_hosts.json b/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/components_hosts.json
new file mode 100644
index 0000000..eaf72b4
--- /dev/null
+++ b/contrib/views/slider/src/main/resources/ui/app/assets/data/resource/components_hosts.json
@@ -0,0 +1,16 @@
+{
+  "items" : [
+    {
+      "Hosts" : {
+        "host_name" : "myHost"
+      },
+      "host_components" : [
+        {
+          "HostRoles" : {
+            "component_name" : ""
+          }
+        }
+      ]
+    }
+  ]
+}

http://git-wip-us.apache.org/repos/asf/ambari/blob/45ecfc8d/contrib/views/slider/src/main/resources/ui/app/controllers/slider_apps_controller.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_apps_controller.js b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_apps_controller.js
index b9f3698..df06c2c 100644
--- a/contrib/views/slider/src/main/resources/ui/app/controllers/slider_apps_controller.js
+++ b/contrib/views/slider/src/main/resources/ui/app/controllers/slider_apps_controller.js
@@ -17,4 +17,54 @@
  */
 
 App.SliderAppsController = Ember.ArrayController.extend({
+
+  /**
+   *  Load resources on controller initialization
+   * @method initResources
+   */
+  initResources:function () {
+    this.loadComponentHost({componentName:"GANGLIA_SERVER",callback:"loadGangliaHostSuccessCallback"});
+    this.loadComponentHost({componentName:"NAGIOS_SERVER",callback:"loadNagiosHostSuccessCallback"});
+  }.on('init'),
+
+  /**
+   * Load ganglia server host
+   * @method loadGangliaHost
+   */
+  loadComponentHost: function (params) {
+    return App.ajax.send({
+      name: 'components_hosts',
+      sender: this,
+      data: {
+        componentName: params.componentName,
+        urlPrefix: '/api/v1/'
+      },
+      success: params.callback
+    });
+
+  },
+
+  /**
+   * Success callback for hosts-request
+   * Save host name to gangliaHost
+   * @param {Object} data
+   * @method loadGangliaHostSuccessCallback
+   */
+  loadGangliaHostSuccessCallback: function (data) {
+    if(data.items[0]){
+      App.set('gangliaHost', Em.get(data.items[0], 'Hosts.host_name'));
+    }
+  },
+
+  /**
+   * Success callback for hosts-request
+   * Save host name to nagiosHost
+   * @param {Object} data
+   * @method loadGangliaHostSuccessCallback
+   */
+  loadNagiosHostSuccessCallback: function (data) {
+    if(data.items[0]){
+      App.set('nagiosHost', Em.get(data.items[0], 'Hosts.host_name'));
+    }
+  },
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/45ecfc8d/contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js b/contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js
index 255668f..c3d6967 100644
--- a/contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js
+++ b/contrib/views/slider/src/main/resources/ui/app/helpers/ajax.js
@@ -106,6 +106,7 @@ var urls = {
 
   'components_hosts': {
     real: 'clusters/{clusterName}/hosts?host_components/HostRoles/component_name={componentName}&minimal_response=true',
+    mock:'/data/resource/components_hosts.json',
     headers: {
       Accept : "text/plain; charset=utf-8",
       "Content-Type": "text/plain; charset=utf-8"
@@ -114,6 +115,7 @@ var urls = {
 
   'cluster_name': {
     real: 'clusters',
+    mock:'/data/resource/cluster_name.json',
     headers: {
       Accept : "text/plain; charset=utf-8",
       "Content-Type": "text/plain; charset=utf-8"

http://git-wip-us.apache.org/repos/asf/ambari/blob/45ecfc8d/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 a60a08c..3eb6d55 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
@@ -515,6 +515,16 @@ a {
 .app_summary {
   .container {
     padding-left: 0;
+    .panel-summury {
+      min-height: 400px;
+      table  tr td:last-child {
+        word-break: break-word;
+      }
+    }
+    .panel-link {
+      margin-top: -5px;
+      margin-right: -7px;
+    }
   }
 }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/45ecfc8d/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 03ea817..974186d 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
@@ -19,7 +19,7 @@
 <div class="container">
   <div class="row">
     <div class="col-md-6">
-      {{#bs-panel heading="Summary"}}
+      {{#bs-panel heading="Summary" class="panel-summury"}}
         <table class="table table-striped table-bordered table-condensed">
           <tbody>
             <tr>
@@ -53,7 +53,7 @@
       {{/bs-panel}}
     </div>
     <div class="col-md-6">
-      {{#bs-panel heading="Components"}}
+      {{#bs-panel heading="Components" class="panel-components"}}
           <table class="table table-striped table-bordered table-condensed">
               <tbody>
               {{#each controller.model.components}}
@@ -65,17 +65,43 @@
               </tbody>
           </table>
       {{/bs-panel}}
+      <div class="panel panel-default panel-alerts">
+        <div class="panel-heading">
+          Alerts
+          <div class="btn-group pull-right panel-link">
+            <a class="btn btn-default btn-sm" target="_blank" rel="tooltip"
+              {{translateAttr title="sliderApp.summary.go_to_nagios"}}
+              {{bindAttr href="view.nagiosUrl"}}>
+                <i class="icon-link"></i>
+            </a>
+          </div>
+        </div>
+        <div class="panel-body">
+        </div>
+      </div>
     </div>
   </div>
   {{#if controller.model.showMetrics}}
-    {{#bs-panel heading="Metrics"}}
-      {{#each graphs in view.parentView.graphs}}
-        <div class="row">
-          {{#each graph in graphs}}
-            <div class="col-md-3">{{view graph}}</div>
-          {{/each}}
+    <div class="panel panel-default">
+      <div class="panel-heading">
+        Metrics
+        <div class="btn-group pull-right panel-link">
+          <a class="btn btn-default btn-sm" target="_blank" rel="tooltip"
+            {{translateAttr title="sliderApp.summary.go_to_ganglia"}}
+            {{bindAttr href="view.gangliaUrl"}}>
+              <i class="icon-link"></i>
+          </a>
         </div>
-      {{/each}}
-    {{/bs-panel}}
+      </div>
+      <div class="panel-body">
+        {{#each graphs in view.graphs}}
+       <div class="row">
+         {{#each graph in graphs}}
+           <div class="col-md-3">{{view graph}}</div>
+         {{/each}}
+       </div>
+     {{/each}}
+      </div>
+    </div>
   {{/if}}
-</div>
\ No newline at end of file
+</div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/45ecfc8d/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 52e6b6c..108d1c7 100644
--- a/contrib/views/slider/src/main/resources/ui/app/translations.js
+++ b/contrib/views/slider/src/main/resources/ui/app/translations.js
@@ -69,6 +69,9 @@ Em.I18n.translations = {
   'slider.apps.create': 'Create App',
   'sliderApps.filters.info': '{0} of {1} sliders showing',
 
+  'sliderApp.summary.go_to_nagios': 'Go to Nagios',
+  'sliderApp.summary.go_to_ganglia': 'Go to Ganglia',
+
   'wizard.name': 'Create Slider App',
   'wizard.step1.name': 'Select Type',
   'wizard.step1.header': 'Available Types',
@@ -88,4 +91,4 @@ Em.I18n.translations = {
   'wizard.step4.name': 'Deploy',
   'wizard.step4.appName': 'App Name',
   'wizard.step4.appType': 'App Type'
-};
\ No newline at end of file
+};

http://git-wip-us.apache.org/repos/asf/ambari/blob/45ecfc8d/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
----------------------------------------------------------------------
diff --git a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
index bad2eb9..cb3b64a 100644
--- a/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
+++ b/contrib/views/slider/src/main/resources/ui/app/views/slider_app/summary_view.js
@@ -22,6 +22,25 @@ App.SliderAppSummaryView = Ember.View.extend({
 
   graphs: [
     [App.MetricView, App.Metric2View, App.Metric3View, App.Metric4View]
-  ]
+  ],
+
+  /**
+   * @type {string}
+   */
+  gangliaUrl: function () {
+    return 'http://' + App.get('gangliaHost') + '/ganglia';
+  }.property(),
+
+  /**
+   * @type {string}
+   */
+  nagiosUrl: function () {
+    return 'http://' + App.get('nagiosHost') + '/nagios';
+  }.property(),
+
+  fitPanels:function () {
+    var heightLeft = parseInt(this.$('.panel-summury').css('height'));
+    this.$('.panel-components, .panel-alerts').css('height',((heightLeft<200)?200:heightLeft-20)/2);
+  }.on('didInsertElement')
 
 });