Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add patch on connection creation #273

Merged
merged 3 commits into from
Apr 1, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/wirecloud/platform/static/js/wirecloud/Wiring.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,21 @@
privates.get(this).connections.push(connection);
}

// Create the conection on the server
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Missing tests (see js_tests/wirecloud/WiringSpec.js for more details).
  • This code make requests for persisting volatile connections when it shouldn't.
  • The commit option must disappear and the code should assume commit === true.
  • The createConnection method should return Promises.

var requestContent = [{
op: "add",
path: "/connections/-",
value: connection
}];
Wirecloud.io.makeRequest(Wirecloud.URLs.WIRING_ENTRY.evaluate({
workspace_id: this.workspace.id,
}), {
method: 'PATCH',
contentType: 'application/json-patch+json',
requestHeaders: {'Accept': 'application/json'},
postBody: JSON.stringify(requestContent)
})

return connection;
},

Expand Down