mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 14:40:27 +00:00
Enable stats display on dashboard.
This commit is contained in:
parent
887263342f
commit
d9bf21eaed
@ -31,8 +31,8 @@
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-aqua">
|
||||
<div class="inner">
|
||||
<h3>###</h3>
|
||||
<p>Domains</p>
|
||||
<h3>{{ domains|length }}</h3>
|
||||
<p>{% if domains|length > 1 %}Domains{% else %}Domain{% endif %}</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-book"></i>
|
||||
@ -43,8 +43,8 @@
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-green">
|
||||
<div class="inner">
|
||||
<h3>###</h3>
|
||||
<p>Users</p>
|
||||
<h3>{{ users|length }}</h3>
|
||||
<p>{% if users|length > 1 %}Users{% else %}User{% endif %}</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-users"></i>
|
||||
@ -57,8 +57,8 @@
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-green">
|
||||
<div class="inner">
|
||||
<h3>###</h3>
|
||||
<p>Histories</p>
|
||||
<h3>{{ history_number }}</h3>
|
||||
<p>{% if history_number > 1 %}Histories{% else %}History{% endif %}</p>
|
||||
</div>
|
||||
<div class="icon">
|
||||
<i class="fa fa-calendar"></i>
|
||||
@ -69,7 +69,7 @@
|
||||
<!-- small box -->
|
||||
<div class="small-box bg-green">
|
||||
<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>
|
||||
</div>
|
||||
<div class="icon">
|
||||
|
12
app/views.py
12
app/views.py
@ -135,7 +135,17 @@ def dashboard():
|
||||
else:
|
||||
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'])
|
||||
|
Loading…
Reference in New Issue
Block a user