Prechádzať zdrojové kódy

AMBARI-1145. Cluster Management refactoring. (yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1431824 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 rokov pred
rodič
commit
7c1820fb10

+ 5 - 130
ambari-web/app/controllers/main/host.js

@@ -22,9 +22,10 @@ var validator = require('utils/validator');
 App.MainHostController = Em.ArrayController.extend({
   name:'mainHostController',
   content:[],
+  comeWithFilter: false,
   fullContent:App.Host.find(),
   clusters:App.Cluster.find(),
-  //componentsForFilter: App.Component.find(),
+
   isAdmin: function(){
     return App.db.getUser().admin;
   }.property('App.router.loginController.loginName'),
@@ -50,38 +51,6 @@ App.MainHostController = Em.ArrayController.extend({
 
   totalBinding:'fullContent.length',
   filters:{components:[]},
-  pageSize: 25,
-  pageSizeRange:[10, 25, 50, 100, 'all'],
-  rangeStart:0,
-//  allChecked:false,
-//  selectedHostsIds:[],
-  selectedRack:null,
-
-//  assignHostsToRack:function () {
-//    var selectedRack = this.get('selectedRack');
-//    var sureMessage = this.t('hosts.assignToRack.sure');
-//    var hostsIds = this.get('selectedHostsIds');
-//
-//    var hostString = hostsIds.length + " " + this.t(hostsIds.length > 1 ? "host.plural" : "host.singular");
-//
-//    if (selectedRack.constructor == 'App.Cluster' && hostsIds.length
-//      && confirm(sureMessage.format(hostString, selectedRack.get('clusterName')))) {
-//      this.get('content').forEach(function (host) {
-//        if (host.get('isChecked')) {
-//          host.set('cluster', selectedRack);
-//          host.set('isChecked', false);
-//        }
-//      })
-//      this.set('selectedHostsIds', []);
-//    }
-//
-//  },
-
-  sortingAsc:true,
-  isSort:false,
-  sortClass:function () {
-    return this.get('sortingAsc') ? 'icon-arrow-down' : 'icon-arrow-up';
-  }.property('sortingAsc'),
   isDisabled:true,
 
   checkRemoved:function (host_id) {
@@ -124,38 +93,6 @@ App.MainHostController = Em.ArrayController.extend({
     return 5;
   }.property(),
 
-//  onAllChecked:function () {
-//    var hosts = this.get('content');
-//    hosts.setEach('isChecked', this.get('allChecked'));
-//    this.set('isDisabled', !this.get('allChecked'));
-//    var selectedHostsIds = this.get('allChecked') ? hosts.getEach('id') : [];
-//    this.set('selectedHostsIds', selectedHostsIds);
-//  }.observes('allChecked'),
-//
-//  onHostChecked:function (host) {
-//    var selected = this.get('selectedHostsIds');
-//    host.set('isChecked', !host.get('isChecked'));
-//    if (host.get('isChecked')) {
-//      selected.push(host.get('id'));
-//    } else {
-//      var index = selected.indexOf(host.get('id'));
-//      if (index != -1) selected.splice(index, 1);
-//    }
-//    this.set('isDisabled', selected.length == 0);
-//    this.propertyDidChange('selectedHostsIds');
-//  },
-//
-//  changeSelectedHosts:function () {
-//    var visibleHosts = this.get('content');
-//    var selectedHosts = visibleHosts.filterProperty('isChecked', true);
-//    this.get('fullContent').forEach(function (item) {
-//      var index = visibleHosts.getEach('id').indexOf(item.get('id'));
-//      if (index == -1) item.set('isChecked', false);
-//    });
-//    this.set('isDisabled', selectedHosts.length == 0);
-//    this.set('selectedHostsIds', selectedHosts.getEach('id'));
-//  },
-
   checkedComponentsIds:function () {
     var checked = [];
     this.get('componentsForFilter').forEach(function (comp) {
@@ -166,20 +103,6 @@ App.MainHostController = Em.ArrayController.extend({
     return checked;
   },
 
-  filterByComponentsIds:function () {
-    var componentsIds = this.checkedComponentsIds();
-    this.set('filters.components', componentsIds);
-
-//      component.set('isChecked', component.get('id') != -1);
-
-    this.changeContent();
-  },
-
-  filterHostsBy:function (field, value) {
-    this.set('hostFilter' + field, value);
-    this.changeContent();
-  },
-
   filterByComponent:function (component) {
     var id = component.get('id');
     /*this.get('componentsForFilter').setEach('isChecked', false);
@@ -189,7 +112,7 @@ App.MainHostController = Em.ArrayController.extend({
     //component.set('checkedForHostFilter', true);
     this.set('filters.components', [component.get('id')]);
     console.log(this.get('filters.components').objectAt(0));
-    this.changeContent();
+    this.set('comeWithFilter', true);
   },
 
 
@@ -247,39 +170,8 @@ App.MainHostController = Em.ArrayController.extend({
     items = this.applyHostFilters(items);
     this.set('total', items.length);
 
-    var content = items.slice(this.get('rangeStart'), this.get('rangeStop'));
-    this.replace(0, this.get('length'), content);
-//    this.changeSelectedHosts();
-  }.observes('rangeStart', 'rangeStop', 'total'),
-
-  showNextPage:function () {
-    this.nextPage();
-  },
-  showPreviousPage:function () {
-    this.previousPage();
-  },
-  assignedToRackPopup:function (event) {
-    var self = this;
-    App.ModalPopup.show({
-      header:Em.I18n.t('hosts.assignedToRack.popup.header'),
-      body:Em.I18n.t('hosts.assignedToRack.popup.body'),
-      primary:'Yes',
-      secondary:'No',
-      onPrimary:function () {
-        self.assignedToRack(event.context);
-        this.hide();
-      },
-      onSecondary:function () {
-        this.hide();
-      }
-    });
-  },
-
-  assignedToRack:function (rack) {
-    var hosts = this.get('content');
-    var selectedHosts = hosts.filterProperty('isChecked', true);
-    selectedHosts.setEach('cluster', rack);
-  },
+    this.replace(0, this.get('length'), items);
+  }.observes('total'),
 
   decommissionButtonPopup:function () {
     var self = this;
@@ -319,24 +211,7 @@ App.MainHostController = Em.ArrayController.extend({
     selectedHosts.forEach(function (_hostInfo) {
       console.log('Removing:  ' + _hostInfo.hostName);
     });
-//    App.db.removeHosts(selectedHosts);
     this.get('fullContent').removeObjects(selectedHosts);
-  },
-  sortByName:function () {
-    var asc = this.get('sortingAsc');
-    var objects = this.get('fullContent').toArray().sort(function (a, b) {
-      var nA = a.get('hostName').toLowerCase();
-      var nB = b.get('hostName').toLowerCase();
-      if (nA < nB)
-        return asc ? -1 : 1;
-      else if (nA > nB)
-        return asc ? 1 : -1;
-      return 0;
-    });
-    this.set('fullContent', objects);
-    this.set('isSort', true);
-    this.set('sortingAsc', !this.get('sortingAsc'));
-    this.changeContent();
   }
 
 });

+ 11 - 8
ambari-web/app/controllers/main/service/info/configs.js

@@ -276,6 +276,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
           serviceConfigObj.isRequired = configProperty.isRequired ? configProperty.isRequired : true;
           serviceConfigObj.isReconfigurable = (configProperty.isReconfigurable !== undefined) ? configProperty.isReconfigurable : true;
           serviceConfigObj.isVisible = (configProperty.isVisible !== undefined) ? configProperty.isVisible : true;
+          serviceConfigObj.unit = (configProperty.isVisible !== undefined) ? configProperty.unit : undefined;
 
         }
         serviceConfigObj.displayType = this.get('configs').someProperty('name', index) ? this.get('configs').findProperty('name', index).displayType : null;
@@ -877,16 +878,18 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
           var value = _keyValue.match(/=(.*)/);
           if (key) {
             // Check dat entered config is allowed to reconfigure
-            if (this.get('uiConfigs').someProperty('name', key[1])) {
+            if (this.get('uiConfigs').filterProperty('filename', _site.name + '.xml').someProperty('name', key[1])) {
               var property = {
-                siteProperty: key[1],
+                siteProperty: null,
                 displayNames: []
               };
-              if (this.get('configMapping').someProperty('name', key[1])) {
-                this.setPropertyDisplayNames(property.displayNames, this.get('configMapping').findProperty('name', key[1]).templateName);
-              }
-              siteProperties.push(property);
               if (_site.name !== 'core-site') {
+                property.siteProperty = key[1];
+
+                if (this.get('configMapping').someProperty('name', key[1])) {
+                  this.setPropertyDisplayNames(property.displayNames, this.get('configMapping').findProperty('name', key[1]).templateName);
+                }
+                siteProperties.push(property);
                 flag = false;
               } else {
                 this.setSiteProperty(key[1], value[1], _site.name + '.xml');
@@ -924,8 +927,8 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
    * Set property of the site variable
    */
   setSiteProperty: function (key, value, filename) {
-    if(filename === 'core-site.xml' && this.get('uiConfigs').filterProperty('filename','core-site.xml').someProperty('name',key)) {
-      this.get('uiConfigs').filterProperty('filename','core-site.xml').findProperty('name',key).value = value;
+    if (filename === 'core-site.xml' && this.get('uiConfigs').filterProperty('filename', 'core-site.xml').someProperty('name', key)) {
+      this.get('uiConfigs').filterProperty('filename', 'core-site.xml').findProperty('name', key).value = value;
       return;
     }
     this.get('uiConfigs').pushObject({

+ 1 - 0
ambari-web/app/data/custom_configs.js

@@ -29,6 +29,7 @@ module.exports =
       "displayType": "custom",
       "isVisible": true,
       "isRequired": false,
+      "isReconfigurable": false,
       "serviceName": "HDFS",
       "category": "Advanced"
     },

+ 0 - 6
ambari-web/app/mappers/jobs_mapper.js

@@ -38,17 +38,11 @@ App.jobsMapper = App.QuickDataMapper.create({
     job_name:'jobName',
     workflow_entity_name:'workflowEntityName',
     user_name:'userName',
-    $queue:'default',
-    $acls:5,
     conf_path:'confPath',
     submit_time:'submitTime',
     maps:'maps',
     reduces:'reduces',
     status:'status',
-    $priority:null,
-    $failed_maps:3,
-    $failed_reduces:3,
-    $job_counters:3,
     input:'inputBytes',
     output:'outputBytes',
     elapsed_time:'elapsedTime'

+ 1 - 3
ambari-web/app/messages.js

@@ -279,8 +279,6 @@ Em.I18n.translations = {
   'hosts.host.stop.popup.header':'Confirmation',
   'hosts.host.start.popup.body':'Are you sure?',
   'hosts.host.stop.popup.body':'Are you sure?',
-  'hosts.assignedToRack.popup.body':'Are you sure?',
-  'hosts.assignedToRack.popup.header':'Confirmation',
   'hosts.decommission.popup.body':'Are you sure?',
   'hosts.decommission.popup.header':'Confirmation',
   'hosts.delete.popup.body':'Are you sure?',
@@ -323,7 +321,7 @@ Em.I18n.translations = {
   'dashboard.services':'Services',
   'dashboard.services.hosts':'Hosts',
   'dashboard.services.uptime':'{0}',
-  'dashboard.services.hdfs.summary':'{0} of {1} nodes live, {2}% capacity free',
+  'dashboard.services.hdfs.summary':'{0} of {1} nodes live, {2}% capacity used',
   'dashboard.services.hdfs.nanmenode':'NameNode',
   'dashboard.services.hdfs.snanmenode':'Secondary NameNode',
   'dashboard.services.hdfs.capacity':'HDFS Disk Capacity',

+ 7 - 3
ambari-web/app/models/form.js

@@ -124,12 +124,16 @@ App.Form = Em.View.extend({
       });
     } else {
       if (this.get('className'))
-        App.store.createRecord(this.get('className'), this.getValues())
-      else
+      {
+        var rec = App.store.createRecord(this.get('className'), this.getValues());
+        //rec.get('stateManager').send('becameClean');
+      }
+      else{
         console.log("Please define class name for your form " + this.constructor);
+      }
     }
 
-    App.store.commit();
+    //App.store.commit();
     this.set('result', 1);
 
     return true;

+ 2 - 2
ambari-web/app/models/host.js

@@ -68,13 +68,13 @@ App.Host = DS.Model.extend({
    * Format diskUsed value to float with 2 digits (also convert to GB)
    */
   diskUsedFormatted: function() {
-    return Math.round(this.get('diskUsed') / (1024*1024*1024) * Math.pow(10, 2)) / Math.pow(10, 2) + 'GB';
+    return Math.round(this.get('diskUsed') * Math.pow(10, 2)) / Math.pow(10, 2) + 'GB';
   }.property('diskUsed'),
   /**
    * Format diskTotal value to float with 2 digits (also convert to GB)
    */
   diskTotalFormatted: function() {
-    return Math.round(this.get('diskTotal') / (1024*1024*1024) * Math.pow(10, 2)) / Math.pow(10, 2) + 'GB';
+    return Math.round(this.get('diskTotal') * Math.pow(10, 2)) / Math.pow(10, 2) + 'GB';
   }.property('diskTotal'),
   /**
    * Percent value of used disk space

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 1 - 48
ambari-web/app/models/job.js


+ 4 - 4
ambari-web/app/styles/application.less

@@ -2280,6 +2280,10 @@ ul.inline li {
   border-color: #D2D9DD;
   color: #4E575B;
   text-shadow: none;
+  .spinner {
+    padding: 8px 35px 8px 42px;
+    background: url(/img/spinner.gif) no-repeat;
+  }
 }
 
 /*
@@ -2303,10 +2307,6 @@ ul.inline li {
 }
 
 .modal-body {
-  .spinner {
-    padding: 8px 35px 8px 42px;
-    background: url(/img/spinner.gif) no-repeat;
-  }
   max-height: none;
 }
 

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

@@ -58,9 +58,7 @@
   #dataTable {
     table-layout: fixed;
     td {
-      &.appId {
-        word-wrap: break-word;
-      }
+      word-wrap: break-word;
     }
   }
 

+ 2 - 2
ambari-web/app/templates/main/apps/item/dag.hbs

@@ -36,8 +36,8 @@
         <td>{{job.workflowEntityName}}</td>
         <td>{{job.id}}</td>
         <td>{{job.status}}</td>
-        <td>{{job.maps}}&nbsp;({{job.mapsProgress}}%)</td>
-        <td>{{job.reduces}}&nbsp;({{job.reducesProgress}}%)</td>
+        <td>{{job.maps}}</td>
+        <td>{{job.reduces}}</td>
         <td>{{job.inputFormatted}}</td>
         <td>{{job.outputFormatted}}</td>
         <td>{{job.duration}}</td>

+ 1 - 1
ambari-web/app/templates/main/host/summary.hbs

@@ -30,7 +30,7 @@
 		      <dt>IP Address:</dt><dd>&nbsp;{{view.content.ip}}</dd>
           <dt>OS:</dt><dd>&nbsp;{{view.content.osType}}&nbsp;({{view.content.osArch}})</dd>
 		      <dt>CPU:</dt><dd>&nbsp;{{view.content.cpu}}</dd>
-          <dt>Disk:</dt><dd>&nbsp;{{view.content.diskUsageFormatted}}</dd>
+          <dt>Disk:</dt><dd>&nbsp;{{view.content.diskInfoBar}}</dd>
           <dt>Memory:</dt><dd>&nbsp;{{view.content.memoryFormatted}}</dd>
 		      <dt>Load Avg:</dt><dd>&nbsp;{{view.content.loadAvg}}</dd>
 		      <dt>Agent <br/> Heartbeat:</dt><dd>{{view.timeSinceHeartBeat}}</dd>

+ 1 - 1
ambari-web/app/utils/data_table.js

@@ -160,7 +160,7 @@ jQuery.extend($.fn.dataTableExt.afnFiltering.push(
         {iColumn: '0', elementId: 'star_filter', type: 'star'},
         {iColumn: '3', elementId: 'cpu_filter', type: 'number'},
         {iColumn: '6', elementId: 'load_avg_filter', type: 'number'},
-        {iColumn: '4', elementId: 'user_filter', type: 'multiple'},
+        {iColumn: '5', elementId: 'user_filter', type: 'multiple'},
         {iColumn: '9', elementId: 'components_filter', type: 'multiple'},
         {iColumn: '6', elementId: 'jobs_filter', type: 'number' },
         {iColumn: '4', elementId: 'ram_filter', type: 'ambari-bandwidth' },

+ 5 - 3
ambari-web/app/views/main/apps_view.js

@@ -268,9 +268,11 @@ App.MainAppsView = Em.View.extend({
    */
   updateStars: function() {
     var self = this;
-    $('#dataTable tbody tr').each(function(index) {
-      self.get('oTable').fnUpdate( $('#dataTable tbody tr:eq(' + index + ') td:eq(0)').html(), self.get('oTable').fnSettings()['aiDisplay'][index], 0);
-    });
+    if (this.get('oTable').fnSettings().fnRecordsDisplay()) {
+      $('#dataTable tbody tr').each(function(index) {
+        self.get('oTable').fnUpdate( $('#dataTable tbody tr:eq(' + index + ') td:eq(0)').html(), self.get('oTable').fnSettings()['aiDisplay'][index], 0);
+      });
+    }
   },
   /**
    * Reset filters and "turn off" stars

+ 8 - 39
ambari-web/app/views/main/host.js

@@ -95,46 +95,8 @@ App.MainHostView = Em.View.extend({
       //return "width:" + (25+Math.random()*50) + "%"; // Just for tests purposes
     }.property('content.diskUsage')
 
-//    HostCheckboxView:Em.Checkbox.extend({
-//      content:null,
-//      isChecked:false,
-//      change:function (event) {
-//        this.set('isChecked', !this.get('content.isChecked'));
-//        App.router.get('mainHostController').onHostChecked(this.get('content'));
-//      }
-//    })
   }),
 
-  RackCombobox:App.Combobox.extend({
-    disabled:function () {
-      var selectedHostsIds = App.router.get('mainHostController.selectedHostsIds');
-
-      // when user apply assigning and hosts become unchecked, we need to clear textfield
-      if (!selectedHostsIds.length) {
-        this.clearTextFieldValue();
-      }
-
-      return !selectedHostsIds.length;
-
-    }.property('App.router.mainHostController.selectedHostsIds'),
-
-    recordArray:App.Cluster.find(),
-    placeholderText:Em.I18n.t('hosts.assignRack'),
-    selectionBinding:"App.router.mainHostController.selectedRack",
-    optionLabelPath:"content.clusterName",
-    optionValuePath:"content.id",
-    didInsertElement:function () {
-      this._super();
-      App.router.get('mainHostController').propertyDidChange('selectedHostsIds');
-    }
-  }),
-
-  assignRackButtonDisabled:function () {
-    var selectedHostsIds = App.router.get('mainHostController.selectedHostsIds');
-    var rack = App.router.get('mainHostController.selectedRack');
-    return (selectedHostsIds.length && rack && rack.constructor == 'App.Cluster') ? false : "disabled";
-  }.property('App.router.mainHostController.selectedHostsIds', 'App.router.mainHostController.selectedRack'),
-
   nameFilterView: Em.TextField.extend({
     classNames:['input-medium'],
     type:'text',
@@ -343,7 +305,6 @@ App.MainHostView = Em.View.extend({
                     '{{/each}}' +
                   '</ul>' +
                 '</li>' +
-              '</li>' +
             '</ul>' +
           '</li>' +
           '<li>' +
@@ -391,6 +352,14 @@ App.MainHostView = Em.View.extend({
         });
       }
     },
+
+    didInsertElement:function () {
+      if (this.get('controller.comeWithFilter')) {
+        this.applyFilter();
+        this.closeFilters();
+      }
+    },
+
     applyFilter:function() {
       var chosenComponents = new Array();
 

Niektoré súbory nie sú zobrazené, pretože je v týchto rozdielových dátach zmenené mnoho súborov