Browse Source

AMBARI-1145. Cluster Management refactoring. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1431841 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 years ago
parent
commit
764392d54a

+ 1 - 1
ambari-web/app/controllers/wizard/step9_controller.js

@@ -120,7 +120,7 @@ App.WizardStep9Controller = Em.Controller.extend({
     var hosts = new Ember.Set();
     for (var index in hostInfo) {
       var obj = Em.Object.create(hostInfo[index]);
-      //obj.message = '';
+      obj.message = (obj.message) ? obj.message : 'Waiting';
       obj.progress = 0;
       obj.status = (obj.status) ? obj.status : 'info';
       obj.tasks = [];

+ 2 - 0
ambari-web/app/messages.js

@@ -272,6 +272,8 @@ Em.I18n.translations = {
   'services.service.actions.run.smoke':'Run Smoke Test',
   'services.service.actions.maintenance':'Maintenance',
   'services.service.summary.unknown':'unknown',
+  'services.service.summary.notRunning':'Not Running',
+  'services.service.summary.notAvailable':'n/a',
 
   'services.add.header':'Add Service Wizard',
 

+ 2 - 0
ambari-web/app/styles/application.less

@@ -711,6 +711,7 @@ a:focus {
     background-position: 6px 5px;
     background-repeat: no-repeat;
     list-style: none;
+    float:left;
     min-height: 20px;
     min-width: 20px;
     margin-left: 0;
@@ -1062,6 +1063,7 @@ a:focus {
       background-position: 6px 5px;
       background-repeat: no-repeat;
       list-style: none;
+      float: left;
       height: 20px;
       width: 20px;
       margin-left: 0;

+ 1 - 1
ambari-web/app/templates/main/dashboard/service/hbase.hbs

@@ -54,7 +54,7 @@
       <!-- Version -->
       <tr>
         <td>{{t dashboard.services.hbase.version}}</td>
-        <td>{{view.service.version}} {{view.service.revision}}</td>
+        <td>{{view.version}} {{view.service.revision}}</td>
       </tr>
       <!-- HBaseMaster Web UI -->
       <tr>

+ 6 - 6
ambari-web/app/templates/main/dashboard/service/hdfs.hbs

@@ -62,7 +62,7 @@
       <!-- Version -->
       <tr>
         <td>{{t dashboard.services.hdfs.version}}</td>
-        <td>{{view.service.version}}</td>
+        <td>{{view.version}}</td>
       </tr>
       <!-- NameNode Web UI -->
       <tr>
@@ -97,21 +97,21 @@
       <!-- Blocks Total -->
       <tr>
         <td>{{t services.service.summary.blocksTotal}}</td>
-        <td>{{view.service.dfsTotalBlocks}}</td>
+        <td>{{view.dfsTotalBlocks}}</td>
       </tr>
       <!-- Block Errors -->
       <tr>
         <td>{{t services.service.summary.blockErrors}}</td>
         <td>
-          {{view.service.dfsCorruptBlocks}} corrupt /
-          {{view.service.dfsMissingBlocks}} missing /
-          {{view.service.dfsUnderReplicatedBlocks}} under replicated
+          {{view.dfsCorruptBlocks}} corrupt /
+          {{view.dfsMissingBlocks}} missing /
+          {{view.dfsUnderReplicatedBlocks}} under replicated
         </td>
       </tr>
       <!-- Total Files And Directories -->
       <tr>
         <td>{{t dashboard.services.hdfs.totalFilesAndDirs}}</td>
-        <td>{{view.service.dfsTotalFiles}}</td>
+        <td>{{view.dfsTotalFiles}}</td>
       </tr>
       <!-- Upgrade Status -->
       <tr>

+ 1 - 1
ambari-web/app/templates/main/dashboard/service/mapreduce.hbs

@@ -54,7 +54,7 @@
       <!-- Version -->
       <tr>
         <td>{{t dashboard.services.hdfs.version}}</td>
-        <td>{{view.service.version}}</td>
+        <td>{{view.version}}</td>
       </tr>
       <!-- JobTracker Web UI -->
       <tr>

+ 6 - 2
ambari-web/app/views/main/dashboard/service.js

@@ -22,7 +22,7 @@ require('models/alert');
 
 App.MainDashboardServiceHealthView = Em.View.extend({
   classNameBindings: ["healthStatus"],
-  template: Em.Handlebars.compile(""),
+  //template: Em.Handlebars.compile(""),
   blink: false,
   tagName: 'span',
   
@@ -71,7 +71,7 @@ App.MainDashboardServiceHealthView = Em.View.extend({
         break;
     }
 
-    return 'health-status-' + status + " span";
+    return 'health-status-' + status;
   }.property('service.healthStatus'),
 
   didInsertElement: function () {
@@ -86,6 +86,10 @@ App.MainDashboardServiceView = Em.View.extend({
     return this.get('controller.data.' + this.get('serviceName'));
   }.property('controller.data'),
 
+  formatUnavailable: function(value){
+    return (value || value == 0) ? value : this.t('services.service.summary.notAvailable');
+  },
+
   criticalAlertsCount: function () {
     var alerts = App.router.get('clusterController.alerts');
     return alerts.filterProperty('serviceType', this.get('service.id')).filterProperty('isOk', false).length;

+ 7 - 3
ambari-web/app/views/main/dashboard/service/hbase.js

@@ -31,6 +31,10 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
     return this.t('dashboard.services.hbase.masterServerHeap.summary').format(heapString, heapMaxString, percent.toFixed(1));
   }.property('service.heapMemoryUsed', 'service.heapMemoryMax'),
 
+  version: function(){
+    return this.formatUnavailable(this.get('service.version'));
+  }.property('service.version'),
+
   summaryHeader: function () {
     var avgLoad = this.get('service.averageLoad');
     if (avgLoad == null) {
@@ -46,7 +50,7 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
   averageLoad: function () {
     var avgLoad = this.get('service.averageLoad');
     if (avgLoad == null) {
-      avgLoad = this.t('services.service.summary.unknown');
+      avgLoad = this.t('services.service.summary.notAvailable');
     }
     return this.t('dashboard.services.hbase.averageLoadPerServer').format(avgLoad);
   }.property("service.averageLoad"),
@@ -61,7 +65,7 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
       var formatted = date.timingFormat(diff);
       return this.t('dashboard.services.uptime').format(formatted);
     }
-    return this.t('services.service.summary.unknown');
+    return this.t('services.service.summary.notRunning');
   }.property("service.masterStartTime"),
 
   masterActivatedTime: function () {
@@ -74,7 +78,7 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
       var formatted = date.timingFormat(diff);
       return this.t('dashboard.services.uptime').format(formatted);
     }
-    return this.t('services.service.summary.unknown');
+    return this.t('services.service.summary.notRunning');
   }.property("service.masterActiveTime"),
 
   regionServerComponent: function () {

+ 27 - 5
ambari-web/app/views/main/dashboard/service/hdfs.js

@@ -31,14 +31,36 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
     }.property('service.capacityUsed', 'service.capacityTotal')
   }),
 
+  version: function(){
+    return this.formatUnavailable(this.get('service.version'));
+  }.property('service.version'),
+  dfsTotalBlocks: function(){
+    return this.formatUnavailable(this.get('service.dfsTotalBlocks'));
+  }.property('service.dfsTotalBlocks'),
+  dfsTotalFiles: function(){
+    return this.formatUnavailable(this.get('service.dfsTotalFiles'));
+  }.property('service.dfsTotalFiles'),
+  dfsCorruptBlocks: function(){
+    return this.formatUnavailable(this.get('service.dfsCorruptBlocks'));
+  }.property('service.dfsCorruptBlocks'),
+  dfsMissingBlocks: function(){
+    return this.formatUnavailable(this.get('service.dfsMissingBlocks'));
+  }.property('service.dfsMissingBlocks'),
+  dfsUnderReplicatedBlocks: function(){
+    return this.formatUnavailable(this.get('service.dfsUnderReplicatedBlocks'));
+  }.property('service.dfsUnderReplicatedBlocks'),
+
   nodeUptime: function () {
     var uptime = this.get('service').get('nameNodeStartTime');
-    var diff = (new Date()).getTime() - uptime;
-    if (diff < 0) {
-      diff = 0;
+    if (uptime && uptime > 0){
+      var diff = (new Date()).getTime() - uptime;
+      if (diff < 0) {
+        diff = 0;
+      }
+      var formatted = date.timingFormat(diff);
+      return this.t('dashboard.services.uptime').format(formatted);
     }
-    var formatted = date.timingFormat(diff);
-    return this.t('dashboard.services.uptime').format(formatted);
+    return this.t('services.service.summary.notRunning');
   }.property("service.nameNodeStartTime"),
 
   nodeWebUrl: function () {

+ 20 - 12
ambari-web/app/views/main/dashboard/service/mapreduce.js

@@ -31,14 +31,22 @@ App.MainDashboardServiceMapreduceView = App.MainDashboardServiceView.extend({
     }.property('_parentView.data.chart')
   }),
 
+  version: function(){
+    return this.formatUnavailable(this.get('service.version'));
+  }.property('service.version'),
+
   jobTrackerUptime: function () {
     var uptime = this.get('service').get('jobTrackerStartTime');
-    var diff = (new Date()).getTime() - uptime;
-    if (diff < 0) {
-      diff = 0;
+    if (uptime && uptime > 0){
+      var diff = (new Date()).getTime() - uptime;
+      if (diff < 0) {
+        diff = 0;
+      }
+      var formatted = date.timingFormat(diff);
+      return this.t('dashboard.services.uptime').format(formatted);
+
     }
-    var formatted = date.timingFormat(diff);
-    return this.t('dashboard.services.uptime').format(formatted);
+    return this.t('services.service.summary.notRunning');
   }.property("service.jobTrackerStartTime"),
 
   summaryHeader: function () {
@@ -60,8 +68,8 @@ App.MainDashboardServiceMapreduceView = App.MainDashboardServiceView.extend({
   }.property('service.aliveTrackers', 'service.taskTrackers'),
 
   trackersHeapSummary: function () {
-    var heapUsed = this.get('service').get('jobTrackerHeapUsed') || 90;
-    var heapMax = this.get('service').get('jobTrackerHeapMax') || 90;
+    var heapUsed = this.get('service').get('jobTrackerHeapUsed') || 0;
+    var heapMax = this.get('service').get('jobTrackerHeapMax') || 0;
     var percent = heapMax > 0 ? 100 * heapUsed / heapMax : 0;
     return this.t('dashboard.services.mapreduce.jobTrackerHeapSummary').format(heapUsed.bytesToSize(1, "parseFloat"), heapMax.bytesToSize(1, "parseFloat"), percent.toFixed(1));
   }.property('service.jobTrackerHeapUsed', 'service.jobTrackerHeapMax'),
@@ -69,31 +77,31 @@ App.MainDashboardServiceMapreduceView = App.MainDashboardServiceView.extend({
   jobsSummary: function () {
     var svc = this.get('service');
     var template = this.t('dashboard.services.mapreduce.jobsSummary');
-    return template.format(svc.get('jobsSubmitted'), svc.get('jobsCompleted'));
+    return template.format(this.formatUnavailable(svc.get('jobsSubmitted')), this.formatUnavailable(svc.get('jobsCompleted')));
   }.property('service.jobsSubmitted', 'service.jobsCompleted'),
 
   mapSlotsSummary: function () {
     var svc = this.get('service');
     var template = this.t('dashboard.services.mapreduce.mapSlotsSummary');
-    return template.format(svc.get('mapSlotsOccupied'), svc.get('mapSlotsReserved'));
+    return template.format(this.formatUnavailable(svc.get('mapSlotsOccupied')), this.formatUnavailable(svc.get('mapSlotsReserved')));
   }.property('service.mapSlotsOccupied', 'service.mapSlotsReserved'),
 
   reduceSlotsSummary: function () {
     var svc = this.get('service');
     var template = this.t('dashboard.services.mapreduce.reduceSlotsSummary');
-    return template.format(svc.get('reduceSlotsOccupied'), svc.get('reduceSlotsReserved'));
+    return template.format(this.formatUnavailable(svc.get('reduceSlotsOccupied')), this.formatUnavailable(svc.get('reduceSlotsReserved')));
   }.property('service.reduceSlotsOccupied', 'service.reduceSlotsReserved'),
 
   mapTasksSummary: function () {
     var svc = this.get('service');
     var template = this.t('dashboard.services.mapreduce.tasksSummary');
-    return template.format(svc.get('mapsRunning'), svc.get('mapsWaiting'));
+    return template.format(this.formatUnavailable(svc.get('mapsRunning')), this.formatUnavailable(svc.get('mapsWaiting')));
   }.property('service.mapsRunning', 'service.mapsWaiting'),
 
   reduceTasksSummary: function () {
     var svc = this.get('service');
     var template = this.t('dashboard.services.mapreduce.tasksSummary');
-    return template.format(svc.get('reducesRunning'), svc.get('reducesWaiting'));
+    return template.format(this.formatUnavailable(svc.get('reducesRunning')), this.formatUnavailable(svc.get('reducesWaiting')));
   }.property('service.reducesRunning', 'service.reducesWaiting'),
 
   slotsCapacitySummary: function () {