diff --git a/app/templates/deployer-bar-summary.handlebars b/app/templates/deployer-bar-summary.handlebars index 75a0fb41ef..9660937a8b 100644 --- a/app/templates/deployer-bar-summary.handlebars +++ b/app/templates/deployer-bar-summary.handlebars @@ -1,6 +1,16 @@

Confirm your changes

+ {{#if conflictedServiceCount}} +
+

You have {{conflictedServiceCount}} {{pluralize 'service' conflictedServiceCount}} with conflicted configurations. Click the links below to visit the services inspectors to resolve these conflicts to continue.

+ +
+ {{/if}} {{#if unplacedCount}}

You have {{unplacedCount}} unplaced {{pluralize 'unit' unplacedCount}}, do you want to:

diff --git a/app/widgets/deployer-bar.js b/app/widgets/deployer-bar.js index c677c34d9c..07aae4d4d8 100644 --- a/app/widgets/deployer-bar.js +++ b/app/widgets/deployer-bar.js @@ -93,6 +93,9 @@ YUI.add('deployer-bar', function(Y) { '.view-machines': { click: '_viewMachines' }, + '.resolve-conflict': { + click: '_showInspectorConfig' + }, '.commit-onboarding .close': { click: '_hideCommitOnboarding' } @@ -148,6 +151,9 @@ YUI.add('deployer-bar', function(Y) { */ deploy: function(evt) { evt.halt(); + if (evt.currentTarget.hasClass('disabled')) { + return; + } var container = this.get('container'), ecs = this.get('ecs'), autodeploy = container.one('input[value="autodeploy"]'); @@ -286,6 +292,21 @@ YUI.add('deployer-bar', function(Y) { return !db.services.getById(unit.service).get('subordinate'); }).length; + var conflictedServices = []; + db.services.each(function(service) { + if (service.get('_conflictedFields').length > 0) { + conflictedServices.push(service.getAttrs()); + } + }); + // We do not allow people to commit their config changes if there are + // conflicted config values. + var confirmButton = container.one('.confirm-button'); + if (conflictedServices.length > 0) { + confirmButton.addClass('disabled'); + } else { + confirmButton.removeClass('disabled'); + } + if (container && container.get('parentNode')) { container.one('.panel.summary section').setHTML(this.summaryTemplate({ changeCount: this._getChangeCount(ecs), @@ -301,7 +322,9 @@ YUI.add('deployer-bar', function(Y) { destroyedMachines: changes.destroyMachines, configsChanged: changes.setConfigs, majorChange: this._hasMajorChanges(changes), - unplacedCount: unplacedCount + unplacedCount: unplacedCount, + conflictedServiceCount: conflictedServices.length, + conflictedServices: conflictedServices })); } container.addClass('summary-open'); @@ -441,6 +464,7 @@ YUI.add('deployer-bar', function(Y) { Toggle the status of the deploy button. @method _toggleDeployButtonStatus + @param {Boolean} enabled Whether the commit button should be active. */ _toggleDeployButtonStatus: function(enabled) { if (enabled) { @@ -862,6 +886,26 @@ YUI.add('deployer-bar', function(Y) { }); }, + /** + Closes the summary and opens the inspector that the user clicked on to + resolve config conflicts. + + @method _showInspectorconfig + @param {Object} e The click event facade. + */ + _showInspectorConfig: function(e) { + e.halt(); + this.hideSummary(e); + this.fire('changeState', { + sectionA: { + component: 'inspector', + metadata: { + id: e.currentTarget.getAttribute('service') + } + } + }); + }, + /** Optionally show the onboarding message for the commit button.