diff options
author | Jose M. Guisado <jguisado@soleta.eu> | 2021-03-24 14:32:16 +0100 |
---|---|---|
committer | Jose M. Guisado <jguisado@soleta.eu> | 2021-03-24 14:32:16 +0100 |
commit | 2ad382b5ed0e927121308f83a51d8f3a89d41e50 (patch) | |
tree | aace4bb10735a98e979780fee395c71b36d38d30 /ogcp/views.py | |
parent | 9ee0565ac41661a0521630fbfe1ea9e896fcec52 (diff) |
Add cosmetic improvements
* Adds label for each action page.
* Adds a colored state for opengnsys connected clients
* Fix nav active item
* Rename some actions
* Adds DISK to partition and format form
Diffstat (limited to 'ogcp/views.py')
-rw-r--r-- | ogcp/views.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index c7a05e7..627f772 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -75,8 +75,16 @@ def get_client_setup(ip): partition['code'] = PART_TYPE_CODES[partition['code']] partition['filesystem'] = FS_CODES[partition['filesystem']] + return db_partitions +def get_clients(state_filter=None): + r = g.server.get('/clients') + clients = r.json() + if state_filter: + return filter(clients.items(), lambda c: c.state == state_filter) + return clients + def parse_scopes_from_tree(tree, scope_type): scopes = [] for scope in tree['scope']: @@ -106,6 +114,10 @@ def server_error(error): @app.route('/') def index(): + clients = None + if current_user.is_authenticated: + clients = get_clients() + return render_template('dashboard.html', clients=clients) return render_template('base.html') @app.route('/login', methods=['GET', 'POST']) @@ -196,8 +208,10 @@ def action_setup_show(): form.disk.data = db_part['disk'] form.partition.data = db_part['partition'] # XXX: Should separate whole disk form from partition setup form - if db_part['code'] in PART_SCHEME_CODES.values(): + if db_part['filesystem'] == "DISK": form.part_type.choices = list(PART_SCHEME_CODES.values()) + form.fs.render_kw = {'disabled': ''} + form.part_type.data = db_part['code'] form.fs.data = db_part['filesystem'] form.size.data = db_part['size'] |