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

slapos_web: Also trigger submit.

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