summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py16
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']