diff --git a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareProduct_getSortedSoftwareReleaseList.xml b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareProduct_getSortedSoftwareReleaseList.xml index d44caec38ab8a05e96220e319d031bc4a5e3491a..df85ce5edd4063d6967ae7c42f8b29276d237ca3 100644 --- a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareProduct_getSortedSoftwareReleaseList.xml +++ b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareProduct_getSortedSoftwareReleaseList.xml @@ -52,6 +52,8 @@ <key> <string>_body</string> </key> <value> <string encoding="cdata"><![CDATA[ +from DateTime import DateTime\n +\n portal = context.getPortalObject()\n \n if software_product_reference is None:\n @@ -81,12 +83,20 @@ if len(product_list) > 1:\n raise NotImplementedError(\'Several Software Product with the same title.\')\n \n software_release_list = product_list[0].getAggregateRelatedValueList()\n +\n +def sortkey(software_release):\n + publication_date = software_release.getEffectiveDate()\n + if publication_date:\n + if (publication_date - DateTime()) > 0:\n + return DateTime(\'1900/05/02\')\n + return publication_date\n + return software_release.getCreationDate()\n +\n software_release_list = sorted(\n software_release_list,\n - key=lambda software_release: software_release.getCreationDate(),\n - reverse=True,\n + key=sortkey, reverse=True,\n )\n -\n + \n return [software_release for software_release in software_release_list\n if software_release.getValidationState() in\n ["published"]\n diff --git a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_view.xml b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_view.xml index bec3a621827dc9ae7b7f543dca2f67bb39e529cd..561ba818a03e50a280e4db91038d5b53e3e9eaae 100644 --- a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_view.xml +++ b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_view.xml @@ -115,6 +115,7 @@ <string>my_crawling_scope</string> <string>my_crawling_depth</string> <string>my_update_frequency</string> + <string>my_effective_date</string> </list> </value> </item> diff --git a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_view/my_effective_date.xml b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_view/my_effective_date.xml new file mode 100644 index 0000000000000000000000000000000000000000..8444ceccc52a1122317485d7e421fa0f34f5109b --- /dev/null +++ b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_view/my_effective_date.xml @@ -0,0 +1,96 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>default_now</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_effective_date</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>default_now</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_effective_date</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Document_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_viewUsableNetworkList/listbox.xml b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_viewUsableNetworkList/listbox.xml index 535cddd4cb4b0e7324866f7da75af710f83c40d0..346b920adcec7aff156f91ca4309eb8ae6939d32 100644 --- a/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_viewUsableNetworkList/listbox.xml +++ b/master/bt5/slapos_cloud/SkinTemplateItem/portal_skins/slapos_cloud/SoftwareRelease_viewUsableNetworkList/listbox.xml @@ -15,8 +15,10 @@ <string>hide_rows_on_no_search_criterion</string> <string>list_method</string> <string>portal_types</string> + <string>search</string> <string>search_columns</string> <string>select</string> + <string>sort_columns</string> <string>title</string> </list> </value> @@ -130,6 +132,10 @@ </list> </value> </item> + <item> + <key> <string>search</string> </key> + <value> <int>0</int> </value> + </item> <item> <key> <string>search_columns</string> </key> <value> @@ -145,6 +151,12 @@ <key> <string>select</string> </key> <value> <int>0</int> </value> </item> + <item> + <key> <string>sort_columns</string> </key> + <value> + <list/> + </value> + </item> <item> <key> <string>target</string> </key> <value> <string>Click to edit the target</string> </value> diff --git a/master/bt5/slapos_cloud/TestTemplateItem/testSlapOSSoftwareProduct.py b/master/bt5/slapos_cloud/TestTemplateItem/testSlapOSSoftwareProduct.py index 31fe57b35ab600699a11f867df537cb2f34baa2c..f644af5c3a478fc6cdc8148b8ad864998943461b 100644 --- a/master/bt5/slapos_cloud/TestTemplateItem/testSlapOSSoftwareProduct.py +++ b/master/bt5/slapos_cloud/TestTemplateItem/testSlapOSSoftwareProduct.py @@ -149,7 +149,8 @@ class TestSoftwareReleaseListFromSoftwareProduct(testSlapOSMixin): software_release1 = self._makeSoftwareRelease(new_id) software_release1.edit( aggregate_value=software_product.getRelativeUrl(), - url_string='http://example.org/1-%s.cfg' % new_id + url_string='http://example.org/1-%s.cfg' % new_id, + effective_date=(DateTime() + 5) ) software_release1.publish() software_release2 = self._makeSoftwareRelease(self.generateNewId()) @@ -185,14 +186,16 @@ class TestSoftwareReleaseListFromSoftwareProduct(testSlapOSMixin): software_release2.publish() software_release2.edit( aggregate_value=software_product.getRelativeUrl(), - url_string='http://example.org/2-%s.cfg' % new_id + url_string='http://example.org/2-%s.cfg' % new_id, + effective_date=(DateTime() - 2) ) # Newest software release software_release1 = self._makeSoftwareRelease(new_id) software_release1.publish() software_release1.edit( aggregate_value=software_product.getRelativeUrl(), - url_string='http://example.org/1-%s.cfg' % new_id + url_string='http://example.org/1-%s.cfg' % new_id, + effective_date=DateTime() ) self.tic() @@ -280,6 +283,7 @@ class TestSlapOSUpgradeHostingSubscription(BaseTestSlapOSMixin): True) self.portal.portal_workflow._jumpToStateFor(hosting_subscription, 'destroy_requested') + self.tic() self.assertEqual(hosting_subscription.HostingSubscription_isUpgradable(), False) \ No newline at end of file diff --git a/master/bt5/slapos_cloud/bt/revision b/master/bt5/slapos_cloud/bt/revision index 1a7d3a1c8495b23465e0040b8884cae840577f4f..ab760c939afd177a8fb0343cb528e9e7e5ca1244 100644 --- a/master/bt5/slapos_cloud/bt/revision +++ b/master/bt5/slapos_cloud/bt/revision @@ -1 +1 @@ -318 \ No newline at end of file +319 \ No newline at end of file