Show percentage as a whole number, clarify strings

This commit is contained in:
Disassembler 2018-10-27 12:21:00 +02:00
parent 960e7a2466
commit 94048ba2fe
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
2 changed files with 12 additions and 6 deletions

View File

@ -166,7 +166,8 @@ function install_app(ev) {
} }
function uninstall_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 _do_app('uninstall', ev);
} }
return false; return false;
@ -175,11 +176,16 @@ function uninstall_app(ev) {
function check_progress() { function check_progress() {
var progress = $('#install-progress'); var progress = $('#install-progress');
if (progress.length) { if (progress.length) {
var td = progress.closest('td');
var tr = progress.closest('tr'); var tr = progress.closest('tr');
$.post('/get-install-progress', {'app': tr.data('app')}, function(data) { $.post('/get-install-progress', {'app': tr.data('app')}, function(data) {
if (data.progress) { if (data.progress) {
var value = Math.max(0.1, Math.min(data.progress / progress.data('total') * 100, 99.9)); var value = parseInt(Math.max(1, data.progress / progress.data('total') * 100));
progress.text(parseFloat(value).toFixed(1)); if (value < 100) {
progress.text(parseInt(value));
} else {
td.text('Instaluje se')
}
} else { } else {
tr.replaceWith(data.ok); tr.replaceWith(data.ok);
} }
@ -210,14 +216,14 @@ function _do_vm(action) {
} }
function reboot_vm() { function reboot_vm() {
if (confirm('Do you really want to reboot VM?')) { if (confirm('Opravdu chcete restartovat VM?')) {
_do_vm('reboot'); _do_vm('reboot');
} }
return false; return false;
} }
function shutdown_vm() { function shutdown_vm() {
if (confirm('Do you really want to shutdown VM?')) { if (confirm('Opravdu chcete vypnout VM?')) {
_do_vm('shutdown'); _do_vm('shutdown');
} }
return false; return false;

View File

@ -2,6 +2,6 @@
<td>{{ app_title }}</td> <td>{{ app_title }}</td>
<td class="center"><input type="checkbox" class="app-visible"{% if app not in conf['apps'] %} disabled{% elif conf['apps'][app]['visible'] %} checked{% endif %}></td> <td class="center"><input type="checkbox" class="app-visible"{% if app not in conf['apps'] %} disabled{% elif conf['apps'][app]['visible'] %} checked{% endif %}></td>
<td class="center"><input type="checkbox" class="app-autostart"{% if app not in conf['apps'] %} disabled{% elif is_service_autostarted(app) %} checked{% endif %}></td> <td class="center"><input type="checkbox" class="app-autostart"{% if app not in conf['apps'] %} disabled{% elif is_service_autostarted(app) %} checked{% endif %}></td>
<td>{% if total_size %}Instalace (<span id="install-progress" data-total="{{ total_size }}">0.1</span> %){% elif app not in conf['apps'] %} Není nainstalována{% elif is_service_started(app) %}<span class="info">Spuštěna</span>{% else %}<span class="error">Zastavena</span>{% endif %}</td> <td>{% if total_size %}Stahuje se (<span id="install-progress" data-total="{{ total_size }}">1</span> %){% elif app not in conf['apps'] %} Není nainstalována{% elif is_service_started(app) %}<span class="info">Spuštěna</span>{% else %}<span class="error">Zastavena</span>{% endif %}</td>
<td>{% if total_size %}<div class="loader"></div>{% elif app not in conf['apps'] %}<a href="#" class="app-install">Instalovat</a>{% elif is_service_started(app) %}<a href="#" class="app-stop">Zastavit</a>{% else %}<a href="#" class="app-start">Spustit</a>, <a href="#" class="app-uninstall">Odinstalovat</a>{% endif %}</td> <td>{% if total_size %}<div class="loader"></div>{% elif app not in conf['apps'] %}<a href="#" class="app-install">Instalovat</a>{% elif is_service_started(app) %}<a href="#" class="app-stop">Zastavit</a>{% else %}<a href="#" class="app-start">Spustit</a>, <a href="#" class="app-uninstall">Odinstalovat</a>{% endif %}</td>
</tr> </tr>