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

DATAREST-721 - Show input fields for associations in CustomPostForm … #277

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
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
6 changes: 6 additions & 0 deletions spring-data-rest-hal-browser/pom.xml
Original file line number Diff line number Diff line change
@@ -155,6 +155,12 @@
<replacevalue>The HAL Browser (for Spring Data REST)</replacevalue>
</replacefilter>
</replace>
<replace file="${project.build.outputDirectory}/META-INF/spring-data-rest/hal-browser/login.html">
<replacefilter>
<replacetoken>browser.html</replacetoken>
<replacevalue>index.html</replacevalue>
</replacefilter>
</replace>
<delete file="${project.build.outputDirectory}/META-INF/spring-data-rest/hal-browser/browser.html" />
</target>
</configuration>
Original file line number Diff line number Diff line change
@@ -2,13 +2,17 @@
* Custom Backbone view that uses JSON Schema metadata to create pop-up dialog with actual field names instead of
* asking user to input raw JSON.
*
* NOTE: Because JSON Schema lists all properties, including those that are links, they have to be filtered out.
* Links have to be set via a PUT operation with the proper media type.
* NOTE: Links to other resources are shown as simple text fields. The user is responsible for inserting the correct URI.
* For '* to many' associations, it is currently only possible to insert ONE URI.
* Additional links have to be set via POST/PUT/PATCH operations with the proper media type.
* Jackson has to be configured properly for this to work (set spring.jackson.deserialization.accept-empty-string-as-null-object and
* spring.jackson.deserialization.accept-single-value-as-array to true).
*
* @author Greg Turnquist
* @author Gregory Frank
* @author Marcel Kauf
* @since 2.4
* @see DATAREST-627, DATAREST-1077
* @see DATAREST-627, DATAREST-1077, DATAREST-721
*/
/* jshint strict: true */
/* globals HAL, Backbone, _, $, window, jqxhr */
@@ -108,16 +112,6 @@ var CustomPostForm = Backbone.View.extend({
loadJsonEditor: function (schema) {
var self = this;

/**
* Remove URI-based fields since this dialog doesn't handle relationships.
*/
Object.keys(schema.properties).forEach(function (property) {
if (schema.properties[property].hasOwnProperty('format') &&
schema.properties[property].format === 'uri') {
delete schema.properties[property];
}
});

/**
* See https://github.com/jdorn/json-editor#options for more customizing options.
*/
@@ -200,4 +194,4 @@ var CustomPostForm = Backbone.View.extend({
/**
* Inject the form into the HAL Browser.
*/
HAL.customPostForm = CustomPostForm;
HAL.customPostForm = CustomPostForm;