forked from 3wordchant/capsul-flask
metrics are working!!!
This commit is contained in:
@ -12,8 +12,8 @@ from flask_mail import Message
|
||||
from werkzeug.exceptions import abort
|
||||
from nanoid import generate
|
||||
|
||||
from capsulflask.metrics import durations as metric_durations
|
||||
from capsulflask.auth import account_required
|
||||
|
||||
from capsulflask.db import get_model, my_exec_info_message
|
||||
|
||||
bp = Blueprint("console", __name__, url_prefix="/console")
|
||||
@ -53,7 +53,7 @@ def index():
|
||||
ipv4=(x['ipv4'] if x['ipv4'] else "..booting.."),
|
||||
ipv4_status=("ok" if x['ipv4'] else "waiting-pulse"),
|
||||
os=x['os'],
|
||||
created=x['created'].strftime("%b %d %Y %H:%M")
|
||||
created=x['created'].strftime("%b %d %Y")
|
||||
),
|
||||
vms
|
||||
))
|
||||
@ -63,6 +63,11 @@ def index():
|
||||
@bp.route("/<string:id>")
|
||||
@account_required
|
||||
def detail(id):
|
||||
|
||||
duration=request.args.get('duration')
|
||||
if not duration:
|
||||
duration = "5m"
|
||||
|
||||
vm = get_model().get_vm_detail(email=session["account"], id=id)
|
||||
|
||||
if vm is None:
|
||||
@ -72,7 +77,12 @@ def detail(id):
|
||||
vm["created"] = vm['created'].strftime("%b %d %Y %H:%M")
|
||||
vm["ssh_public_keys"] = ", ".join(vm["ssh_public_keys"]) if len(vm["ssh_public_keys"]) > 0 else "<deleted>"
|
||||
|
||||
return render_template("capsul-detail.html", vm=vm)
|
||||
return render_template(
|
||||
"capsul-detail.html",
|
||||
vm=vm,
|
||||
durations=list(map(lambda x: x.strip("_"), metric_durations.keys())),
|
||||
duration=duration
|
||||
)
|
||||
|
||||
|
||||
@bp.route("/create", methods=("GET", "POST"))
|
||||
|
Reference in New Issue
Block a user