Commit 4620d1d0 authored by Rafael Monnerat's avatar Rafael Monnerat

General Improvements on Parameter handling

See merge request nexedi/slapos.core!374
parents 3ff4a916 ba2fdbb2
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
input.size = 1; input.size = 1;
option.value = ""; option.value = "";
if (default_value === undefined) { if (default_value === undefined) {
option.selected = "selected"; option.selected = true;
} }
input.appendChild(option); input.appendChild(option);
for (option_index in json_field['enum']) { for (option_index in json_field['enum']) {
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
optionz.value = json_field['enum'][option_index]; optionz.value = json_field['enum'][option_index];
optionz.textContent = json_field['enum'][option_index]; optionz.textContent = json_field['enum'][option_index];
if (json_field['enum'][option_index] === default_value) { if (json_field['enum'][option_index] === default_value) {
optionz.selected = "selected"; optionz.selected = true;
} }
input.appendChild(optionz); input.appendChild(optionz);
} }
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
input.size = 1; input.size = 1;
option.value = ""; option.value = "";
if (default_value === undefined) { if (default_value === undefined) {
option.selected = "selected"; option.selected = true;
} }
input.appendChild(option); input.appendChild(option);
json_field.oneOf.forEach(function (element, index) { json_field.oneOf.forEach(function (element, index) {
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
optionz.value = value; optionz.value = value;
optionz.textContent = element.title; optionz.textContent = element.title;
if (value === default_value) { if (value === default_value) {
optionz.selected = "selected"; optionz.selected = true;
} }
input.appendChild(optionz); input.appendChild(optionz);
} }
...@@ -667,21 +667,21 @@ ...@@ -667,21 +667,21 @@
div = document.createElement("div"), div = document.createElement("div"),
div_error = document.createElement("div"), div_error = document.createElement("div"),
span_error = document.createElement("span"), span_error = document.createElement("span"),
detail_error = document.createElement("details"),
detail_error_summary = document.createElement("summary"),
detail_error_span = document.createElement("span"),
textarea = document.createElement("textarea"), textarea = document.createElement("textarea"),
fieldset = document.createElement("fieldset"), fieldset = document.createElement("fieldset"),
fieldset_list = g.element.querySelectorAll('fieldset'), fieldset_list = g.element.querySelectorAll('fieldset'),
button0 = g.element.querySelector("button.slapos-show-raw-parameter"), show_raw_button = g.element.querySelector("button.slapos-show-raw-parameter"),
button1 = g.element.querySelector("button.slapos-show-form"); show_form_button = g.element.querySelector("button.slapos-show-form");
if (g.disable_raw_edit === true) { if (show_raw_button !== null) {
return fieldset; $(show_raw_button).addClass("hidden-button");
}
if (button0 !== null) {
$(button0).addClass("hidden-button");
} }
if (button1 !== null) { if (show_form_button !== null) {
$(button1).addClass("hidden-button"); $(show_form_button).removeClass("hidden-button");
} }
div.setAttribute("class", "field"); div.setAttribute("class", "field");
...@@ -694,16 +694,23 @@ ...@@ -694,16 +694,23 @@
span_error.setAttribute("class", "error"); span_error.setAttribute("class", "error");
span_error.textContent = "Parameter form is not available, use the textarea above for edit the instance parameters."; span_error.textContent = "Parameter form is not available, use the textarea above for edit the instance parameters.";
detail_error_summary.textContent = "More information..."
detail_error_span.setAttribute("class", "error_msg");
detail_error_span.textContent = error;
detail_error.appendChild(detail_error_summary);
detail_error.appendChild(detail_error_span);
div_error.setAttribute("class", "error"); div_error.setAttribute("class", "error");
div.appendChild(textarea); div.appendChild(textarea);
div_error.appendChild(span_error); div_error.appendChild(span_error);
div.appendChild(textarea); div_error.appendChild(detail_error);
fieldset.appendChild(div); fieldset.appendChild(div);
fieldset.appendChild(div_error); fieldset.appendChild(div_error);
fieldset_list[0].innerHTML = ''; // Do not hide the Software type, let the user edit it.
//fieldset_list[0].innerHTML = '';
$(fieldset_list[1]).replaceWith(fieldset); $(fieldset_list[1]).replaceWith(fieldset);
fieldset_list[2].innerHTML = ''; fieldset_list[2].innerHTML = '';
...@@ -741,12 +748,10 @@ ...@@ -741,12 +748,10 @@
var gadget = this, var gadget = this,
to_hide = gadget.element.querySelector("button.slapos-show-form"), to_hide = gadget.element.querySelector("button.slapos-show-form"),
to_show = gadget.element.querySelector("button.slapos-show-raw-parameter"), to_show = gadget.element.querySelector("button.slapos-show-raw-parameter"),
disable_raw_edit = options.value.parameter.disable_raw_edit,
softwaretype, softwaretype,
json_url = options.value.parameter.json_url; json_url = options.value.parameter.json_url;
gadget.options = options; gadget.options = options;
gadget.disable_raw_edit = disable_raw_edit;
if (options.value.parameter.parameter_hash !== undefined) { if (options.value.parameter.parameter_hash !== undefined) {
// A JSON where provided via gadgetfield // A JSON where provided via gadgetfield
...@@ -757,15 +762,6 @@ ...@@ -757,15 +762,6 @@
throw new Error("undefined json_url"); throw new Error("undefined json_url");
} }
if (disable_raw_edit === true) {
if (to_hide !== null) {
$(to_hide).addClass("hidden-button");
}
if (to_show !== null) {
$(to_show).addClass("hidden-button");
}
} else {
if (to_hide !== null) { if (to_hide !== null) {
$(to_hide).addClass("hidden-button"); $(to_hide).addClass("hidden-button");
} }
...@@ -773,7 +769,6 @@ ...@@ -773,7 +769,6 @@
if (to_show !== null) { if (to_show !== null) {
$(to_show).removeClass("hidden-button"); $(to_show).removeClass("hidden-button");
} }
}
return gadget.loadSoftwareJSON(json_url) return gadget.loadSoftwareJSON(json_url)
.push(function (json) { .push(function (json) {
var option_index, var option_index,
...@@ -781,7 +776,6 @@ ...@@ -781,7 +776,6 @@
option_selected = options.value.parameter.softwaretype, option_selected = options.value.parameter.softwaretype,
option_selected_index = options.value.parameter.softwaretypeindex, option_selected_index = options.value.parameter.softwaretypeindex,
restricted_softwaretype = options.value.parameter.restricted_softwaretype, restricted_softwaretype = options.value.parameter.restricted_softwaretype,
simplified_only = options.value.parameter.simplified_only,
input = gadget.element.querySelector('select.slapos-software-type'), input = gadget.element.querySelector('select.slapos-software-type'),
parameter_shared = gadget.element.querySelector('input.parameter_shared'), parameter_shared = gadget.element.querySelector('input.parameter_shared'),
parameter_schema_url = gadget.element.querySelector('input.parameter_schema_url'), parameter_schema_url = gadget.element.querySelector('input.parameter_schema_url'),
...@@ -816,9 +810,6 @@ ...@@ -816,9 +810,6 @@
option.value = option_index; option.value = option_index;
} }
if ((simplified_only === true) && (!option_index.endsWith("-simplified"))) {
continue;
}
option['data-id'] = option_index; option['data-id'] = option_index;
option.textContent = json['software-type'][option_index].title; option.textContent = json['software-type'][option_index].title;
if (json['software-type'][option_index].index) { if (json['software-type'][option_index].index) {
...@@ -829,7 +820,7 @@ ...@@ -829,7 +820,7 @@
if (option_index === lowest_option_index) { if (option_index === lowest_option_index) {
option_selected = option.value; option_selected = option.value;
option.selected = "selected"; option.selected = true;
option_selected_index = option_index; option_selected_index = option_index;
if (json['software-type'][option_index].shared === true) { if (json['software-type'][option_index].shared === true) {
parameter_shared.value = true; parameter_shared.value = true;
...@@ -850,7 +841,7 @@ ...@@ -850,7 +841,7 @@
if ((option_selected_index === undefined) && if ((option_selected_index === undefined) &&
(option.value === option_selected) && (option.value === option_selected) &&
(options.value.parameter.shared == json['software-type'][option_index].shared)) { (options.value.parameter.shared == json['software-type'][option_index].shared)) {
option.selected = "selected"; option.selected = true;
option_selected_index = option_index; option_selected_index = option_index;
if (json['software-type'][option_index].shared === true) { if (json['software-type'][option_index].shared === true) {
parameter_shared.value = true; parameter_shared.value = true;
...@@ -907,23 +898,40 @@ ...@@ -907,23 +898,40 @@
return parameter_schema_url.value; return parameter_schema_url.value;
}) })
.push(function (parameter_json_schema_url) { .push(function (parameter_json_schema_url) {
var parameter_dict = {}, json_url_uri, prefix, parameter_entry, var parameter_dict = {}, parameter_list, json_url_uri, prefix, parameter_entry,
restricted_parameter = options.value.parameter.restricted_parameter; restricted_parameter = options.value.parameter.restricted_parameter;
if (options.value.parameter.parameter_xml !== undefined) { if (options.value.parameter.parameter_xml !== undefined) {
if (options.serialisation === "json-in-xml") { if (options.serialisation === "json-in-xml") {
parameter_list = jQuery.parseXML(
options.value.parameter.parameter_xml)
.querySelectorAll("parameter")
if (parameter_list.length > 1) {
throw new Error("The current parameter should contains only _ parameter (json-in-xml).")
}
parameter_entry = jQuery.parseXML( parameter_entry = jQuery.parseXML(
options.value.parameter.parameter_xml options.value.parameter.parameter_xml
).querySelector("parameter[id='_']"); ).querySelector("parameter[id='_']");
if (parameter_entry !== null) { if (parameter_entry !== null) {
parameter_dict = JSON.parse(parameter_entry.textContent); parameter_dict = JSON.parse(parameter_entry.textContent);
} else if (parameter_list.length == 1) {
throw new Error(
"The current parameter should contains only _ parameter (json-in-xml).")
}
} else if (["", "xml"].indexOf(options.serialisation) >= 0) {
parameter_entry = jQuery.parseXML(
options.value.parameter.parameter_xml
).querySelector("parameter[id='_']");
if (parameter_entry !== null) {
throw new Error("The current parameter values should NOT contains _ parameter (xml).");
} }
} else {
$(jQuery.parseXML(options.value.parameter.parameter_xml) $(jQuery.parseXML(options.value.parameter.parameter_xml)
.querySelectorAll("parameter")) .querySelectorAll("parameter"))
.each(function (key, p) { .each(function (key, p) {
parameter_dict[p.id] = p.textContent; parameter_dict[p.id] = p.textContent;
}); });
} else {
throw new Error("Unknown serialisation: " + options.serialisation);
} }
} }
...@@ -1046,18 +1054,20 @@ ...@@ -1046,18 +1054,20 @@
function showParameterForm(evt) { function showParameterForm(evt) {
var e = g.element.getElementsByTagName('select')[0], var e = g.element.getElementsByTagName('select')[0],
to_hide = g.element.querySelector("button.slapos-show-form"), to_hide = g.element.querySelector("button.slapos-show-form"),
to_show = g.element.querySelector("button.slapos-show-raw-parameter"); to_show = g.element.querySelector("button.slapos-show-raw-parameter"),
text_content = g.element.querySelector('textarea[name=text_content]');
if (e === undefined) { if (e === undefined) {
throw new Error("Select not found."); throw new Error("Select not found.");
} }
$(to_hide).addClass("hidden-button"); $(to_hide).addClass("hidden-button");
$(to_show).removeClass("hidden-button"); $(to_show).removeClass("hidden-button");
g.options.value.parameter.softwaretype = e.value; g.options.value.parameter.softwaretype = e.value;
g.options.value.parameter.softwaretypeindex = e.selectedOptions[0]["data-id"]; g.options.value.parameter.softwaretypeindex = e.selectedOptions[0]["data-id"];
g.options.value.parameter.parameter_xml = text_content.value;
g.options.value.parameter.parameter_hash = btoa(text_content.value);
return g.render(g.options) return g.render(g.options)
.push(function () { .push(function () {
return loadEventList(g); return loadEventList(g);
......
...@@ -280,7 +280,7 @@ ...@@ -280,7 +280,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>985.8770.30214.17305</string> </value> <value> <string>999.21924.60509.42444</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1594299230.72</float> <float>1649185724.55</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testSlapOSJSServiceInvalidParameter</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test SlapOS JS UI Sevice JSON Serialisation </title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">TTest SlapOS JS UI Sevice JSON Serialisation</td>
</tr>
</thead>
<tbody>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_init" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/set_default_available_language"/>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_login" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(0)', 'footer': 'No records'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tal:block define="menu_action python: 'Add'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_submenu_action" />
</tal:block>
<tr>
<td colspan="3"><b> Request a Software </b></td>
</tr>
<tal:block define="software_product python: 'KVM'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/select_software_product" />
</tal:block>
<tal:block define="software_release python: 'KVM'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/select_software_release" />
</tal:block>
<tr>
<td colspan="3"><b> Fill Request form </b></td>
</tr>
<tal:block tal:define="header python: '3/3 Request Service: ${title}';
dummy python: context.REQUEST.set('mapping', {'title': 'KVM'}) ">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//input[@id="title"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@id="title"]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@id="title"]</td>
<td>TEST-SLAPOSJS-SERVICE-KVM-INVALID-PARAMETER 0</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-raw-parameter"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-raw-parameter"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-raw-parameter"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//textarea[@name="text_content"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//textarea[@name="text_content"]</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//textarea[@name="text_content"]</td>
<td>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;&lt;instance&gt;&lt;/instance&gt;</td>
</tr>
<tr>
<td>type</td>
<td>//textarea[@name="text_content"]</td>
<td>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;&lt;instance&gt;&lt;parameter id=&quot;ram-size&quot;&gt;1024&lt;/parameter&gt;&lt;/instance&gt;</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-form"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-form"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-form"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="//ram-size"]</td>
<td>1024</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]//option[text()="Cluster"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]//option[text()="Cluster"]</td>
<td></td>
</tr>
<tr>
<td>select</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]</td>
<td>Cluster</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//textarea[@name="text_content"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//textarea[@name="text_content"]</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//textarea[@name="text_content"]</td>
<td>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;&lt;instance&gt;&lt;parameter id=&quot;ram-size&quot;&gt;1024&lt;/parameter&gt;&lt;/instance&gt;</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//summary[text()="More information..."]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//summary[text()="More information..."]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//textarea[@name="text_content"]</td>
<td>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;&lt;instance&gt;&lt;parameter id=&quot;_&quot;&gt;{&quot;kvm-partition-dict&quot;: {&quot;T&quot;: {&quot;ram-size&quot;: 2048}}}&lt;/parameter&gt;&lt;/instance&gt;</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_proceed" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'New service created.'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page" />
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(1)', 'footer': '${count} Records'};
dummy python: context.REQUEST.set('mapping', {'count': '1'})">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-INVALID-PARAMETER 0"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-INVALID-PARAMETER 0"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-INVALID-PARAMETER 0"]</td>
<td></td>
</tr>
<tr tal:define="dummy python: context.REQUEST.set('mapping', {'title': 'TEST-SLAPOSJS-SERVICE-KVM-INVALID-PARAMETER 0'})">
<td>waitForElementPresent</td>
<td tal:content="python: '//a[@data-i18n= \'%s\']' % (here.Base_translateString('Instance Tree: ${title}', mapping=context.REQUEST.get('mapping', {}), lang=lang))"></td>
<td></td>
</tr>
<tr tal:define="dummy python: context.REQUEST.set('mapping', {'title': 'TEST-SLAPOSJS-SERVICE-KVM-INVALID-PARAMETER 0'})">
<td>assertElementPresent</td>
<td tal:content="python: '//a[@data-i18n= \'%s\']' % (here.Base_translateString('Instance Tree: ${title}', mapping=context.REQUEST.get('mapping', {}), lang=lang))"></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//kvm-partition-dict/T/ram-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@name="//kvm-partition-dict/T/ram-size"]</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="//kvm-partition-dict/T/ram-size"]</td>
<td>2048</td>
</tr>
<tr>
<td>pause</td>
<td>1000</td>
<td>2000</td>
</tr>
<tal:block define="menu_action python: 'Destroy'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_submenu_action" />
</tal:block>
<tal:block tal:define="header python: 'Destroy Instance Tree: ${title}';
dummy python: context.REQUEST.set('mapping', {'title': 'TEST-SLAPOSJS-SERVICE-KVM-INVALID-PARAMETER 0'}) ">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_proceed" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Service is Destroyed.'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page" />
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(0)', 'footer': 'No records'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_logout" />
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>testSlapOSJSServiceLoadParameter</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html xmlns:tal="http://xml.zope.org/namespaces/tal" xmlns:metal="http://xml.zope.org/namespaces/metal">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Test SlapOS JS UI Sevice JSON Serialisation </title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr>
<td rowspan="1" colspan="3">TTest SlapOS JS UI Sevice JSON Serialisation</td>
</tr>
</thead>
<tbody>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_init" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/set_default_available_language"/>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_login" />
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_front_page" />
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(0)', 'footer': 'No records'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tal:block define="menu_action python: 'Add'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_submenu_action" />
</tal:block>
<tr>
<td colspan="3"><b> Request a Software </b></td>
</tr>
<tal:block define="software_product python: 'KVM'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/select_software_product" />
</tal:block>
<tal:block define="software_release python: 'KVM'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/select_software_release" />
</tal:block>
<tr>
<td colspan="3"><b> Fill Request form </b></td>
</tr>
<tal:block tal:define="header python: '3/3 Request Service: ${title}';
dummy python: context.REQUEST.set('mapping', {'title': 'KVM'}) ">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//input[@id="title"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@id="title"]</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@id="title"]</td>
<td>TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//select[@name="software_type"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-raw-parameter"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-raw-parameter"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-raw-parameter"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//textarea[@name="text_content"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//textarea[@name="text_content"]</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//textarea[@name="text_content"]</td>
<td>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;&lt;instance&gt;&lt;/instance&gt;</td>
</tr>
<tr>
<td>type</td>
<td>//textarea[@name="text_content"]</td>
<td>&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot; ?&gt;&lt;instance&gt;&lt;parameter id=&quot;ram-size&quot;&gt;1024&lt;/parameter&gt;&lt;/instance&gt;</td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-form"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-form"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[contains(@data-gadget-url,
'gadget_erp5_page_slap_parameter_form.html')]//button[@class="slapos-show-form"]</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="//ram-size"]</td>
<td>1024</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_proceed" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'New service created.'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page" />
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(1)', 'footer': '${count} Records'};
dummy python: context.REQUEST.set('mapping', {'count': '1'})">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0"]</td>
<td></td>
</tr>
<tr tal:define="dummy python: context.REQUEST.set('mapping', {'title': 'TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0'})">
<td>waitForElementPresent</td>
<td tal:content="python: '//a[@data-i18n= \'%s\']' % (here.Base_translateString('Instance Tree: ${title}', mapping=context.REQUEST.get('mapping', {}), lang=lang))"></td>
<td></td>
</tr>
<tr tal:define="dummy python: context.REQUEST.set('mapping', {'title': 'TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0'})">
<td>assertElementPresent</td>
<td tal:content="python: '//a[@data-i18n= \'%s\']' % (here.Base_translateString('Instance Tree: ${title}', mapping=context.REQUEST.get('mapping', {}), lang=lang))"></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="//ram-size"]</td>
<td>1024</td>
</tr>
<tr>
<td>pause</td>
<td>1000</td>
<td>2000</td>
</tr>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_save" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Data updated.'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_notification" />
</tal:block>
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(1)', 'footer': '${count} Records'};
dummy python: context.REQUEST.set('mapping', {'count': '1'})">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tr>
<td>waitForElementPresent</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0"]</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//a[text()="TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0"]</td>
<td></td>
</tr>
<tr tal:define="dummy python: context.REQUEST.set('mapping', {'title': 'TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0'})">
<td>waitForElementPresent</td>
<td tal:content="python: '//a[@data-i18n= \'%s\']' % (here.Base_translateString('Instance Tree: ${title}', mapping=context.REQUEST.get('mapping', {}), lang=lang))"></td>
<td></td>
</tr>
<tr tal:define="dummy python: context.REQUEST.set('mapping', {'title': 'TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0'})">
<td>assertElementPresent</td>
<td tal:content="python: '//a[@data-i18n= \'%s\']' % (here.Base_translateString('Instance Tree: ${title}', mapping=context.REQUEST.get('mapping', {}), lang=lang))"></td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>assertElementPresent</td>
<td>//input[@name="//ram-size"]</td>
<td></td>
</tr>
<tr>
<td>verifyValue</td>
<td>//input[@name="//ram-size"]</td>
<td>1024</td>
</tr>
<tal:block define="menu_action python: 'Destroy'">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_submenu_action" />
</tal:block>
<tal:block tal:define="header python: 'Destroy Instance Tree: ${title}';
dummy python: context.REQUEST.set('mapping', {'title': 'TEST-SLAPOSJS-SERVICE-KVM-LOAD-PARAMETER 0'}) ">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/assert_page_header" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/click_proceed" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Service is Destroyed.'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_wait_for_activities_and_front_page" />
<tal:block define="menu_item python: 'Services'; header menu_item">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/access_menu_item" />
</tal:block>
<tal:block tal:define="pagination_configuration python: {'header': '(0)', 'footer': 'No records'}">
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/check_listbox_pagination_text" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_SlapOSCommonTemplate/macros/slapos_logout" />
</tbody>
</table>
</body>
</html>
\ No newline at end of file
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