mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
Update RTP view of VM Page
This commit is contained in:
parent
e545fb6526
commit
844dfd0f56
2 changed files with 20 additions and 9 deletions
|
@ -170,13 +170,12 @@ def forbidden(e):
|
||||||
@auth.oidc_auth
|
@auth.oidc_auth
|
||||||
def list_vms(user_view=None):
|
def list_vms(user_view=None):
|
||||||
user = User(session['userinfo']['preferred_username'])
|
user = User(session['userinfo']['preferred_username'])
|
||||||
rtp_view = False
|
|
||||||
connect_proxmox()
|
connect_proxmox()
|
||||||
if app.config['FORCE_STANDARD_USER']:
|
if app.config['FORCE_STANDARD_USER']:
|
||||||
user.rtp = False
|
user.rtp = False
|
||||||
if user_view and not user.rtp:
|
if user_view:
|
||||||
abort(403)
|
if not user.rtp:
|
||||||
elif user_view and user.rtp:
|
abort(403)
|
||||||
user_view = User(user_view)
|
user_view = User(user_view)
|
||||||
vms = user_view.vms
|
vms = user_view.vms
|
||||||
for pending_vm in user_view.pending_vms:
|
for pending_vm in user_view.pending_vms:
|
||||||
|
@ -186,10 +185,6 @@ def list_vms(user_view=None):
|
||||||
vms[vms.index(vm)]['pending'] = True
|
vms[vms.index(vm)]['pending'] = True
|
||||||
else:
|
else:
|
||||||
vms.append(pending_vm)
|
vms.append(pending_vm)
|
||||||
rtp_view = user_view.name
|
|
||||||
elif user.rtp:
|
|
||||||
vms = get_pool_cache(db)
|
|
||||||
rtp_view = True
|
|
||||||
else:
|
else:
|
||||||
if user.active:
|
if user.active:
|
||||||
vms = user.vms
|
vms = user.vms
|
||||||
|
@ -202,8 +197,18 @@ def list_vms(user_view=None):
|
||||||
vms.append(pending_vm)
|
vms.append(pending_vm)
|
||||||
else:
|
else:
|
||||||
vms = 'INACTIVE'
|
vms = 'INACTIVE'
|
||||||
return render_template('list_vms.html', user=user, rtp_view=rtp_view, vms=vms)
|
return render_template('list_vms.html', user=user, rtp_view=False, vms=vms)
|
||||||
|
|
||||||
|
@app.route("/pools")
|
||||||
|
def list_pools():
|
||||||
|
user = User(session['userinfo']['preferred_username'])
|
||||||
|
if app.config['FORCE_STANDARD_USER']:
|
||||||
|
user.rtp = False
|
||||||
|
if not user.rtp:
|
||||||
|
abort(403)
|
||||||
|
connect_proxmox()
|
||||||
|
vms = get_pool_cache(db)
|
||||||
|
return render_template('list_vms.html', user=user, rtp_view=True, vms=vms)
|
||||||
|
|
||||||
@app.route('/isos')
|
@app.route('/isos')
|
||||||
@auth.oidc_auth
|
@auth.oidc_auth
|
||||||
|
|
|
@ -55,6 +55,12 @@
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
{% if user.rtp %}
|
{% if user.rtp %}
|
||||||
|
<li class="nav-item navbar-user dropdown">
|
||||||
|
<a class="nav-link" href="/pools">
|
||||||
|
<i class="fas fa-user"></i>
|
||||||
|
User Pools
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li class="nav-item navbar-user dropdown">
|
<li class="nav-item navbar-user dropdown">
|
||||||
<a class="nav-link" href="/rq">
|
<a class="nav-link" href="/rq">
|
||||||
<i class="fas fa-tachometer-alt"></i>
|
<i class="fas fa-tachometer-alt"></i>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue