From 94048ba2fec3aec92d2eb4a71801f2b75721f5b9 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sat, 27 Oct 2018 12:21:00 +0200 Subject: [PATCH] Show percentage as a whole number, clarify strings --- basic/srv/vm/static/js/admin.js | 16 +++++++++++----- basic/srv/vm/templates/setup-apps-row.html | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/basic/srv/vm/static/js/admin.js b/basic/srv/vm/static/js/admin.js index 93fca95..f154dfc 100644 --- a/basic/srv/vm/static/js/admin.js +++ b/basic/srv/vm/static/js/admin.js @@ -166,7 +166,8 @@ function install_app(ev) { } function uninstall_app(ev) { - if (confirm('Do you really want to uninstall this application?')) { + var app = $(ev.target).closest('tr').children().first().text() + if (confirm('Opravdu chcete tuto odinstalovat aplikaci '+app+'?')) { return _do_app('uninstall', ev); } return false; @@ -175,11 +176,16 @@ function uninstall_app(ev) { function check_progress() { var progress = $('#install-progress'); if (progress.length) { + var td = progress.closest('td'); var tr = progress.closest('tr'); $.post('/get-install-progress', {'app': tr.data('app')}, function(data) { if (data.progress) { - var value = Math.max(0.1, Math.min(data.progress / progress.data('total') * 100, 99.9)); - progress.text(parseFloat(value).toFixed(1)); + var value = parseInt(Math.max(1, data.progress / progress.data('total') * 100)); + if (value < 100) { + progress.text(parseInt(value)); + } else { + td.text('Instaluje se') + } } else { tr.replaceWith(data.ok); } @@ -210,14 +216,14 @@ function _do_vm(action) { } function reboot_vm() { - if (confirm('Do you really want to reboot VM?')) { + if (confirm('Opravdu chcete restartovat VM?')) { _do_vm('reboot'); } return false; } function shutdown_vm() { - if (confirm('Do you really want to shutdown VM?')) { + if (confirm('Opravdu chcete vypnout VM?')) { _do_vm('shutdown'); } return false; diff --git a/basic/srv/vm/templates/setup-apps-row.html b/basic/srv/vm/templates/setup-apps-row.html index b7bd6d7..3edcea3 100644 --- a/basic/srv/vm/templates/setup-apps-row.html +++ b/basic/srv/vm/templates/setup-apps-row.html @@ -2,6 +2,6 @@ {{ app_title }} - {% if total_size %}Instalace (0.1 %){% elif app not in conf['apps'] %} Není nainstalována{% elif is_service_started(app) %}Spuštěna{% else %}Zastavena{% endif %} + {% if total_size %}Stahuje se (1 %){% elif app not in conf['apps'] %} Není nainstalována{% elif is_service_started(app) %}Spuštěna{% else %}Zastavena{% endif %} {% if total_size %}
{% elif app not in conf['apps'] %}Instalovat{% elif is_service_started(app) %}Zastavit{% else %}Spustit, Odinstalovat{% endif %}