Fix showing Roxy-WI tools versions on the Tools and Update pages
pull/366/head
Aidaho 2023-10-24 22:21:19 +03:00
parent 57db17c86b
commit c96768fc64
4 changed files with 8 additions and 3 deletions

View File

@ -82,7 +82,7 @@ def update_cur_tool_version(tool_name: str) -> None:
if distro.id() == 'ubuntu':
if tool_name == 'roxy-wi-keep_alive':
correct_name = 'roxy-wi-keep-alive'
cmd = f"apt show {correct_name}|grep Version |awk '{{print $2}}'"
cmd = f"apt list --installed 2>&1 |grep {correct_name}|awk '{{print $2}}'|sed 's/-/./'"
else:
cmd = f"rpm -q {correct_name}|awk -F\"{correct_name}\" '{{print $2}}' |awk -F\".noa\" '{{print $1}}' |sed 's/-//1' |sed 's/-/./'"

View File

@ -40,7 +40,7 @@
{{services_name[s.0]['name']}}
</td>
<td class="padding10 first-collumn">
{% if 'is not installed' in s.2['current_version'] or not s.2['current_version'] %}
{% if 'is not installed' in s.2['current_version'] or not s.2['current_version'] or s.2['current_version'] == '0' %}
{% if s.0 in ('prometheus', 'grafana-server') %}
<a href="/app/install#monitoring" class="ui-button ui-widget ui-corner-all" title="{{lang.words.install|title()}} {{service_name}}">{{lang.words.install|title()}}</a>
{% elif s.0 in ('rabbitmq-server', 'fail2ban') %}

View File

@ -73,7 +73,7 @@
</b>
</td>
<td>
{% if 'is not installed' not in s.2['current_version'] and s.2['current_version'] != '' %}
{% if 'is not installed' not in s.2['current_version'] and s.2['current_version'] != '' and s.2['current_version'] != '0' %}
{% if is_need_update %}
<a class="ui-button ui-widget ui-corner-all" onclick="updateService('{{s.0}}')" title="{{lang.words.w_update|title()}} {{services_name[s.0]['name']}}">{{lang.words.w_update|title()}}</a>
{% endif %}

View File

@ -2407,6 +2407,11 @@ function updateService(service, action='update') {
toastr.error(data);
} else if (data.indexOf('error:') != '-1' || data.indexOf('Failed') != '-1') {
toastr.error(data);
} else if (data.indexOf('0 upgraded, 0 newly installed') != '-1') {
toastr.info('There is no a new version of ' + service);
} else {
toastr.clear();
toastr.success(service + ' has been ' + action + 'ed');
}
$("#ajax-update").html('');
loadupdatehapwi();