Przeglądaj źródła

AMBARI-1025. Display total install and start services time on summary page and polish summary page ui. (Jaimin Jetly via yusaku)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/branches/AMBARI-666@1418961 13f79535-47bb-0310-9956-ffa450edef68
Yusaku Sako 12 lat temu
rodzic
commit
5ef37e1708

+ 3 - 0
AMBARI-666-CHANGES.txt

@@ -420,6 +420,9 @@ AMBARI-666 branch (unreleased changes)
 
   IMPROVEMENTS
 
+  AMBARI-1025. Display total install and start services time on summary page
+  and polish summary page ui. (Jaimin Jetly via yusaku)
+
   AMBARI-1023. Dashboard page should handle API sending JSON as strings and
   object. (Srimanth Gunturi via yusaku)
 

+ 5 - 4
ambari-web/app/controllers/installer.js

@@ -239,7 +239,9 @@ App.InstallerController = Em.Controller.extend({
       name: App.db.getClusterName() || "",
       status: cStatus.status,
       isCompleted: cStatus.isCompleted,
-      requestId: cStatus.requestId
+      requestId: cStatus.requestId,
+      installStartTime: cStatus.installStartTime,
+      installTime: cStatus.installTime
     };
     this.set('content.cluster', cluster);
 
@@ -785,19 +787,18 @@ App.InstallerController = Em.Controller.extend({
       timeout: App.timeout,
       success: function (data) {
         var jsonData = jQuery.parseJSON(data);
-        var installSartTime = new Date().getTime();
+        var installStartTime = new Date().getTime();
         console.log("TRACE: In success function for the installService call");
         console.log("TRACE: value of the url is: " + url);
         if (jsonData) {
           var requestId = jsonData.href.match(/.*\/(.*)$/)[1];
-
           console.log('requestId is: ' + requestId);
           var clusterStatus = {
             status: 'PENDING',
             requestId: requestId,
             isInstallError: false,
             isCompleted: false,
-            installStartTime: installSartTime
+            installStartTime: installStartTime
           };
           self.saveClusterStatus(clusterStatus);
         } else {

+ 32 - 5
ambari-web/app/controllers/wizard/step10_controller.js

@@ -48,6 +48,7 @@ App.WizardStep10Controller = Em.Controller.extend({
     var registerHostsStatement = registeredHosts.length + ' hosts registered to the cluster.';
     var registerHostsObj = Ember.Object.create({
       id: 1,
+      color: 'text-info',
       displayStatement: registerHostsStatement,
       status: []
     });
@@ -74,6 +75,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       }
       this.get('clusterInfo').findProperty('id', 1).get('status').pushObject(Ember.Object.create({
         id: 1,
+        color: 'text-success',
         displayStatement: successStatement
       }));
     }
@@ -82,6 +84,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       var warnStatement = warnedHosts.length + ' warnings';
       this.get('clusterInfo').findProperty('id', 1).get('status').pushObject(Ember.Object.create({
         id: 2,
+        color: 'text-warning',
         displayStatement: warnStatement,
         statements: []
       }));
@@ -98,9 +101,9 @@ App.WizardStep10Controller = Em.Controller.extend({
         var failedTasks = _host.tasks.filterProperty('Tasks.status', 'FAILED');
         failedTasks.forEach(function (_task) {
           var taskStatement = clusterState + _task.Tasks.role + ' failed on ' + _host.name;
-          console.log('Over here in SUMMARY page...');
           this.get('clusterInfo').findProperty('id', 1).get('status').findProperty('id', 2).get('statements').pushObject(Ember.Object.create({
             status: 'failed',
+            color: 'text-info',
             displayStatement: taskStatement
           }));
         }, this);
@@ -110,6 +113,7 @@ App.WizardStep10Controller = Em.Controller.extend({
           var abortStatement = clusterState + _task.Tasks.role + ' aborted on ' + _host.name;
           this.get('clusterInfo').findProperty('id', 1).get('status').findProperty('id', 2).get('statements').pushObject(Ember.Object.create({
             status: 'aborted',
+            color: 'text-info',
             displayStatement: abortStatement
           }));
         }, this);
@@ -119,6 +123,7 @@ App.WizardStep10Controller = Em.Controller.extend({
           var abortStatement = clusterState + _task.Tasks.role + ' timed out on ' + _host.name;
           this.get('clusterInfo').findProperty('id', 1).get('status').findProperty('id', 2).get('statements').pushObject(Ember.Object.create({
             status: 'timedout',
+            color: 'text-info',
             displayStatement: timedOutTasks
           }));
         }, this);
@@ -133,6 +138,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       this.get('clusterInfo').pushObject(Ember.Object.create({
         id: 2,
         displayStatement: 'Installing master services failed',
+        color: 'text-error',
         status: []
       }));
       return false;
@@ -140,6 +146,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       this.get('clusterInfo').pushObject(Ember.Object.create({
         id: 2,
         displayStatement: 'Master services installed',
+        color: 'text-success',
         status: []
       }));
     }
@@ -186,6 +193,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       var statement = 'NameNode installed on ' + component.get('hostName');
       this.get('clusterInfo').findProperty('id', 2).get('status').pushObject(Ember.Object.create({
         id: 1,
+        color: 'text-info',
         displayStatement: statement
       }));
     } else {
@@ -198,6 +206,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       var statement = 'SecondaryNameNode installed on ' + component.get('hostName');
       this.get('clusterInfo').findProperty('id', 2).get('status').pushObject(Ember.Object.create({
         id: 1,
+        color: 'text-info',
         displayStatement: statement
       }));
     } else {
@@ -210,6 +219,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       var statement = 'JobTracker installed on ' + component.get('hostName');
       this.get('clusterInfo').findProperty('id', 2).get('status').pushObject(Ember.Object.create({
         id: 1,
+        color: 'text-info',
         displayStatement: statement
       }));
     } else {
@@ -229,6 +239,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       var statement = 'ZooKeeper installed on ' + component.get('hostName').length + ' ' + hostVal;
       this.get('clusterInfo').findProperty('id', 2).get('status').pushObject(Ember.Object.create({
         id: 1,
+        color: 'text-info',
         displayStatement: statement
       }));
     } else {
@@ -241,6 +252,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       var statement = 'HBase Master installed on ' + component.get('hostName');
       this.get('clusterInfo').findProperty('id', 2).get('status').pushObject(Ember.Object.create({
         id: 1,
+        color: 'text-info',
         displayStatement: statement
       }));
     } else {
@@ -253,6 +265,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       var statement = 'Hive Metastore installed on ' + component.get('hostName');
       this.get('clusterInfo').findProperty('id', 2).get('status').pushObject(Ember.Object.create({
         id: 1,
+        color: 'text-info',
         displayStatement: statement
       }));
     } else {
@@ -265,6 +278,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       var statement = 'Hive Metastore installed on ' + component.get('hostName');
       this.get('clusterInfo').findProperty('id', 2).get('status').pushObject(Ember.Object.create({
         id: 1,
+        color: 'text-info',
         displayStatement: statement
       }));
     } else {
@@ -277,6 +291,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       var statement = 'Ganglia Server installed on ' + component.get('hostName');
       this.get('clusterInfo').findProperty('id', 2).get('status').pushObject(Ember.Object.create({
         id: 1,
+        color: 'text-info',
         displayStatement: statement
       }));
     } else {
@@ -289,6 +304,7 @@ App.WizardStep10Controller = Em.Controller.extend({
       var statement = 'Nagios Server installed on ' + component.get('hostName');
       this.get('clusterInfo').findProperty('id', 2).get('status').pushObject(Ember.Object.create({
         id: 1,
+        color: 'text-info',
         displayStatement: statement
       }));
     } else {
@@ -298,14 +314,16 @@ App.WizardStep10Controller = Em.Controller.extend({
 
   loadStartedServices: function (component) {
     if (this.get('content.cluster.status') === 'STARTED') {
-      var statement = 'All services started'
+      var statement = 'All services started';
       this.get('clusterInfo').pushObject(Ember.Object.create({
         id: 3,
+        color: 'text-success',
         displayStatement: 'All services started',
         status: []
       }));
       this.get('clusterInfo').pushObject(Ember.Object.create({
         id: 4,
+        color: 'text-success',
         displayStatement: 'All tests passed',
         status: []
       }));
@@ -313,6 +331,7 @@ App.WizardStep10Controller = Em.Controller.extend({
     } else {
       this.get('clusterInfo').pushObject(Ember.Object.create({
         id: 3,
+        color: 'text-error',
         displayStatement: 'Starting services failed',
         status: []
       }));
@@ -321,16 +340,24 @@ App.WizardStep10Controller = Em.Controller.extend({
   },
 
   loadInstallTime: function () {
+    var secondsPerMinute = 60;
+    var statement;
     if (this.get('content.cluster.installTime')) {
-      var statement = 'Install and start of all services completed in ' + this.get('content.cluster.installTime') + ' minutes';
+      var minutes = Math.floor(this.get('content.cluster.installTime'));
+      var seconds = Math.floor((this.get('content.cluster.installTime') - minutes) * secondsPerMinute);
+      var statement;
+      if (minutes !== 0) {
+        statement = 'Install and start of all services completed in ' + minutes + ' minutes and ' + seconds + ' seconds';
+      } else {
+        statement = 'Install and start of all services completed in ' + seconds + ' seconds';
+      }
       this.get('clusterInfo').pushObject(Ember.Object.create({
         id: 5,
+        color: 'text-info',
         displayStatement: statement,
         status: []
       }));
     }
   }
-
-
 });
 

+ 18 - 17
ambari-web/app/controllers/wizard/step7_controller.js

@@ -72,23 +72,25 @@ App.WizardStep7Controller = Em.Controller.extend({
     var serviceConfigs = this.get('serviceConfigs');
     var advancedConfig = this.get('content.advancedServiceConfig');
     advancedConfig.forEach(function (_config) {
-      var service = serviceConfigs.findProperty('serviceName', _config.serviceName);
-      if (service) {
-        if (this.get('configMapping').someProperty('name', _config.name)) {
-        } else if (!(service.configs.someProperty('name', _config.name))) {
-          _config.id = "site property";
-          _config.category = 'Advanced';
-          _config.displayName = _config.name;
-          _config.defaultValue = _config.value;
-          if (/\${.*}/.test(_config.value) || (service.serviceName !== 'OOZIE' && service.serviceName !== 'HBASE')) {
-            _config.isRequired = false;
-            _config.value = '';
-          } else if(/^\s+$/.test(_config.value)){
-            _config.isRequired = false;
+      if (_config) {
+        var service = serviceConfigs.findProperty('serviceName', _config.serviceName);
+        if (service) {
+          if (this.get('configMapping').someProperty('name', _config.name)) {
+          } else if (!(service.configs.someProperty('name', _config.name))) {
+            _config.id = "site property";
+            _config.category = 'Advanced';
+            _config.displayName = _config.name;
+            _config.defaultValue = _config.value;
+            if (/\${.*}/.test(_config.value) || (service.serviceName !== 'OOZIE' && service.serviceName !== 'HBASE')) {
+              _config.isRequired = false;
+              _config.value = '';
+            } else if (/^\s+$/.test(_config.value)) {
+              _config.isRequired = false;
+            }
+            _config.isVisible = true;
+            _config.displayType = 'advanced';
+            service.configs.pushObject(_config);
           }
-          _config.isVisible = true;
-          _config.displayType = 'advanced';
-          service.configs.pushObject(_config);
         }
       }
     }, this);
@@ -117,7 +119,6 @@ App.WizardStep7Controller = Em.Controller.extend({
   },
 
 
-
   /**
    * Render a custom conf-site box for entering properties that will be written in *-site.xml files of the services
    */

+ 10 - 9
ambari-web/app/controllers/wizard/step9_controller.js

@@ -228,6 +228,7 @@ App.WizardStep9Controller = Em.Controller.extend({
           name: clusterName,
           status: 'INSTALLED',
           requestId: requestId,
+          installStartTime: self.get('content.cluster').installStartTime,
           isStartError: false,
           isCompleted: false
         };
@@ -240,6 +241,7 @@ App.WizardStep9Controller = Em.Controller.extend({
         var clusterStatus = {
           name: clusterName,
           status: 'START FAILED',
+          installStartTime: self.get('content.cluster').installStartTime,
           isStartError: true,
           isCompleted: false
         };
@@ -346,9 +348,9 @@ App.WizardStep9Controller = Em.Controller.extend({
   setHostsStatus: function (hostNames, status) {
     hostNames.forEach(function (_hostName) {
       var host = this.hosts.findProperty('name', _hostName);
-      if(host){
+      if (host) {
         host.set('status', status)
-            .set('progress', '100');
+          .set('progress', '100');
       }
     }, this);
   },
@@ -369,7 +371,7 @@ App.WizardStep9Controller = Em.Controller.extend({
         if (this.isSuccess(polledData)) {
           clusterStatus.status = 'STARTED';
           var serviceStartTime = new Date().getTime();
-          var timeToStart = Math.floor((serviceStartTime - this.get('content.cluster.installStartTime')) / 60000);
+          var timeToStart = ((parseInt(serviceStartTime) - parseInt(this.get('content.cluster.installStartTime'))) / 60000).toFixed(2);
           clusterStatus.installTime = timeToStart;
           this.set('status', 'success');
         } else {
@@ -390,7 +392,7 @@ App.WizardStep9Controller = Em.Controller.extend({
         clusterStatus = {
           status: 'PENDING',
           requestId: requestId,
-          isCompleted: true,
+          isCompleted: false,
           installStartTime: this.get('content.cluster.installStartTime')
         }
         if (this.isStepFailed(polledData)) {
@@ -467,8 +469,7 @@ App.WizardStep9Controller = Em.Controller.extend({
     this.hosts.forEach(function (_host) {
       var actionsPerHost = tasksData.filterProperty('Tasks.host_name', _host.name); // retrieved from polled Data
       if (actionsPerHost.length === 0) {
-        //alert('For testing with mockData follow the sequence: hit referesh,"mockData btn", "pollData btn", again "pollData btn"');
-        //exit();
+        console.log("Error: No task is hosted on the host");
       }
       if (actionsPerHost !== null && actionsPerHost !== undefined && actionsPerHost.length !== 0) {
         this.setLogTasksStatePerHost(actionsPerHost, _host);
@@ -509,10 +510,10 @@ App.WizardStep9Controller = Em.Controller.extend({
       this.POLL_INTERVAL = 1;
       this.numPolls++;
       if (this.numPolls == 5) {
-        url = 'data/wizard/deploy/multi_5.json';
-        //url = 'data/wizard/deploy/poll_5_failed.json';
+        url = 'data/wizard/deploy/poll_5.json';
+        // url = 'data/wizard/deploy/poll_5_failed.json';
       } else {
-        url = 'data/wizard/deploy/multi_' + this.numPolls + '.json';
+        url = 'data/wizard/deploy/poll_' + this.numPolls + '.json';
       }
       debugger;
     }

+ 3 - 3
ambari-web/app/templates/wizard/step10.hbs

@@ -23,13 +23,13 @@
 <div id="step10-content" class="well pre-scrollable">
   {{#each item in clusterInfo}}
   <ul>
-    {{item.displayStatement}}
+    <span {{bindAttr class="item.color"}}>{{item.displayStatement}}</span>
     {{#each status in item.status}}
     <ul>
-      {{status.displayStatement}}
+      <span {{bindAttr class="status.color"}}>{{status.displayStatement}}</span>
       {{#each statement in status.statements}}
       <ul>
-        {{statement.displayStatement}}
+        <span {{bindAttr class="status.color"}}>{{statement.displayStatement}}</span>
       </ul>
       {{/each}}
     </ul>