Display online packages in setup-apps

This commit is contained in:
Disassembler 2018-10-21 11:36:32 +02:00
parent 07a195ab05
commit ac69aebf4e
Signed by: Disassembler
GPG Key ID: 524BD33A0EE29499
4 changed files with 33 additions and 5 deletions

View File

@ -4,9 +4,9 @@ import os
import shutil
import subprocess
from . import config
from . import tools
from . import validator
from .config import Config
VERSION = '0.0.1'
@ -123,7 +123,7 @@ subjectAltName=DNS:{domain},DNS:*.{domain}"
class VMMgr:
def __init__(self):
# Load JSON configuration
self.conf = config.Config()
self.conf = Config()
self.domain = self.conf['host']['domain']
self.port = self.conf['host']['port']

View File

@ -14,7 +14,7 @@ from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import ec
from cryptography.hazmat.primitives.serialization import load_pem_public_key
from . import config
from .config import Config
PUB_FILE = '/srv/vm/packages.pub'
LXC_ROOT = '/var/lib/lxc'
@ -22,7 +22,7 @@ LXC_ROOT = '/var/lib/lxc'
class PackageManager:
def __init__(self):
# Load JSON configuration
self.conf = config.Config()
self.conf = Config()
self.repo_url = self.conf['host']['repo']
self.online_packages = {}

View File

@ -12,6 +12,7 @@ from jinja2 import Environment, FileSystemLoader
from . import VMMgr, CERT_PUB_FILE
from . import tools
from .pkgmgr import PackageManager
from .validator import InvalidValueException
from .wsgilang import WSGILang
from .wsgisession import WSGISession
@ -135,7 +136,9 @@ class WSGIApp(object):
def setup_apps_view(self, request):
# Application manager view.
return self.render_template('setup-apps.html', request)
pkgmgr = PackageManager()
pkgmgr.fetch_online_packages()
return self.render_template('setup-apps.html', request, online_packages=pkgmgr.online_packages)
def update_host_action(self, request):
# Update domain and port, then restart nginx

View File

@ -56,6 +56,31 @@
</table>
</div>
<div class="setup-box">
<h2>Správce balíků</h2>
<p>Vyberte které aplikace mají být nainstalovány nebo aktualizovány z distribučního serveru.</p>
<table>
<thead>
<tr>
<td>Aplikace</td>
<td>Nainstalována</td>
<td>Stav</td>
</tr>
</thead>
<tbody>
{% for pkg in online_packages|sort %}
{% if 'title' in online_packages[pkg] %}
<tr data-app="{{ pkg }}">
<td>{{ online_packages[pkg]['title'] }}</td>
<td class="center"><input type="checkbox" class="pkg-installed"{% if pkg in conf['packages'] %} checked{% endif %}></td>
<td></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
<div class="setup-box">
<h2>Správce virtuálního stroje</h2>
<p>Změna hesla k šifrovanému diskovému oddílu a administračnímu rozhraní.</p>