feat: system-upgrade improved message on new version check page

This commit is contained in:
RhodeCode Admin 2024-06-13 09:42:48 +02:00
parent 59e99e4368
commit b549afbfee
3 changed files with 20 additions and 15 deletions

View file

@ -485,7 +485,7 @@ class TestAdminSystemInfo(object):
update_data = {
'versions': [
{
'version': '100.3.1415926535',
'version': '100.0.0',
'general': 'The latest version we are ever going to ship'
},
{
@ -502,15 +502,15 @@ class TestAdminSystemInfo(object):
update_data = {
'versions': [
{
'version': '0.0.0',
'version': '4.0.0',
'general': 'The first version we ever shipped'
}
]
}
text = f"Your current version, {rhodecode.__version__}, is up-to-date as it is equal to or newer than the latest available version, 4.0.0."
with mock.patch(UPDATE_DATA_QUALNAME, return_value=update_data):
response = self.app.get(route_path('admin_settings_system_update'))
response.mustcontain(
'This instance is already running the <b>latest</b> stable version')
response.mustcontain(text)
def test_system_update_bad_response(self, autologin_user):
with mock.patch(UPDATE_DATA_QUALNAME, side_effect=ValueError('foo')):

View file

@ -84,6 +84,6 @@
<script>
$('#check_for_update').click(function(e){
$('#update_notice').show();
$('#update_notice').load("${h.route_path('admin_settings_system_update')}");
$('#update_notice').load("${h.route_path('admin_settings_system_update', _query={'ver': request.GET.get('ver')})}");
})
</script>

View file

@ -1,25 +1,30 @@
## upgrade block rendered afte on-click check
<div class="alert ${'alert-warning' if c.should_upgrade else 'alert-success'}">
<p>
%if c.should_upgrade:
A <b>new version</b> is available:
<span style="font-size: 130%">A <b>new version</b> is available !</span>
<br/>
<br/>
%if c.latest_data.get('title'):
<b>${h.literal(c.latest_data['title'])}</b>
RhodeCode <b>${c.latest_ver}</b> - ${h.literal(c.latest_data['title'])}
%else:
<b>${c.latest_ver}</b>
RhodeCode <b>${c.latest_ver}</b>
%endif
%else:
This instance is already running the <b>latest</b> stable version ${c.latest_ver}.
Your current version, ${c.cur_ver}, is up-to-date as it is equal to or newer than the latest available version, ${c.latest_ver}.
%endif
</p>
% if c.should_upgrade and c.important_notices:
<div>Important notes for this release:</div>
<ul>
<br/>
<br/>
<div>Summary:</div>
<br/>
% for notice in c.important_notices:
<li>- ${notice}</li>
- ${notice}<br/>
% endfor
</ul>
% endif
</div>