Updated Branches: refs/heads/trunk 0a7c5d7a7 -> 21b02ef5c
AMBARI-3057 Need more graceful handling of the start phase of Install Wizard/Add Host Wizard. (Andrii Babiichuk via atkach) Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/21b02ef5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/21b02ef5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/21b02ef5 Branch: refs/heads/trunk Commit: 21b02ef5c760457d0a7e4eddaea930ceae553324 Parents: 0a7c5d7 Author: atkach <[email protected]> Authored: Tue Sep 3 19:57:39 2013 +0300 Committer: atkach <[email protected]> Committed: Tue Sep 3 19:57:39 2013 +0300 ---------------------------------------------------------------------- .../app/controllers/wizard/step9_controller.js | 59 +++++++++++++++----- ambari-web/app/templates/main/host/summary.hbs | 6 +- 2 files changed, 48 insertions(+), 17 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/21b02ef5/ambari-web/app/controllers/wizard/step9_controller.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/wizard/step9_controller.js b/ambari-web/app/controllers/wizard/step9_controller.js index a4cecc0..e63fa5a 100644 --- a/ambari-web/app/controllers/wizard/step9_controller.js +++ b/ambari-web/app/controllers/wizard/step9_controller.js @@ -16,6 +16,7 @@ * limitations under the License. */ var App = require('app'); +var serviceComponents = require('data/service_components'); App.WizardStep9Controller = Em.Controller.extend({ name: 'wizardStep9Controller', @@ -379,26 +380,56 @@ App.WizardStep9Controller = Em.Controller.extend({ }, launchStartServicesSuccessCallback: function (jsonData) { - console.log("TRACE: Step9 -> In success function for the startService call"); - console.log("TRACE: Step9 -> value of the received data is: " + jsonData); - var requestId = jsonData.Requests.id; - console.log('requestId is: ' + requestId); - var clusterStatus = { - status: 'INSTALLED', - requestId: requestId, - isStartError: false, - isCompleted: false - }; - - App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus); - + if (jsonData) { + console.log("TRACE: Step9 -> In success function for the startService call"); + console.log("TRACE: Step9 -> value of the received data is: " + jsonData); + var requestId = jsonData.Requests.id; + console.log('requestId is: ' + requestId); + var clusterStatus = { + status: 'INSTALLED', + requestId: requestId, + isStartError: false, + isCompleted: false + }; + this.hostHasClientsOnly(false); + App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus); + } else { + console.log('ERROR: Error occurred in parsing JSON data'); + this.hostHasClientsOnly(true); + var clusterStatus = { + status: 'STARTED', + isStartError: false, + isCompleted: true + }; + App.router.get(this.get('content.controllerName')).saveClusterStatus(clusterStatus); + this.set('status', 'success'); + this.set('progress', '100'); + this.set('isStepCompleted', true); + } // We need to do recovery if there is a browser crash App.clusterStatus.setClusterStatus({ clusterState: 'SERVICE_STARTING_3', localdb: App.db.data }); - this.startPolling(); + if(jsonData) { + this.startPolling(); + } + }, + + hostHasClientsOnly: function(jsonError) { + this.hosts.forEach(function(host){ + var OnlyClients = true; + var tasks = host.get('logTasks'); + tasks.forEach(function(task){ + var component = serviceComponents.findProperty('component_name',task.Tasks.role); + (component && component.isClient) ? null : OnlyClients = false; + }); + if (OnlyClients || jsonError) { + host.set('status', 'success'); + host.set('progress', '100'); + } + }); }, launchStartServicesErrorCallback: function () { http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/21b02ef5/ambari-web/app/templates/main/host/summary.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/host/summary.hbs b/ambari-web/app/templates/main/host/summary.hbs index cf22495..d35f511 100644 --- a/ambari-web/app/templates/main/host/summary.hbs +++ b/ambari-web/app/templates/main/host/summary.hbs @@ -24,8 +24,8 @@ <div class="box-header"> <h4>{{t common.components}}</h4> </div> - {{#if view.sortedComponents.length}} <div class="host-components"> + {{#if view.sortedComponents.length}} {{#each component in view.sortedComponents}} <div class="row-fluid"> {{#view view.ComponentView contentBinding="component" decommissionDataNodeHostNamesBinding="view.decommissionDataNodeHostNames"}} @@ -108,6 +108,7 @@ {{/view}} </div> {{/each}} + {{/if}} {{!clients and add component button}} <div class="clients row-fluid"> <div class="span7 row"> @@ -147,7 +148,6 @@ </div> </div> </div> - {{/if}} </div> <div class="host-configuration"> <div class="box"> @@ -184,4 +184,4 @@ </div> </div> </div> -</div> \ No newline at end of file +</div>
