Commit 7270b9ba authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_web: Also trigger submit.

parent 817c0456
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
/*jslint nomen: true, maxlen: 200, indent: 2*/\n /*jslint nomen: true, maxlen: 200, indent: 2*/\n
/*global rJS, console, window, document, loopEventListener, $, XMLSerializer, jQuery, URI, vkbeautify */\n /*global rJS, console, window, document, loopEventListener, $, XMLSerializer, jQuery, URI, vkbeautify */\n
\n \n
(function (window, document, rJS, loopEventListener, $, XMLSerializer, jQuery, URI, vkbeautify) {\n (function (window, document, rJS, loopEventListener, $, XMLSerializer, jQuery, vkbeautify) {\n
"use strict";\n "use strict";\n
\n \n
var gk = rJS(window);\n var gk = rJS(window);\n
...@@ -197,6 +197,10 @@ ...@@ -197,6 +197,10 @@
function validateForm(gadget, json_url) {\n function validateForm(gadget, json_url) {\n
return gadget.processValidation(json_url);\n return gadget.processValidation(json_url);\n
}\n }\n
\n
function submitForm(gadget, json_url) {\n
return gadget.processValidation(json_url);\n
}\n
\n \n
//function getSoftwareTypeFromForm(element) {\n //function getSoftwareTypeFromForm(element) {\n
// var software_type;\n // var software_type;\n
...@@ -299,7 +303,9 @@ ...@@ -299,7 +303,9 @@
input,\n input,\n
div_input,\n div_input,\n
span_error,\n span_error,\n
promise_list = [],\n
span_info,\n span_info,\n
fieldset_list = g.props.element.querySelectorAll(\'fieldset\'),\n
fieldset = document.createElement("fieldset"),\n fieldset = document.createElement("fieldset"),\n
fieldset_optional = document.createElement("fieldset");\n fieldset_optional = document.createElement("fieldset");\n
\n \n
...@@ -333,21 +339,25 @@ ...@@ -333,21 +339,25 @@
} else {\n } else {\n
fieldset.appendChild(div);\n fieldset.appendChild(div);\n
}\n }\n
loopEventListener(\n promise_list.push(loopEventListener(\n
input,\n input,\n
\'change\',\n \'change\',\n
false,\n false,\n
validateForm.bind(g, g, json_url)\n validateForm.bind(g, g, json_url)\n
);\n ));\n
promise_list.push(loopEventListener(\n
input,\n
\'submit\',\n
false,\n
submitForm.bind(g, g, json_url)\n
));\n
}\n }\n
}\n }\n
return [fieldset, fieldset_optional];\n $(fieldset_list[1]).replaceWith(fieldset);\n
}).push(function (new_fieldset_list) {\n $(fieldset_list[2]).replaceWith(fieldset_optional);\n
var fieldset_list = g.props.element.querySelectorAll(\'fieldset\');\n return RSVP.all(promise_list);\n
\n }).push(function () {\n
$(fieldset_list[1]).replaceWith(new_fieldset_list[0]);\n console.log("LOADED All Promises")\n
$(fieldset_list[2]).replaceWith(new_fieldset_list[1]);\n
return fieldset_list;\n
});\n });\n
})\n })\n
\n \n
...@@ -477,7 +487,7 @@ ...@@ -477,7 +487,7 @@
});\n });\n
});\n });\n
\n \n
}(window, document, rJS, loopEventListener, $, XMLSerializer, jQuery, URI, vkbeautify)); }(window, document, rJS, loopEventListener, $, XMLSerializer, jQuery, vkbeautify));
]]></string> </value> ]]></string> </value>
</item> </item>
...@@ -614,7 +624,7 @@ ...@@ -614,7 +624,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>941.46904.21655.48418</string> </value> <value> <string>941.47120.44131.43212</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -632,7 +642,7 @@ ...@@ -632,7 +642,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1426596317.01</float> <float>1426618698.56</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -108,11 +108,8 @@ ...@@ -108,11 +108,8 @@
json_url = "sample_schema.json";\n json_url = "sample_schema.json";\n
\n \n
gk.declareMethod(\'render\', function (options) {\n gk.declareMethod(\'render\', function (options) {\n
//if (options.parameter.software_release_url === undefined) {\n \n
// throw new Error("undefined software_release_url");\n var g = this;\n
//}\n
var g = this,\n
element = g.__element.getElementsByTagName(\'form\')[0];\n
\n \n
options.json_url = "../../renderjs/slapos_load_schema_software_type.json";\n options.json_url = "../../renderjs/slapos_load_schema_software_type.json";\n
options.parameter = {};\n options.parameter = {};\n
...@@ -136,11 +133,11 @@ ...@@ -136,11 +133,11 @@
\n \n
return g.getDeclaredGadget(\'parameter\')\n return g.getDeclaredGadget(\'parameter\')\n
.push(function (gadget) {\n .push(function (gadget) {\n
return gadget.render(options);\n return gadget.render(options).push(function () {\n
console.log("FINISH TO LOADED");\n
});\n
});\n });\n
\n
});\n });\n
console.log("LOADED");\n
\n \n
}(window, rJS, $, loopEventListener));</string> </value> }(window, rJS, $, loopEventListener));</string> </value>
</item> </item>
...@@ -277,7 +274,7 @@ ...@@ -277,7 +274,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>941.42676.28317.52480</string> </value> <value> <string>941.47267.50185.4608</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -295,7 +292,7 @@ ...@@ -295,7 +292,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1426343134.63</float> <float>1426617885.75</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
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