Commit 1ad93a72 authored by Ayush Tiwari's avatar Ayush Tiwari

[erp5_core]: Migrate URL columns for Historical Comparison List

This MR will give similar behavior for Historical Comparison List in the new UI, which currently is broken.

/reviewed-on nexedi/erp5!683
parent cc5d572e
<?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>testFormViewHistoricalRevisionLink</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>
<!-- Test whether URLs in History tab works correclty showing the old
value, new value and current value
-->
<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 RenderJS UI</title>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">Test RenderJS UI</td></tr>
</thead><tbody>
<tal:block metal:use-macro="here/Zuite_CommonTemplate/macros/init" />
<!-- Clean Up -->
<tr>
<td>open</td>
<td>${base_url}/bar_module/ListBoxZuite_reset</td>
<td></td>
</tr>
<tr>
<td>assertTextPresent</td>
<td>Reset Successfully.</td>
<td></td>
</tr>
<!-- Initialize -->
<tr>
<td>open</td>
<td>${base_url}/web_site_module/renderjs_runner/#/foo_module</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//a[@data-i18n='Add']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>link=Add</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/submit_dialog" />
<tal:block tal:define="notification_configuration python: {'class': 'success',
'text': 'Document created.'}">
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_notification" />
</tal:block>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>//input[@name='field_my_short_title']</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>//input[@name='field_my_short_title']</td>
<td>A new foo</td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/save" />
<!-- Go to History tab -->
<tr>
<td colspan="3"><b>Go to History view</b></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//div[contains(@class, 'ui-header')]//a[@data-i18n='Views']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[contains(@class, 'ui-header')]//a[@data-i18n='Views']</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//ul[@class='document-listview']//a[@data-i18n='History']</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//ul[@class='document-listview']//a[@data-i18n='History']</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<!-- Check the links in hardcoded way -->
<!-- TODO: If possible, move to macros -->
<!-- The links for 1st row shouldn't be working as we don't compare the intial state in History view.
Also, the links are on 4th column only, which is DateTime column -->
<tr>
<td>waitForElementNotPresent</td>
<td>//div[@data-gadget-scope='x0_listbox']//table/tbody/tr[1]/td[4]/a</td>
<td></td>
</tr>
<!-- Link should be working on second row -->
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='x0_listbox']//table/tbody/tr[2]/td[4]/a</td>
<td></td>
</tr>
<tr>
<td>click</td>
<td>//div[@data-gadget-scope='x0_listbox']//table/tbody/tr[2]/td[4]/a</td>
<td></td>
</tr>
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_listbox_loaded" />
<tal:block metal:use-macro="here/Zuite_CommonTemplateForRenderjsUi/macros/wait_for_content_loaded" />
<tr>
<td>waitForElementPresent</td>
<td>//div[@data-gadget-scope='field_listbox']//table/tbody</td>
<td></td>
</tr>
<!-- Check if the columns exists or not. Can be done by just checking the head -->
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_listbox']//table/thead/tr[1]/th[1]</td>
<td>Property Name</td>
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_listbox']//table/thead/tr[1]/th[2]</td>
<td>Old Value</td>
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_listbox']//table/thead/tr[1]/th[3]</td>
<td>New Value</td>
</tr>
<tr>
<td>verifyText</td>
<td>//div[@data-gadget-scope='field_listbox']//table/thead/tr[1]/th[4]</td>
<td>Current Value</td>
</tr>
</tbody></table>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ActionInformation" module="Products.CMFCore.ActionInformation"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>action</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>category</string> </key>
<value> <string>object_hidden</string> </value>
</item>
<item>
<key> <string>condition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>icon</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>view_historical_comparison</string> </value>
</item>
<item>
<key> <string>permissions</string> </key>
<value>
<tuple>
<string>View</string>
</tuple>
</value>
</item>
<item>
<key> <string>priority</string> </key>
<value> <float>104.0</float> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>View Historical Comparison</string> </value>
</item>
<item>
<key> <string>visible</string> </key>
<value> <int>1</int> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Expression" module="Products.CMFCore.Expression"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>text</string> </key>
<value> <string>string:${object_url}/Base_viewHistoricalComparison</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -3,9 +3,6 @@ from ZODB.POSException import ConflictError
from zExceptions import Unauthorized
Base_translateString = context.Base_translateString
serial = context.REQUEST['serial']
next_serial = context.REQUEST['next_serial']
try:
context.HistoricalRevisions[serial]
except (ConflictError, Unauthorized):
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>**kw</string> </value>
<value> <string>serial, next_serial, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
"""
This URL script is used for Historical comparison list.
There are two cases handled here. If it is the first
row of the list(having serial as 0.0.0.0), then we don't
want to have any URL as there is no comparison needed,
thus we return empty dictionary in case of renderJS UI and
nothing for XHTMl UI.
"""
request = context.REQUEST
serial = getattr(brain, 'serial', '0.0.0.0')
next_serial = getattr(brain, 'next_serial', '0.0.0.0')
# There is no need to compare revisions in case its the
# first version.
if serial != '0.0.0.0':
if url_dict:
return {'command': 'index',
'options': {
# XXX: This shouldn't be the referred way to get
# relative URL, but if we directly use context here
# to get the relative URL, it will return us the
# URL of tempbase object of list, which is not
# what we desire, thus taking the approach to
# get it via REQUEST
'jio_key': request.get('relative_url'),
},
'view_kw': {
'view': 'view_historical_comparison',
'jio_key': request.get('relative_url'),
'extra_param_json': {
'serial': serial,
'next_serial': next_serial,
'time': brain.time
}
}
}
return 'Base_viewHistoricalComparison?serial=%s&amp;next_serial=%s&amp;time=%s'\
% ( serial, next_serial, brain.time )
elif url_dict:
return {}
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>brain, **kw</string> </value>
<value> <string>brain, url_dict=False, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -315,6 +315,10 @@
<key> <string>alternate_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>anchor</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>columns</string> </key>
<value>
......@@ -346,6 +350,10 @@
<key> <string>css_class</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>default_display_style</string> </key>
<value> <string>table</string> </value>
</item>
<item>
<key> <string>default_params</string> </key>
<value>
......@@ -356,6 +364,12 @@
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>display_style_list</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>domain_root_list</string> </key>
<value>
......@@ -390,10 +404,18 @@
<list/>
</value>
</item>
<item>
<key> <string>global_search_column</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>hidden</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>hide_rows_on_no_search_criterion</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>lines</string> </key>
<value> <int>20</int> </value>
......@@ -414,6 +436,10 @@
<list/>
</value>
</item>
<item>
<key> <string>page_navigation_template</string> </key>
<value> <string>ListBox_viewSliderPageNavigationRenderer</string> </value>
</item>
<item>
<key> <string>page_template</string> </key>
<value> <string></string> </value>
......@@ -434,6 +460,10 @@
<key> <string>report_tree</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>row_css_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>search</string> </key>
<value> <int>0</int> </value>
......@@ -474,16 +504,45 @@
<key> <string>stat_method</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>style_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Differences</string> </value>
</item>
<item>
<key> <string>url_columns</string> </key>
<key> <string>untranslatable_columns</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>url_columns</string> </key>
<value>
<list>
<tuple>
<string>property_name</string>
<string></string>
</tuple>
<tuple>
<string>old_value</string>
<string></string>
</tuple>
<tuple>
<string>new_value</string>
<string></string>
</tuple>
<tuple>
<string>current_value</string>
<string></string>
</tuple>
</list>
</value>
</item>
</dictionary>
</value>
</item>
......@@ -511,13 +570,7 @@
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<tuple>
<tuple>
<string>Products.Formulator.MethodField</string>
<string>Method</string>
</tuple>
<none/>
</tuple>
<global name="Method" module="Products.Formulator.MethodField"/>
</pickle>
<pickle>
<dictionary>
......
......@@ -168,6 +168,7 @@ portal_actions | property_sheet_tool
portal_actions | search
portal_actions | sort_on
portal_actions | types_tool
portal_actions | view_historical_comparison
portal_membership | login
portal_membership | logout
portal_membership | preferences
......
......@@ -237,6 +237,8 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
{'title': 'Undo', 'id': 'undo'}],
'object': [],
'object_action': [{'id': 'post_query', 'title': 'Post a Query'}],
'object_hidden': [{'id': 'view_historical_comparison',
'title': 'View Historical Comparison'}],
'object_jump': [{'id': 'jump_related_object', 'title': 'Related Objects'},
{'id': 'jump_query', 'title': 'Queries'}],
'object_search': [{'title': 'Search', 'id': 'search'}],
......@@ -258,6 +260,8 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
expected = {'folder': [],
'global': [],
'object': [],
'object_hidden': [{'id': 'view_historical_comparison',
'title': 'View Historical Comparison'}],
'object_jump': [{'id': 'jump_related_object', 'title': 'Related Objects'}],
'object_search': [{'title': 'Search', 'id': 'search'}],
'object_sort': [{'title': 'Sort', 'id': 'sort_on'}],
......@@ -274,6 +278,8 @@ class TestERP5Core(ERP5TypeTestCase, ZopeTestCase.Functional):
expected = {'folder': [],
'global': [],
'object': [],
'object_hidden': [{'id': 'view_historical_comparison',
'title': 'View Historical Comparison'}],
'object_jump': [{'id': 'jump_related_object', 'title': 'Related Objects'}],
'object_search': [{'title': 'Search', 'id': 'search'}],
'object_sort': [{'title': 'Sort', 'id': 'sort_on'}],
......
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