Browse Source

AMBARI-1308. Properly display Apps page aggregate summary and data table when there are no data to be shown. (Arun Kandregula via yusaku)

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

+ 3 - 0
CHANGES.txt

@@ -36,6 +36,9 @@ Trunk (unreleased changes):
 
  IMPROVEMENTS
 
+ AMBARI-1308. Properly display Apps page aggregate summary and data table when
+ there are no data to be show. (Arun Kandregula via yusaku)
+
  AMBARI-1306. Change color of rack_local_map to #66B366. (yusaku)
 
  AMBARI-1311. Host health indicator should have a tooltip showing few details - 

+ 15 - 15
ambari-web/app/controllers/main/apps_controller.js

@@ -432,7 +432,7 @@ App.MainAppsController = Em.ArrayController.extend({
       'filterObject.viewType'
   ),
 
-  serverData: null,
+  serverData: "",
   summary: null,
 
   /**
@@ -444,28 +444,28 @@ App.MainAppsController = Em.ArrayController.extend({
     if(!summary){
       tmp = {
         'jobs': {
-          'avg': 'undefined',
-          'min': 'undefined',
-          'max': 'undefined'
+          'avg': '-',
+          'min': '-',
+          'max': '-'
         },
         'input': {
-          'avg': 'undefined',
-          'min': 'undefined',
-          'max': 'undefined'
+          'avg': '-',
+          'min': '-',
+          'max': '-'
         },
         'output': {
-          'avg': 'undefined',
-          'min': 'undefined',
-          'max': 'undefined'
+          'avg': '-',
+          'min': '-',
+          'max': '-'
         },
         'duration': {
-          'avg': 'undefined',
-          'min': 'undefined',
-          'max': 'undefined'
+          'avg': '-',
+          'min': '-',
+          'max': '-'
         },
         'times': {
-          'oldest': 'undefined',
-          'youngest': 'undefined'
+          'oldest': '-',
+          'youngest': '-'
         }
       };
     }else{

+ 1 - 1
ambari-web/app/mappers/runs_mapper.js

@@ -66,8 +66,8 @@ App.runsMapper = App.QuickDataMapper.create({
       });
 
       App.router.get('mainAppsController').set('content', r);
-      App.router.get('mainAppsController').set('paginationObject', pagination_info);
       App.router.get('mainAppsController').set('serverData', json.summary);
+      App.router.get('mainAppsController').set('paginationObject', pagination_info);
     }
 
 

+ 5 - 1
ambari-web/app/styles/apps.less

@@ -34,7 +34,7 @@
       border:none;
     }
   }
-  
+
   #filter_buttons .selected{
     cursor: default;
   }
@@ -60,6 +60,10 @@
       width: 77%;
     }
 
+    .no-data{
+      text-align: center;
+    }
+
     input.input-super-mini{
       width: 47px;
       max-width: 57%;

+ 9 - 3
ambari-web/app/templates/main/apps.hbs

@@ -88,9 +88,15 @@
     </tr>
     </thead>
     <tbody>
-    {{#each run in content}}
-      {{view view.containerRow runBinding="run" currentViewBinding="view.appTableRow"}}
-    {{/each}}
+       {{#if  view.emptyData}}
+         <tr>
+           <td class="no-data" colspan="9">No jobs to display</td>
+         </tr>
+       {{else}}
+         {{#each run in content}}
+           {{view view.containerRow runBinding="run" currentViewBinding="view.appTableRow"}}
+         {{/each}}
+       {{/if}}
     </tbody>
   </table>
 

+ 13 - 0
ambari-web/app/views/main/apps_view.js

@@ -64,6 +64,19 @@ App.MainAppsView = Em.View.extend({
     }
   }),
 
+  emptyData:true,
+
+  emptyDataObserver:function(){
+    //debugger;
+    if(this.get("controller.paginationObject.iTotalRecords") != null && this.get("controller.paginationObject.iTotalDisplayRecords")>0){
+      this.set("emptyData",false);
+    }else{
+      this.set("emptyData",true);
+      this.set("controller.serverData",null);
+    }
+  }.observes("controller.paginationObject.iTotalDisplayRecords","controller.paginationObject.iTotalRecords"),
+
+
   /**
    * View for RunPerPage select component
    */