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
Klaus Wölfel
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 @@
...
@@ -140,20 +140,25 @@
);\n
);\n
}\n
}\n
\n
\n
function render_selection(json_field) {\n
function render_selection(json_field
, default_value
) {\n
var input = document.createElement("select"),\n
var input = document.createElement("select"),\n
option = document.createElement("option"),\n
option = document.createElement("option"),\n
option_index,\n
option_index,\n
optionz;\n
optionz;\n
input.size = 1;\n
input.size = 1;\n
option.selected = "selected";\n
option.value = "";\n
option.value = "";\n
if (default_value === undefined) {\n
option.selected = "selected";\n
}\n
input.appendChild(option);\n
input.appendChild(option);\n
for (option_index in json_field.enum) {\n
for (option_index in json_field.enum) {\n
if (json_field.enum.hasOwnProperty(option_index)) {\n
if (json_field.enum.hasOwnProperty(option_index)) {\n
optionz = document.createElement("option");\n
optionz = document.createElement("option");\n
optionz.value = json_field.enum[option_index];\n
optionz.value = json_field.enum[option_index];\n
optionz.textContent = 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
input.appendChild(optionz);\n
}\n
}\n
}\n
}\n
...
@@ -163,12 +168,12 @@
...
@@ -163,12 +168,12 @@
function render_field(json_field, default_value) {\n
function render_field(json_field, default_value) {\n
\n
\n
if (json_field.enum !== undefined) {\n
if (json_field.enum !== undefined) {\n
return render_selection(json_field);\n
return render_selection(json_field
, default_value
);\n
}\n
}\n
\n
\n
if (json_field.type === "boolean") {\n
if (json_field.type === "boolean") {\n
json_field.enum = [true, false];\n
json_field.enum = [true, false];\n
return render_selection(json_field);\n
return render_selection(json_field
, default_value
);\n
}\n
}\n
\n
\n
var input = document.createElement("input");\n
var input = document.createElement("input");\n
...
@@ -254,7 +259,8 @@
...
@@ -254,7 +259,8 @@
}\n
}\n
root.appendChild(div);\n
root.appendChild(div);\n
\n
\n
return root;\n
\n
return div;\n
}\n
}\n
}\n
}\n
\n
\n
...
@@ -313,7 +319,7 @@
...
@@ -313,7 +319,7 @@
}\n
}\n
}\n
}\n
});\n
});\n
console.log(json_dict);\n
//
console.log(json_dict);\n
\n
\n
function convertOnMultiLevel(key, value, d) {\n
function convertOnMultiLevel(key, value, d) {\n
var i,\n
var i,\n
...
@@ -376,7 +382,7 @@
...
@@ -376,7 +382,7 @@
i,\n
i,\n
promise_list =
[];\n
promise_list =
[];\n
\n
\n
console.log("INITIATING
A
LOOP
EVENT
LISTENER");\n
//
console.log("INITIATING
A
LOOP
EVENT
LISTENER");\n
\n
\n
for
(
i =
0;
i
<
field_list.length;
i =
i
+
1)
{\n
for
(
i =
0;
i
<
field_list.length;
i =
i
+
1)
{\n
promise_list.push(loopEventListener(\n
promise_list.push(loopEventListener(\n
...
@@ -477,7 +483,7 @@
...
@@ -477,7 +483,7 @@
xml_output =
jsonDictToParameterXML(json_dict);\n
xml_output =
jsonDictToParameterXML(json_dict);\n
}\n
}\n
parameter_hash_input.value =
btoa(xml_output);\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
if
(validation.valid)
{\n
return
xml_output;\n
return
xml_output;\n
}\n
}\n
...
@@ -554,11 +560,16 @@
...
@@ -554,11 +560,16 @@
if
(
options.json_url =
==
undefined)
{\n
if
(
options.json_url =
==
undefined)
{\n
throw
new
Error("undefined
json_url");\n
throw
new
Error("undefined
json_url");\n
}\n
}\n
console.log("CALLED
RENDER");\n
//
console.log("CALLED
RENDER");\n
var
g =
this,\n
var
g =
this,\n
softwaretype;\n
softwaretype;\n
\n
\n
this.options =
options;\n
this.options =
options;\n
\n
function
updateParameterForm(evt)
{\n
options.parameter.softwaretype =
evt.srcElement.value;\n
return
g.render(options);\n
}\n
\n
\n
return
g.loadSoftwareJSON(g.options.json_url).push(function
(json)
{\n
return
g.loadSoftwareJSON(g.options.json_url).push(function
(json)
{\n
var
option_index,\n
var
option_index,\n
...
@@ -636,17 +647,17 @@
...
@@ -636,17 +647,17 @@
prefix =
options.json_url.split(json_url_uri.path())[0]
+
prefix.join("/");\n
prefix =
options.json_url.split(json_url_uri.path())[0]
+
prefix.join("/");\n
parameter_json_schema_url =
prefix
+
"/"
+
parameter_json_schema_url;\n
parameter_json_schema_url =
prefix
+
"/"
+
parameter_json_schema_url;\n
}\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
return
g.renderParameterForm(parameter_json_schema_url,
parameter_dict);\n
})\n
})\n
.push(function
()
{\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
return
g;\n
})\n
})\n
\n
\n
.fail(function
(error)
{\n
.fail(function
(error)
{\n
var
parameter_xml =
\'\';\n
var
parameter_xml =
\'\';\n
console.log("FAIL
CALLED");\n
//
console.log("FAIL
CALLED");\n
console.log(error.stack);\n
console.log(error.stack);\n
if
(g.options.parameter.parameter_hash
!==
undefined)
{\n
if
(g.options.parameter.parameter_hash
!==
undefined)
{\n
parameter_xml =
atob(g.options.parameter.parameter_hash);\n
parameter_xml =
atob(g.options.parameter.parameter_hash);\n
...
@@ -674,7 +685,7 @@
...
@@ -674,7 +685,7 @@
});\n
});\n
}\n
}\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
return
loopEventListener(\n
element,\n
element,\n
\'change\',\n
\'change\',\n
...
@@ -690,7 +701,7 @@
...
@@ -690,7 +701,7 @@
return
g.processValidation(g.options.json_url)\n
return
g.processValidation(g.options.json_url)\n
.fail(function
(error)
{\n
.fail(function
(error)
{\n
var
parameter_xml =
\'\';\n
var
parameter_xml =
\'\';\n
console.log("FAIL
CALLED");\n
//
console.log("FAIL
CALLED");\n
console.log(error.stack);\n
console.log(error.stack);\n
if
(g.options.parameter.parameter_hash
!==
undefined)
{\n
if
(g.options.parameter.parameter_hash
!==
undefined)
{\n
parameter_xml =
atob(g.options.parameter.parameter_hash);\n
parameter_xml =
atob(g.options.parameter.parameter_hash);\n
...
@@ -840,7 +851,7 @@
...
@@ -840,7 +851,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<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>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -858,7 +869,7 @@
...
@@ -858,7 +869,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1428
362362.95
</float>
<float>
1428
479010.83
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</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