Fix update tools versions for sqlite db
pull/372/head v7.0.1.0
Aidaho 2023-10-26 11:07:08 +03:00
parent 58e26b2b76
commit a2581227b5
3 changed files with 15 additions and 8 deletions

View File

@ -5,14 +5,15 @@ import modules.roxywi.roxy as roxywi_mod
import modules.server.server as server_mod import modules.server.server as server_mod
def get_services_status(): def get_services_status(update_cur_ver=0):
services = [] services = []
services_name = sql.get_all_tools() if update_cur_ver:
try:
update_cur_tool_versions()
except Exception as e:
raise Exception(f'error: Update current versions: {e}')
try: services_name = sql.get_all_tools()
update_cur_tool_versions()
except Exception as e:
raise Exception(f'error: Update current versions: {e}')
try: try:
for s, v in services_name.items(): for s, v in services_name.items():
@ -96,7 +97,10 @@ def update_cur_tool_version(tool_name: str) -> None:
if service_ver in ('command', 'prometheus:', 'not'): if service_ver in ('command', 'prometheus:', 'not'):
service_ver = 0 service_ver = 0
sql.update_tool_cur_version(tool_name, service_ver) try:
sql.update_tool_cur_version(tool_name, service_ver)
except Exception:
pass
def get_cur_tool_version(tool_name: str) -> str: def get_cur_tool_version(tool_name: str) -> str:

View File

@ -61,7 +61,7 @@ def show_tools():
roxywi_auth.page_for_admin() roxywi_auth.page_for_admin()
lang = roxywi_common.get_user_lang_for_flask() lang = roxywi_common.get_user_lang_for_flask()
try: try:
services = tools_common.get_services_status() services = tools_common.get_services_status(update_cur_ver=1)
except Exception as e: except Exception as e:
return str(e) return str(e)

View File

@ -78,6 +78,9 @@
<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> <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 %} {% endif %}
{% endif %} {% endif %}
{% if s.2['current_version'] == '0' %}
<a class="ui-button ui-widget ui-corner-all" onclick="updateService('{{s.0}}', 'install')" title="{{lang.words.install|title()}} {{service_name}}">{{lang.words.install|title()}}</a>
{% endif %}
</td> </td>
<td colspan="3"> <td colspan="3">
{{services_name[s.0]['desc']|safe}} {{services_name[s.0]['desc']|safe}}