Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Roque
slapos.core
Commits
f16663c5
Commit
f16663c5
authored
Oct 01, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
slapos_jio: Support list of elements expressed with oneOf
See merge request
nexedi/slapos.core!248
parents
080d0b55
11fa88e4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_parameter_form_js.js
...age_module/rjs_gadget_erp5_page_slap_parameter_form_js.js
+35
-0
No files found.
master/bt5/slapos_jio/PathTemplateItem/web_page_module/rjs_gadget_erp5_page_slap_parameter_form_js.js
View file @
f16663c5
...
@@ -122,6 +122,37 @@
...
@@ -122,6 +122,37 @@
return
input
;
return
input
;
}
}
function
render_selection_oneof
(
json_field
,
default_value
)
{
var
input
=
document
.
createElement
(
"
select
"
),
option
=
document
.
createElement
(
"
option
"
),
optionz
;
input
.
size
=
1
;
option
.
value
=
""
;
if
(
default_value
===
undefined
)
{
option
.
selected
=
"
selected
"
;
}
input
.
appendChild
(
option
);
json_field
.
oneOf
.
forEach
(
function
(
element
,
index
)
{
if
((
element
[
'
const
'
]
!==
undefined
)
&&
(
element
.
title
!==
undefined
))
{
var
value
;
if
((
json_field
.
type
==
'
array
'
)
||
(
json_field
.
type
==
'
object
'
))
{
// Support for unusual types
value
=
JSON
.
stringify
(
element
[
'
const
'
]);
}
else
{
value
=
element
[
'
const
'
];
}
optionz
=
document
.
createElement
(
"
option
"
);
optionz
.
value
=
value
;
optionz
.
textContent
=
element
.
title
;
if
(
value
===
default_value
)
{
optionz
.
selected
=
"
selected
"
;
}
input
.
appendChild
(
optionz
);
}
});
return
input
;
}
function
render_textarea
(
json_field
,
default_value
,
data_format
)
{
function
render_textarea
(
json_field
,
default_value
,
data_format
)
{
var
input
=
document
.
createElement
(
"
textarea
"
);
var
input
=
document
.
createElement
(
"
textarea
"
);
if
(
default_value
!==
undefined
)
{
if
(
default_value
!==
undefined
)
{
...
@@ -141,6 +172,10 @@
...
@@ -141,6 +172,10 @@
return
render_selection
(
json_field
,
default_value
);
return
render_selection
(
json_field
,
default_value
);
}
}
if
(
json_field
.
oneOf
!==
undefined
)
{
return
render_selection_oneof
(
json_field
,
default_value
);
}
if
(
json_field
.
type
===
"
boolean
"
)
{
if
(
json_field
.
type
===
"
boolean
"
)
{
json_field
[
'
enum
'
]
=
[
true
,
false
];
json_field
[
'
enum
'
]
=
[
true
,
false
];
if
(
default_value
===
"
true
"
)
{
if
(
default_value
===
"
true
"
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment