Skip to content

Commit

Permalink
[WIP] Always make complete updates (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamaradclimber authored Jan 25, 2022
1 parent 7f610e0 commit 3035a2d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/js/actions/AppsActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ var AppsActions = {
appId: appId
});

var url = `${config.apiURL}v2/apps/${appId}`;
var url = `${config.apiURL}v2/apps/${appId}?partialUpdate=false`;
if (force) {
url = url + "?force=true";
url = url + "&force=true";
}

this.request({
Expand Down
3 changes: 1 addition & 2 deletions src/js/components/AppVersionComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ var AppVersionComponent = React.createClass({

handleRollbackToAppVersion: function () {
var appVersion = this.props.appVersion;
var appDiff = AppVersionStore.getAppConfigDiff(appVersion.id, appVersion);
AppsActions.applySettingsOnApp(appVersion.id, appDiff);
AppsActions.applySettingsOnApp(appVersion.id, appVersion);
},

getButtonClassSet: function () {
Expand Down
3 changes: 1 addition & 2 deletions src/js/components/modals/AppModalComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,7 @@ var AppModalComponent = React.createClass({
const app = this.state.app;

if (this.props.editMode) {
let appDiff = AppVersionStore.getAppConfigDiff(app.id, app);
AppsActions.applySettingsOnApp(app.id, appDiff, true, this.state.force);
AppsActions.applySettingsOnApp(app.id, app, true, this.state.force);
} else {
AppsActions.createApp(app);
}
Expand Down
12 changes: 6 additions & 6 deletions src/test/scenarios/updateApplication.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("Update Application", function () {
// like the API would do.
// Indeed the payload isn't processed by the store yet.
nock(config.apiURL)
.put("/v2/apps//app-1")
.put("/v2/apps//app-1?partialUpdate=false")
.reply(200, {
"deploymentId": "deployment-that-applies-new-settings",
"version": "v2"
Expand All @@ -55,8 +55,8 @@ describe("Update Application", function () {

it("receives an apply error on bad data", function (done) {
nock(config.apiURL)
.put("/v2/apps//app-1")
.reply(400, {message: "apply bad data error"});
.put("/v2/apps//app-1?partialUpdate=false")
.reply(400, { message: "apply bad data error" });

AppsStore.once(AppsEvents.APPLY_APP_ERROR, function (error) {
expectAsync(function () {
Expand All @@ -77,7 +77,7 @@ describe("Update Application", function () {
// like the API would do.
// Indeed the payload isn't processed by the store yet.
nock(config.apiURL)
.put("/v2/apps//app-1")
.put("/v2/apps//app-1?partialUpdate=false")
.reply(200, {
"deploymentId": "deployment-that-applies-new-settings",
"version": "v2"
Expand All @@ -94,8 +94,8 @@ describe("Update Application", function () {

it("it passes isEditing-flag on error", function (done) {
nock(config.apiURL)
.put("/v2/apps//app-1")
.reply(400, {message: "apply bad data error"});
.put("/v2/apps//app-1?partialUpdate=false")
.reply(400, { message: "apply bad data error" });

AppsStore.once(AppsEvents.APPLY_APP_ERROR, function (error, isEditing) {
expectAsync(function () {
Expand Down

0 comments on commit 3035a2d

Please sign in to comment.