Commit 33bc16ae authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Reset the sort parameter when accessing a worklist

Improve the query speed by using the default listbox sort.
parent 4a89f9c2
......@@ -71,6 +71,9 @@
page: 'search'
};
}
// HARDCODED: most erp5's module listboxes are named 'listbox'
// Drop the sort parameter, to speed up the calculation
display_options['field_listbox_sort_list:json'] = undefined;
url_for_parameter_list.push(
{command: 'display_stored_state', options: display_options}
);
......
......@@ -228,7 +228,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>968.45482.36373.28842</string> </value>
<value> <string>976.13725.50121.7014</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -246,7 +246,7 @@
</tuple>
<state>
<tuple>
<float>1536227336.81</float>
<float>1559812175.93</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -345,7 +345,7 @@
return next_options;
}
function execDisplayStoredStateCommand(gadget, next_options) {
function execDisplayStoredStateCommand(gadget, next_options, drop_options) {
// console.warn(command_options);
var jio_key = next_options.jio_key,
storage_key = jio_key,
......@@ -359,7 +359,7 @@
if (storage_key) {
queue = gadget.props.jio_state_gadget.get(storage_key)
.push(function (options) {
calculateChangeOptions(options, next_options);
calculateChangeOptions(options, next_options, drop_options);
}, function (error) {
if ((error instanceof jIO.util.jIOError) &&
(error.status_code === 404)) {
......@@ -883,7 +883,7 @@
return execKeepHistoryAndCancelDialogCommand(gadget, previous_options);
}
if (command_options.path === COMMAND_DISPLAY_STORED_STATE) {
return execDisplayStoredStateCommand(gadget, next_options);
return execDisplayStoredStateCommand(gadget, next_options, drop_options);
}
if (command_options.path === COMMAND_INDEX_STATE) {
return execIndexCommand(gadget, previous_options, next_options);
......
......@@ -230,7 +230,7 @@
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>972.58906.44395.12356</string> </value>
<value> <string>976.13727.43454.8226</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>1547217993.21</float>
<float>1559811855.94</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -16,15 +16,16 @@
<td>${base_url}/web_site_module/renderjs_runner/#/?page=worklist</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<!-- Wait for gadget to be loaded -->
<tr>
<td>waitForElementPresent</td>
<td>assertElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_worklist.html']</td>
<td></td>
</tr>
<tr>
<td>waitForTextPresent</td>
<td>assertTextPresent</td>
<td>Draft To Validate 1</td>
<td></td>
</tr>
......@@ -32,7 +33,7 @@
<!-- Generate links to worklist on default module view -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='m']//a[text()='Draft To Validate ' and contains(@href, '#!display')]</td>
<td>//div[@data-gadget-scope='m']//a[text()='Draft To Validate ' and contains(@href, '#!display_stored_state')]</td>
<td></td>
</tr>
......@@ -40,11 +41,13 @@
<!-- Header has a link to the previous history entry -->
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='m']//a[text()='Draft To Validate ' and contains(@href, '#!display')]</td>
<td>//div[@data-gadget-scope='m']//a[text()='Draft To Validate ' and contains(@href, '#!display_stored_state')]</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>assertElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html']</td>
<td></td>
</tr>
......
<?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>testPageWorklistResetSort</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 Page Front</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test Page Front</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/PTZuite_CommonTemplate/macros/init" />
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/?page=search</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_app_loaded" />
<!-- Change the default sort -->
<tr>
<td>assertElementPresent</td><!-- verification -->
<td>//th[@class='ui-icon ui-icon-sort-amount-desc']/a[text()='Modification Date']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//th/a[text()='Type']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr>
<td>assertElementPresent</td><!-- verification -->
<td>//th[@class='ui-icon ui-icon-sort-amount-desc']/a[text()='Type']</td>
<td></td>
</tr>
<!-- Go to the worklist page -->
<tal:block tal:define="click_configuration python: {'text': 'Search'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_header_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_page_worklist.html']</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Draft To Validate 1</td>
<td></td>
</tr>
<!-- Generate links to worklist on default module view -->
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-scope='m']//a[text()='Draft To Validate ' and contains(@href, '#!display_stored_state')]</td>
<td></td>
</tr>
<!-- Follow one link -->
<!-- Header has a link to the previous history entry -->
<tal:block tal:define="click_configuration python: {'text': 'Draft To Validate '}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/click_on_page_link" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tr>
<td>assertElementPresent</td>
<td>//div[@data-gadget-url='${base_url}/web_site_module/renderjs_runner/gadget_erp5_pt_form_list.html']</td>
<td></td>
</tr>
<tal:block tal:define="search_query python: '';
parsed_query python: '( portal_type: (&nbsp; &#34;Bar&#34; OR&nbsp; &#34;Foo&#34; ) AND simulation_state:&nbsp; &#34;draft&#34; )'">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/check_search_in_form_list" />
</tal:block>
<!-- Check it's back to default sort -->
<tr>
<td>assertElementPresent</td><!-- verification -->
<td>//th[@class='ui-icon ui-icon-sort-amount-desc']/a[text()='Modification Date']</td>
<td></td>
</tr>
</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