mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
Add recent history functionality to dashboard template.
This commit is contained in:
parent
d9bf21eaed
commit
a313eb2203
@ -84,10 +84,10 @@
|
|||||||
<div class="col-xs-9">
|
<div class="col-xs-9">
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<div class="box-header">
|
<div class="box-header">
|
||||||
<h3 class="box-title">Recent Logs</h3>
|
<h3 class="box-title">Recent History</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="box-body">
|
<div class="box-body">
|
||||||
<table id="tbl_domain_list" class="table table-bordered table-striped">
|
<table id="tbl_history" class="table table-bordered table-striped">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Changed By</th>
|
<th>Changed By</th>
|
||||||
@ -97,20 +97,18 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
{% for history in histories %}
|
||||||
<td>
|
<tr class="odd">
|
||||||
ivan
|
<td>{{ history.created_by }}</td>
|
||||||
</td>
|
<td>{{ history.msg }}</td>
|
||||||
<td>
|
<td>{{ history.created_on }}</td>
|
||||||
log log log
|
<td width="6%">
|
||||||
</td>
|
<button type="button" class="btn btn-flat btn-primary history-info-button" value='{{ history.detail|replace("[]","None") }}'>
|
||||||
<td>
|
Info <i class="fa fa-info"></i>
|
||||||
5:52pm 21/4/2016
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
</tr>
|
||||||
Detail button
|
{% endfor %}
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@ -203,3 +201,48 @@
|
|||||||
</section>
|
</section>
|
||||||
<!-- /.content -->
|
<!-- /.content -->
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
{% block extrascripts %}
|
||||||
|
<script>
|
||||||
|
// set up history data table
|
||||||
|
$("#tbl_history").DataTable({
|
||||||
|
"paging" : false,
|
||||||
|
"lengthChange" : false,
|
||||||
|
"searching" : false,
|
||||||
|
"ordering" : false,
|
||||||
|
"info" : false,
|
||||||
|
"autoWidth" : false
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".history-info-button").click(function() {
|
||||||
|
var modal = $("#modal_history_info");
|
||||||
|
var info = $(this).val();
|
||||||
|
modal.find('.modal-body p').text(info);
|
||||||
|
modal.modal('show');
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
||||||
|
{% block modals %}
|
||||||
|
<div class="modal fade" id="modal_history_info">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal"
|
||||||
|
aria-label="Close">
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">History Details</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<p></p>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default pull-right"
|
||||||
|
data-dismiss="modal">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /.modal-content -->
|
||||||
|
</div>
|
||||||
|
<!-- /.modal-dialog -->
|
||||||
|
</div>
|
||||||
|
<!-- /.modal -->
|
||||||
|
{% endblock %}
|
||||||
|
@ -139,13 +139,14 @@ def dashboard():
|
|||||||
domains = Domain.query.all()
|
domains = Domain.query.all()
|
||||||
users = User.query.all()
|
users = User.query.all()
|
||||||
history_number = History.query.count()
|
history_number = History.query.count()
|
||||||
|
history = History.query.limit(4)
|
||||||
server = Server(server_id='localhost')
|
server = Server(server_id='localhost')
|
||||||
statistics = server.get_statistic()
|
statistics = server.get_statistic()
|
||||||
if statistics:
|
if statistics:
|
||||||
uptime = filter(lambda uptime: uptime['name'] == 'uptime', statistics)[0]['value']
|
uptime = filter(lambda uptime: uptime['name'] == 'uptime', statistics)[0]['value']
|
||||||
else:
|
else:
|
||||||
uptime = 0
|
uptime = 0
|
||||||
return render_template('dashboard.html', domains=domains, users=users, history_number=history_number, uptime=uptime)
|
return render_template('dashboard.html', domains=domains, users=users, history_number=history_number, uptime=uptime, histories=history)
|
||||||
|
|
||||||
|
|
||||||
@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