Commit 38ebc695 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 54f39f5a
......@@ -7,6 +7,7 @@
<script src="./react.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="./ref-parser.min.js" type="text/javascript"></script>
......
......@@ -3,7 +3,7 @@
(function (window, rJS, RSVP, document) {
'use strict';
/**
/**
* Prepare a ui-schema from the conventions of SlapOS instance parameters schema.
* This does the following:
* - remove `default` from schema. In SlapOS schemas we use `default` as a documentation
......@@ -27,16 +27,9 @@ function makeUiSchema(schema, uiSchema, visited) {
if (schema.properties) {
for (const [key, value] of Object.entries(schema.properties)) {
uiSchema[key] = {};
if (value.default) {
if (key == 'tcpv4-port') {
console.log(key, value);
}
/** XXX value.const ... isn't it a bug in ERP5 SR schema ? */
if (value.default && !(value.default instanceof Object)) {
if (value?.type === 'string' && value.const === undefined) {
uiSchema[key]['ui:placeholder'] = value.default;
} else {
// XXX seems ugly
// uiSchema[key]['ui:help'] = `Default value: ${value.default}`
}
if (value.const === undefined) {
delete value.default;
......@@ -79,10 +72,6 @@ function makeUiSchema(schema, uiSchema, visited) {
.dereference(modification_dict.schema_url)
.then(function (schema) {
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())
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