Commit 7ac070dd authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_jio: Extend test parameter sample to filter software type

parent db2ba1e4
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
.push(function () { .push(function () {
return gadget.redirect({"command": "change", return gadget.redirect({"command": "change",
"options": {"url_string": doc.url_string, "options": {"url_string": doc.url_string,
"software_type": doc.software_type,
"parameter_output": doc.text_content}}); "parameter_output": doc.text_content}});
}); });
}, function (error) { }, function (error) {
...@@ -73,16 +74,10 @@ ...@@ -73,16 +74,10 @@
if (options.url_string === undefined) { if (options.url_string === undefined) {
options.url_string = ""; options.url_string = "";
} }
if (options.editable === undefined) {
options.editable = true;
}
if (options.restricted_softwaretype === undefined) {
options.restricted_softwaretype = false;
}
return this.changeState({ return this.changeState({
"url_string": options.url_string, "url_string": options.url_string,
"parameter_output": options.parameter_output, "parameter_output": options.parameter_output,
"restricted_softwaretype": options.restricted_softwaretype "software_type_list": options.software_type
}); });
}) })
...@@ -113,14 +108,16 @@ ...@@ -113,14 +108,16 @@
parameter_dict = { parameter_dict = {
'parameter' : { 'parameter' : {
'json_url': gadget.state.url_string.split('?')[0] + ".json", 'json_url': gadget.state.url_string.split('?')[0] + ".json",
'parameter_hash': parameter_hash, 'parameter_hash': parameter_hash
'restricted_softwaretype': false
} }
}; };
if (gadget.state.software_type_list) {
parameter_dict.parameter.software_type_list = gadget.state.software_type_list.split(',');
}
return result[0].render({ return result[0].render({
erp5_document: { erp5_document: {
"_embedded": {"_view": { "_embedded": {"_view": {
"my_url_string": { "your_url_string": {
"description": "Software Release Url", "description": "Software Release Url",
"title": "Software Release URL", "title": "Software Release URL",
"default": default_url, "default": default_url,
...@@ -144,6 +141,18 @@ ...@@ -144,6 +141,18 @@
"hidden": gadget.state.url_string === "", "hidden": gadget.state.url_string === "",
"type": "GadgetField" "type": "GadgetField"
}, },
"your_software_type": {
"description": "",
"title": "Software type",
"default": gadget.state.software_type_list,
"css_class": "",
"required": 0,
"editable": 1,
"sandbox": "",
"key": "software_type",
"hidden": 1,
"type": "StringField"
},
"your_parameter_output": { "your_parameter_output": {
"description": "", "description": "",
"title": "Parameters Output", "title": "Parameters Output",
...@@ -167,8 +176,7 @@ ...@@ -167,8 +176,7 @@
"key": "parameter_hash", "key": "parameter_hash",
"hidden": gadget.state.parameter_output === undefined, "hidden": gadget.state.parameter_output === undefined,
"type": "StringField" "type": "StringField"
}, }
}}, }},
"_links": { "_links": {
"type": { "type": {
...@@ -180,14 +188,15 @@ ...@@ -180,14 +188,15 @@
form_definition: { form_definition: {
group_list: [[ group_list: [[
"center", "center",
[["my_url_string"], ["your_parameter_output"], ["your_parameter_hash"], ["your_text_content"]] [["your_url_string"], ["your_parameter_output"], ["your_software_type"], ["your_parameter_hash"], ["your_text_content"]]
]] ]]
} }
}) })
.push(function () { .push(function () {
return gadget.getUrlFor({"command": "change", return gadget.getUrlFor({"command": "change",
"options": {"url_string": undefined, "options": {"url_string": undefined,
"parameter_output": undefined}}); "software_type": undefined,
"parameter_output": undefined}});
}) })
.push(function (selection_url) { .push(function (selection_url) {
return gadget.updateHeader({ return gadget.updateHeader({
......
...@@ -277,7 +277,7 @@ ...@@ -277,7 +277,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>1004.31514.19921.44151</string> </value> <value> <string>1004.41258.43166.28757</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -295,7 +295,7 @@ ...@@ -295,7 +295,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1669083537.85</float> <float>1669664533.48</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