mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
c00ddea2fc
Added server-side logic for register.html validation Keep form firelds on register.html in the event of wrong input fields to save users from retyping info More button rounding
144 lines
4.4 KiB
HTML
144 lines
4.4 KiB
HTML
{% extends "base.html" %}
|
|
|
|
{% set active_page = "admin_keys" %}
|
|
|
|
{% block title %}
|
|
<title>
|
|
Key Management - {{ SITE_NAME }}
|
|
</title>
|
|
{% endblock %}
|
|
|
|
{% block dashboard_stat %}
|
|
<div class="content-header">
|
|
<div class="container-fluid">
|
|
<div class="row mb-2">
|
|
<div class="col-sm-6">
|
|
<h1 class="m-0 text-dark">
|
|
API Keys
|
|
<small>Management</small>
|
|
</h1>
|
|
</div>
|
|
<div class="col-sm-6">
|
|
<ol class="breadcrumb float-sm-right">
|
|
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li>
|
|
<li class="breadcrumb-item active">API Keys</li>
|
|
</ol>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
<section class="content">
|
|
<div class="container-fluid">
|
|
<div class="card">
|
|
<div class="card-header with-border">
|
|
<h3 class="card-title">Key Management</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<a href="{{ url_for('admin.edit_key') }}">
|
|
<button type="button" class="btn btn-primary pull-left button_add_key">
|
|
Add Key <i class="fa fa-plus"></i>
|
|
</button>
|
|
</a>
|
|
</div>
|
|
<div class="card-body">
|
|
<table id="tbl_keys" class="table table-bordered table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>Id</th>
|
|
<th>Role</th>
|
|
<th>Description</th>
|
|
<th>Domains</th>
|
|
<th>Accounts</th>
|
|
<th>Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for key in keys %}
|
|
<tr class="odd gradeX">
|
|
<td>{{ key.id }}</td>
|
|
<td>{{ key.role.name }}</td>
|
|
<td>{{ key.description }}</td>
|
|
<td>{% for domain in key.domains %}{{ domain.name }}{% if not loop.last %}, {% endif %}{% endfor %}</td>
|
|
<td>{% for account in key.accounts %}{{ account.name }}{% if not loop.last %}, {% endif %}{% endfor %}</td>
|
|
<td width="15%">
|
|
<button type="button" class="btn btn-flat btn-success button_edit"
|
|
onclick="window.location.href='{{ url_for('admin.edit_key', key_id=key.id) }}'">
|
|
Edit <i class="fa fa-lock"></i>
|
|
</button>
|
|
<button type="button" class="btn btn-flat btn-danger button_delete"
|
|
id="{{ key.id }}">
|
|
Delete <i class="fa fa-trash"></i>
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
{% endblock %}
|
|
|
|
{% block extrascripts %}
|
|
<script>
|
|
// set up key data table
|
|
$("#tbl_keys").DataTable({
|
|
"paging": true,
|
|
"lengthChange": true,
|
|
"searching": true,
|
|
"ordering": true,
|
|
"info": false,
|
|
"autoWidth": false,
|
|
"lengthMenu": [
|
|
[10, 25, 50, 100, -1],
|
|
[10, 25, 50, 100, "All"]
|
|
],
|
|
"pageLength": 10
|
|
});
|
|
|
|
// handle deletion of keys
|
|
$(document.body).on('click', '.button_delete', function () {
|
|
var modal = $("#modal_delete");
|
|
var key_id = $(this).prop('id');
|
|
var info = "Are you sure you want to delete key #" + key_id + "?";
|
|
modal.find('.modal-body p').text(info);
|
|
modal.find('#button_delete_confirm').click(function () {
|
|
var postdata = {
|
|
'action': 'delete_key',
|
|
'data': key_id,
|
|
'_csrf_token': '{{ csrf_token() }}'
|
|
}
|
|
applyChanges(postdata, $SCRIPT_ROOT + '/admin/manage-keys', false, true);
|
|
modal.modal('hide');
|
|
})
|
|
modal.modal('show');
|
|
});
|
|
</script>
|
|
{% endblock %}
|
|
|
|
{% block modals %}
|
|
<div class="modal fade modal-warning" id="modal_delete">
|
|
<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">Confirmation</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p></p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-default float-left" data-dismiss="modal">Close</button>
|
|
<button type="button" class="btn btn-danger" id="button_delete_confirm">Delete</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|