mirror of
https://github.com/ComputerScienceHouse/proxstar.git
synced 2025-03-09 15:40:09 +00:00
added basic csh bootstrap theme
This commit is contained in:
parent
a78529f2b1
commit
2f9f8d164e
9 changed files with 124 additions and 53 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
config.py
|
config.py
|
||||||
|
__pycache__/*
|
||||||
|
|
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "static/css/csh-material-bootstrap"]
|
||||||
|
path = static/css/csh-material-bootstrap
|
||||||
|
url = https://github.com/ComputerScienceHouse/csh-material-bootstrap/
|
12
app.py
12
app.py
|
@ -1,6 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import psycopg2
|
import psycopg2
|
||||||
|
import subprocess
|
||||||
from starrs import *
|
from starrs import *
|
||||||
from proxmox import *
|
from proxmox import *
|
||||||
from proxmoxer import ProxmoxAPI
|
from proxmoxer import ProxmoxAPI
|
||||||
|
@ -15,6 +16,11 @@ config = os.path.join(app.config.get('ROOT_DIR', os.getcwd()), "config.py")
|
||||||
|
|
||||||
app.config.from_pyfile(config)
|
app.config.from_pyfile(config)
|
||||||
|
|
||||||
|
app.config["GIT_REVISION"] = subprocess.check_output(['git',
|
||||||
|
'rev-parse',
|
||||||
|
'--short',
|
||||||
|
'HEAD']).decode('utf-8').rstrip()
|
||||||
|
|
||||||
|
|
||||||
user = 'proxstar'
|
user = 'proxstar'
|
||||||
proxmox = connect_proxmox(app.config['PROXMOX_HOST'], app.config['PROXMOX_USER'], app.config['PROXMOX_PASS'])
|
proxmox = connect_proxmox(app.config['PROXMOX_HOST'], app.config['PROXMOX_USER'], app.config['PROXMOX_PASS'])
|
||||||
|
@ -28,12 +34,12 @@ def get_vms():
|
||||||
vm['config'] = get_vm_config(proxmox, vm['vmid'])
|
vm['config'] = get_vm_config(proxmox, vm['vmid'])
|
||||||
vm['disk_size'] = get_vm_disk_size(proxmox, vm['vmid'], config=vm['config'])
|
vm['disk_size'] = get_vm_disk_size(proxmox, vm['vmid'], config=vm['config'])
|
||||||
print(vm)
|
print(vm)
|
||||||
return render_template('get_vms.html', vms=vms)
|
return render_template('get_vms.html', username='com6056', vms=vms)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/create")
|
@app.route("/create")
|
||||||
def create():
|
def create():
|
||||||
return render_template('create.html')
|
return render_template('create.html', username='com6056')
|
||||||
|
|
||||||
|
|
||||||
@app.route("/get_create", methods=['POST'])
|
@app.route("/get_create", methods=['POST'])
|
||||||
|
@ -53,7 +59,7 @@ def get_create():
|
||||||
def delete():
|
def delete():
|
||||||
vmid = request.form['delete']
|
vmid = request.form['delete']
|
||||||
vmname = get_vm_config(proxmox, vmid)['name']
|
vmname = get_vm_config(proxmox, vmid)['name']
|
||||||
return render_template('confirm_delete.html', vmid=vmid, vmname=vmname)
|
return render_template('confirm_delete.html', username='com6056', vmid=vmid, vmname=vmname)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/confirm_delete", methods=['POST'])
|
@app.route("/confirm_delete", methods=['POST'])
|
||||||
|
|
1
static/css/csh-material-bootstrap
Submodule
1
static/css/csh-material-bootstrap
Submodule
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit bfeaa127d622489c5f46bdbb0c931da33f89e25a
|
6
static/css/styles.css
Normal file
6
static/css/styles.css
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
body {
|
||||||
|
margin-top: 60px;
|
||||||
|
}
|
||||||
|
table, th, td {
|
||||||
|
border: 1px solid black;
|
||||||
|
}
|
95
templates/base.html
Normal file
95
templates/base.html
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<title>Proxstar</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
|
<meta name="theme-color" content="#B0197E">
|
||||||
|
<link rel="stylesheet" href="/proxstar/static/css/csh-material-bootstrap/dist/css/csh-material-bootstrap.css">
|
||||||
|
<link rel="stylesheet" href="/proxstar/static/css/styles.css">
|
||||||
|
<link rel="manifest" href="/static/manifest.json">
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
{% block nav %}
|
||||||
|
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
|
||||||
|
aria-expanded="false" aria-controls="navbar">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="/proxstar">Proxstar</a>
|
||||||
|
</div>
|
||||||
|
<div id="navbar" class="navbar-collapse collapse">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li>
|
||||||
|
<a href="/proxstar">
|
||||||
|
<span class="glyphicon glyphicon-th-list"></span>
|
||||||
|
VM List
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/proxstar/create">
|
||||||
|
<span class="glyphicon glyphicon-th-list"></span>
|
||||||
|
Create VM
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li class="dropdown navbar-user">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown"
|
||||||
|
role="button" aria-expanded="false">
|
||||||
|
<img src="https://profiles.csh.rit.edu/image/{{ username }}"
|
||||||
|
title="{{ username }}">
|
||||||
|
{{ username }}
|
||||||
|
<span class="caret"></span>
|
||||||
|
</a>
|
||||||
|
<ul class="dropdown-menu" role="menu">
|
||||||
|
<li>
|
||||||
|
<a href="/settings">
|
||||||
|
<span class="glyphicon glyphicon-cog"></span>
|
||||||
|
Settings
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="divider"></li>
|
||||||
|
<li>
|
||||||
|
<a href="https://profiles.csh.rit.edu/user/{{ username }}">
|
||||||
|
<span class="glyphicon glyphicon-user"></span>
|
||||||
|
Profile
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="https://members.csh.rit.edu/">
|
||||||
|
<span class="glyphicon glyphicon-globe"></span>
|
||||||
|
Members Portal
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/logout">
|
||||||
|
Logout
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
{% endblock %}
|
||||||
|
<body>
|
||||||
|
{% block body %}
|
||||||
|
{% endblock %}
|
||||||
|
<footer>
|
||||||
|
<br>
|
||||||
|
<div class="version">
|
||||||
|
<a class="footer-version" href="https://github.com/com6056/proxstar/tree/{{config["GIT_REVISION"]}}">Proxstar ({{config["GIT_REVISION"]}})</a>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</body>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -1,14 +1,5 @@
|
||||||
<!DOCTYPE html>
|
{% extends "base.html" %}
|
||||||
<html>
|
{% block body %}
|
||||||
<head>
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<a href="/proxstar/create">Create VM</a>
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
Are you sure you want to delete "{{ vmname }}"?
|
Are you sure you want to delete "{{ vmname }}"?
|
||||||
|
|
||||||
|
@ -16,5 +7,4 @@ Are you sure you want to delete "{{ vmname }}"?
|
||||||
<button type="submit" name="delete" value="{{ vmid }}">CONFIRM</button>
|
<button type="submit" name="delete" value="{{ vmid }}">CONFIRM</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
|
|
|
@ -1,21 +1,5 @@
|
||||||
<!DOCTYPE html>
|
{% extends "base.html" %}
|
||||||
<html>
|
{% block body %}
|
||||||
<head>
|
|
||||||
<style>
|
|
||||||
table, th, td {
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<a href="/proxstar/">VM List</a>
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
Create VM
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
<form action="get_create" method="post">
|
<form action="get_create" method="post">
|
||||||
<label for="name">VM Name</label>
|
<label for="name">VM Name</label>
|
||||||
|
@ -37,5 +21,4 @@ Create VM
|
||||||
<input type="submit">
|
<input type="submit">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</body>
|
{% endblock %}
|
||||||
</html>
|
|
||||||
|
|
|
@ -1,17 +1,5 @@
|
||||||
<!DOCTYPE html>
|
{% extends "base.html" %}
|
||||||
<html>
|
{% block body %}
|
||||||
<head>
|
|
||||||
<style>
|
|
||||||
table, th, td {
|
|
||||||
border: 1px solid black;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<a href="/proxstar/create">Create VM</a>
|
|
||||||
|
|
||||||
<br><br>
|
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -41,6 +29,4 @@ table, th, td {
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
{{ vms }}
|
{{ vms }}
|
||||||
|
{% endblock %}
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue