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
Łukasz Nowak
slapos.core
Commits
1dd08722
Commit
1dd08722
authored
Apr 08, 2015
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_web: set default values on selection boxes and comment debug logs.
parent
64175d1c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
16 deletions
+27
-16
master/bt5/slapos_web/PathTemplateItem/web_page_module/rjs_slapos_parameter_form_js.xml
...lateItem/web_page_module/rjs_slapos_parameter_form_js.xml
+27
-16
No files found.
master/bt5/slapos_web/PathTemplateItem/web_page_module/rjs_slapos_parameter_form_js.xml
View file @
1dd08722
...
...
@@ -140,20 +140,25 @@
);\n
}\n
\n
function render_selection(json_field) {\n
function render_selection(json_field
, default_value
) {\n
var input = document.createElement("select"),\n
option = document.createElement("option"),\n
option_index,\n
optionz;\n
input.size = 1;\n
option.selected = "selected";\n
option.value = "";\n
if (default_value === undefined) {\n
option.selected = "selected";\n
}\n
input.appendChild(option);\n
for (option_index in json_field.enum) {\n
if (json_field.enum.hasOwnProperty(option_index)) {\n
optionz = document.createElement("option");\n
optionz.value = json_field.enum[option_index];\n
optionz.textContent = json_field.enum[option_index];\n
if (json_field.enum[option_index] === default_value) {\n
optionz.selected = "selected";\n
}\n
input.appendChild(optionz);\n
}\n
}\n
...
...
@@ -163,12 +168,12 @@
function render_field(json_field, default_value) {\n
\n
if (json_field.enum !== undefined) {\n
return render_selection(json_field);\n
return render_selection(json_field
, default_value
);\n
}\n
\n
if (json_field.type === "boolean") {\n
json_field.enum = [true, false];\n
return render_selection(json_field);\n
return render_selection(json_field
, default_value
);\n
}\n
\n
var input = document.createElement("input");\n
...
...
@@ -254,7 +259,8 @@
}\n
root.appendChild(div);\n
\n
return root;\n
\n
return div;\n
}\n
}\n
\n
...
...
@@ -313,7 +319,7 @@
}\n
}\n
});\n
console.log(json_dict);\n
//
console.log(json_dict);\n
\n
function convertOnMultiLevel(key, value, d) {\n
var i,\n
...
...
@@ -376,7 +382,7 @@
i,\n
promise_list =
[];\n
\n
console.log("INITIATING
A
LOOP
EVENT
LISTENER");\n
//
console.log("INITIATING
A
LOOP
EVENT
LISTENER");\n
\n
for
(
i =
0;
i
<
field_list.length;
i =
i
+
1)
{\n
promise_list.push(loopEventListener(\n
...
...
@@ -477,7 +483,7 @@
xml_output =
jsonDictToParameterXML(json_dict);\n
}\n
parameter_hash_input.value =
btoa(xml_output);\n
console.log(parameter_hash_input.value);\n
//
console.log(parameter_hash_input.value);\n
if
(validation.valid)
{\n
return
xml_output;\n
}\n
...
...
@@ -554,11 +560,16 @@
if
(
options.json_url =
==
undefined)
{\n
throw
new
Error("undefined
json_url");\n
}\n
console.log("CALLED
RENDER");\n
//
console.log("CALLED
RENDER");\n
var
g =
this,\n
softwaretype;\n
\n
this.options =
options;\n
\n
function
updateParameterForm(evt)
{\n
options.parameter.softwaretype =
evt.srcElement.value;\n
return
g.render(options);\n
}\n
\n
return
g.loadSoftwareJSON(g.options.json_url).push(function
(json)
{\n
var
option_index,\n
...
...
@@ -636,17 +647,17 @@
prefix =
options.json_url.split(json_url_uri.path())[0]
+
prefix.join("/");\n
parameter_json_schema_url =
prefix
+
"/"
+
parameter_json_schema_url;\n
}\n
console.log("GOING
TO
RENDER
FORM");\n
//
console.log("GOING
TO
RENDER
FORM");\n
return
g.renderParameterForm(parameter_json_schema_url,
parameter_dict);\n
})\n
.push(function
()
{\n
console.log("FINISHED
TO
RENDER,
RETURNING
THE
GADGET");\n
//
console.log("FINISHED
TO
RENDER,
RETURNING
THE
GADGET");\n
return
g;\n
})\n
\n
.fail(function
(error)
{\n
var
parameter_xml =
\'\';\n
console.log("FAIL
CALLED");\n
//
console.log("FAIL
CALLED");\n
console.log(error.stack);\n
if
(g.options.parameter.parameter_hash
!==
undefined)
{\n
parameter_xml =
atob(g.options.parameter.parameter_hash);\n
...
...
@@ -674,7 +685,7 @@
});\n
}\n
\n
console.log("INITIATING
A
LOOP
EVENT
LISTENER
FOR
OPTION
CHANGE");\n
//
console.log("INITIATING
A
LOOP
EVENT
LISTENER
FOR
OPTION
CHANGE");\n
return
loopEventListener(\n
element,\n
\'change\',\n
...
...
@@ -690,7 +701,7 @@
return
g.processValidation(g.options.json_url)\n
.fail(function
(error)
{\n
var
parameter_xml =
\'\';\n
console.log("FAIL
CALLED");\n
//
console.log("FAIL
CALLED");\n
console.log(error.stack);\n
if
(g.options.parameter.parameter_hash
!==
undefined)
{\n
parameter_xml =
atob(g.options.parameter.parameter_hash);\n
...
...
@@ -840,7 +851,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
942.1
0806.29939.62481
</string>
</value>
<value>
<string>
942.1
2751.5721.43315
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -858,7 +869,7 @@
</tuple>
<state>
<tuple>
<float>
1428
362362.95
</float>
<float>
1428
479010.83
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
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