mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-08 22:50:26 +00:00
Convert admin_history template to use AJAX applicator in custom.js
This commit is contained in:
parent
fb4d5b3f56
commit
c95fd6ffec
@ -0,0 +1,27 @@
|
|||||||
|
function applyChanges(data, url, showResult) {
|
||||||
|
var success = false;
|
||||||
|
$.ajax({
|
||||||
|
type : "POST",
|
||||||
|
url : url,
|
||||||
|
data : JSON.stringify(data),// now data come in this function
|
||||||
|
contentType : "application/json; charset=utf-8",
|
||||||
|
crossDomain : true,
|
||||||
|
dataType : "json",
|
||||||
|
success : function(data, status, jqXHR) {
|
||||||
|
console.log("Applied changes successfully.")
|
||||||
|
if (showResult) {
|
||||||
|
var modal = $("#modal_success");
|
||||||
|
modal.find('.modal-body p').text("Applied changes successfully");
|
||||||
|
modal.modal('show');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
error : function(jqXHR, status) {
|
||||||
|
console.log(jqXHR);
|
||||||
|
var modal = $("#modal_error");
|
||||||
|
modal.find('.modal-body p').text(jqXHR["responseText"]);
|
||||||
|
modal.modal('show');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
@ -78,25 +78,6 @@
|
|||||||
modal.find('.modal-body p').text(info);
|
modal.find('.modal-body p').text(info);
|
||||||
modal.modal('show');
|
modal.modal('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
// ajax call to clear history table
|
|
||||||
function clearHistoryTable() {
|
|
||||||
$.ajax({
|
|
||||||
type : "POST",
|
|
||||||
url : '/admin/history',
|
|
||||||
data : '',
|
|
||||||
contentType : "application/json; charset=utf-8",
|
|
||||||
crossDomain : true,
|
|
||||||
dataType : "json",
|
|
||||||
success : function(data, status, jqXHR) {
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
error : function(jqXHR, status) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block modals %}
|
{% block modals %}
|
||||||
@ -117,7 +98,7 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-default pull-left"
|
<button type="button" class="btn btn-default pull-left"
|
||||||
data-dismiss="modal">Close</button>
|
data-dismiss="modal">Close</button>
|
||||||
<button type="button" class="btn btn-danger" onclick="clearHistoryTable();location.reload();">Clear
|
<button type="button" class="btn btn-danger" onclick="applyChanges('', '/admin/history');location.reload();">Clear
|
||||||
History</button>
|
History</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user