Skip to content

Commit

Permalink
Merge f368849 into 30e83cd
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierluigi Cau committed Apr 19, 2016
2 parents 30e83cd + f368849 commit 8c760d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
## Unversioned
### Fixed
- \#3790 - Remove Docker on submit if no image is provided
- \#3794 - Applications with Docker volumes are mistakenly treated as stateful
applications

## 1.1.2 - 2016-04-14
### Fixed
Expand Down
17 changes: 10 additions & 7 deletions src/js/mixins/AppActionsHandlerMixin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ var callErrorDialog = function (settings) {
});
};

var isStatefulApp = function (app) {
return app.container != null &&
app.container.volumes != null &&
app.container.volumes
.some(volume => volume.persistent != null || volume.external != null);
};

var AppActionsHandlerMixin = {
componentWillMount: function () {
if (this.props.model == null) {
Expand Down Expand Up @@ -197,9 +204,7 @@ var AppActionsHandlerMixin = {
if (instancesString != null && instancesString !== "") {
let instances = parseInt(instancesString, 10);

if (model.container != null && model.container.volumes != null &&
model.instances > instances
) {
if (isStatefulApp(model) && model.instances > instances) {
this.handleScaleDownVolumeApp(instances);
return;
}
Expand All @@ -218,7 +223,7 @@ var AppActionsHandlerMixin = {
actionButtonLabel: "Continue Scaling",
message: (
<div>
<div>Scaling down ${appId} will cause any existing local volumes to
<div>Scaling down {appId} will cause any existing local volumes to
be detached from destroyed instances. <a
href={ExternalLinks.LOCAL_VOLUMES}
target="_blank"
Expand Down Expand Up @@ -293,9 +298,7 @@ var AppActionsHandlerMixin = {
});

DialogStore.handleUserResponse(dialogId, () => {
if (model.container != null &&
model.container.volumes != null &&
model.container.volumes.length > 0) {
if (isStatefulApp(model) && model.instances > instances) {
this.handleScaleDownVolumeApp(0);
return;
}
Expand Down

0 comments on commit 8c760d8

Please sign in to comment.