mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
Enable stats display on dashboard.
This commit is contained in:
parent
887263342f
commit
d9bf21eaed
@ -31,8 +31,8 @@
|
|||||||
<!-- small box -->
|
<!-- small box -->
|
||||||
<div class="small-box bg-aqua">
|
<div class="small-box bg-aqua">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3>###</h3>
|
<h3>{{ domains|length }}</h3>
|
||||||
<p>Domains</p>
|
<p>{% if domains|length > 1 %}Domains{% else %}Domain{% endif %}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="fa fa-book"></i>
|
<i class="fa fa-book"></i>
|
||||||
@ -43,8 +43,8 @@
|
|||||||
<!-- small box -->
|
<!-- small box -->
|
||||||
<div class="small-box bg-green">
|
<div class="small-box bg-green">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3>###</h3>
|
<h3>{{ users|length }}</h3>
|
||||||
<p>Users</p>
|
<p>{% if users|length > 1 %}Users{% else %}User{% endif %}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="fa fa-users"></i>
|
<i class="fa fa-users"></i>
|
||||||
@ -57,8 +57,8 @@
|
|||||||
<!-- small box -->
|
<!-- small box -->
|
||||||
<div class="small-box bg-green">
|
<div class="small-box bg-green">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3>###</h3>
|
<h3>{{ history_number }}</h3>
|
||||||
<p>Histories</p>
|
<p>{% if history_number > 1 %}Histories{% else %}History{% endif %}</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
<i class="fa fa-calendar"></i>
|
<i class="fa fa-calendar"></i>
|
||||||
@ -69,7 +69,7 @@
|
|||||||
<!-- small box -->
|
<!-- small box -->
|
||||||
<div class="small-box bg-green">
|
<div class="small-box bg-green">
|
||||||
<div class="inner">
|
<div class="inner">
|
||||||
<h3><span style="font-size: 20px">2W 2D 14h 13m</span></h3>
|
<h3><span style="font-size: 18px">{{ uptime|display_second_to_time }}</span></h3>
|
||||||
<p>Uptime</p>
|
<p>Uptime</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="icon">
|
<div class="icon">
|
||||||
|
12
app/views.py
12
app/views.py
@ -135,7 +135,17 @@ def dashboard():
|
|||||||
else:
|
else:
|
||||||
domains = User(id=current_user.id).get_domain()
|
domains = User(id=current_user.id).get_domain()
|
||||||
|
|
||||||
return render_template('dashboard.html', domains=domains)
|
# stats for dashboard
|
||||||
|
domains = Domain.query.all()
|
||||||
|
users = User.query.all()
|
||||||
|
history_number = History.query.count()
|
||||||
|
server = Server(server_id='localhost')
|
||||||
|
statistics = server.get_statistic()
|
||||||
|
if statistics:
|
||||||
|
uptime = filter(lambda uptime: uptime['name'] == 'uptime', statistics)[0]['value']
|
||||||
|
else:
|
||||||
|
uptime = 0
|
||||||
|
return render_template('dashboard.html', domains=domains, users=users, history_number=history_number, uptime=uptime)
|
||||||
|
|
||||||
|
|
||||||
@app.route('/domain/<string:domain_name>', methods=['GET', 'POST'])
|
@app.route('/domain/<string:domain_name>', methods=['GET', 'POST'])
|
||||||
|
Loading…
Reference in New Issue
Block a user