Commit 97b89618 authored by Jérome Perrin's avatar Jérome Perrin Committed by Cédric Le Ninivin

fixup! fixup! test_result: proto of parameter editor gadget

parent 618eb3db
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<script src="./react.production.min.js" type="text/javascript"></script> <script src="./react.production.min.js" type="text/javascript"></script>
<script src="./react-dom.production.min.js" type="text/javascript"></script> <script src="./react-dom.production.min.js" type="text/javascript"></script>
<script src="./react-jsonschema-form-workaround-2503.js" type="text/javascript"></script>
<script src="./react-jsonschema-form.js" type="text/javascript"></script> <script src="./react-jsonschema-form.js" type="text/javascript"></script>
<script src="./ref-parser.min.js" type="text/javascript"></script> <script src="./ref-parser.min.js" type="text/javascript"></script>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
(function (window, rJS, RSVP, document) { (function (window, rJS, RSVP, document) {
'use strict'; 'use strict';
/** /**
* Prepare a ui-schema from the conventions of SlapOS instance parameters schema. * Prepare a ui-schema from the conventions of SlapOS instance parameters schema.
* This does the following: * This does the following:
* - remove `default` from schema. In SlapOS schemas we use `default` as a documentation * - remove `default` from schema. In SlapOS schemas we use `default` as a documentation
...@@ -27,16 +27,9 @@ function makeUiSchema(schema, uiSchema, visited) { ...@@ -27,16 +27,9 @@ function makeUiSchema(schema, uiSchema, visited) {
if (schema.properties) { if (schema.properties) {
for (const [key, value] of Object.entries(schema.properties)) { for (const [key, value] of Object.entries(schema.properties)) {
uiSchema[key] = {}; uiSchema[key] = {};
if (value.default) { if (value.default && !(value.default instanceof Object)) {
if (key == 'tcpv4-port') {
console.log(key, value);
}
/** XXX value.const ... isn't it a bug in ERP5 SR schema ? */
if (value?.type === 'string' && value.const === undefined) { if (value?.type === 'string' && value.const === undefined) {
uiSchema[key]['ui:placeholder'] = value.default; uiSchema[key]['ui:placeholder'] = value.default;
} else {
// XXX seems ugly
// uiSchema[key]['ui:help'] = `Default value: ${value.default}`
} }
if (value.const === undefined) { if (value.const === undefined) {
delete value.default; delete value.default;
...@@ -79,10 +72,6 @@ function makeUiSchema(schema, uiSchema, visited) { ...@@ -79,10 +72,6 @@ function makeUiSchema(schema, uiSchema, visited) {
.dereference(modification_dict.schema_url) .dereference(modification_dict.schema_url)
.then(function (schema) { .then(function (schema) {
let uiSchema = {}; let uiSchema = {};
// TODO: wouldn't using mergeAllOf here solve the problem of
// ERP5's kumofs default port
schema = JSONSchemaForm.utils.retrieveSchema(schema);
makeUiSchema(schema, uiSchema, new Set()) makeUiSchema(schema, uiSchema, new Set())
console.log('after simplification', schema, uiSchema); console.log('after simplification', schema, uiSchema);
......
// XXX (jerome) workaround https://github.com/rjsf-team/react-jsonschema-form/issues/2503
window.react = React;
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>react-jsonschema-form-workaround-2503.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment