diff --git a/basic/srv/vm/mgr/wsgiapp.py b/basic/srv/vm/mgr/wsgiapp.py index 503dca3..8b06ba3 100644 --- a/basic/srv/vm/mgr/wsgiapp.py +++ b/basic/srv/vm/mgr/wsgiapp.py @@ -295,14 +295,14 @@ class WSGIApp(object): except: return self.render_json({'error': request.session.lang.package_manager_error()}) app_title = self.pkgmgr.online_packages[app]['title'] - response = self.render_json({'ok': self.render_setup_apps_row(app, app_title, '{:.1f}'.format(total_size / 1048576))}) + response = self.render_json({'ok': self.render_setup_apps_row(app, app_title, total_size)}) response.call_on_close(lambda: self.pkgmgr.install_package(app)) return response def get_install_progress_action(self, request): # Gets pending installation status if self.pkgmgr.pending: - return self.render_json({'progress': '{:.1f}'.format(self.pkgmgr.pending / 1048576)}) + return self.render_json({'progress': self.pkgmgr.pending}) app = request.form['app'] app_title = self.conf['apps'][app]['title'] return self.render_json({'ok': self.render_setup_apps_row(app, app_title)}) @@ -312,7 +312,6 @@ class WSGIApp(object): try: app = request.form['app'] app_title = self.conf['apps'][app]['title'] - self.vmmgr.stop_app(app) self.pkgmgr.uninstall_package(app) except (BadRequest, InvalidValueException): return self.render_json({'error': request.session.lang.malformed_request()}) diff --git a/basic/srv/vm/static/js/admin.js b/basic/srv/vm/static/js/admin.js index db5ffb8..93fca95 100644 --- a/basic/srv/vm/static/js/admin.js +++ b/basic/srv/vm/static/js/admin.js @@ -178,7 +178,8 @@ function check_progress() { var tr = progress.closest('tr'); $.post('/get-install-progress', {'app': tr.data('app')}, function(data) { if (data.progress) { - progress.text(data.progress); + var value = Math.max(0.1, Math.min(data.progress / progress.data('total') * 100, 99.9)); + progress.text(parseFloat(value).toFixed(1)); } else { tr.replaceWith(data.ok); } diff --git a/basic/srv/vm/templates/setup-apps-row.html b/basic/srv/vm/templates/setup-apps-row.html index ad0d6d4..b7bd6d7 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 / {{ total_size }} MB){% 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{% else %}{% if is_service_started(app) %}Zastavit{% else %}Spustit{% endif %}, Odinstalovat{% endif %} + {% 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 %}
{% elif app not in conf['apps'] %}Instalovat{% elif is_service_started(app) %}Zastavit{% else %}Spustit, Odinstalovat{% endif %}