2023-01-02 17:01:44 +00:00
|
|
|
{% extends 'layouts/bootstrap-dashboard.html' %}
|
|
|
|
|
|
|
|
{% block title %}
|
|
|
|
<title>Origins</title>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
2023-01-04 08:52:15 +00:00
|
|
|
<div>
|
|
|
|
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
|
|
|
|
<h1 class="h2">Leases <small>with origin</small></h1>
|
|
|
|
<div class="btn-toolbar mb-2 mb-md-0">
|
|
|
|
<div class="btn-group me-2">
|
|
|
|
<button type="button" class="btn btn-sm btn-outline-danger" onclick="deleteLease().finally(() => load())">
|
|
|
|
delete lease
|
|
|
|
</button>
|
2023-06-12 09:41:01 +00:00
|
|
|
<button type="button" class="btn btn-sm btn-outline-danger" onclick="deleteExpiredLeases().finally(() => load())">
|
|
|
|
delete all expired leases
|
|
|
|
</button>
|
2023-01-04 08:52:15 +00:00
|
|
|
</div>
|
2023-01-04 11:11:23 +00:00
|
|
|
|
2024-03-04 08:53:06 +00:00
|
|
|
<button type="button" class="btn btn-sm btn-outline-secondary me-2" onclick="load()" title="refresh">
|
2023-01-04 11:11:23 +00:00
|
|
|
<i class="bi bi-arrow-clockwise"></i>
|
|
|
|
</button>
|
2024-03-04 08:53:06 +00:00
|
|
|
<button id="btn-auto-refresh" type="button" class="btn btn-sm active">auto-refresh</button>
|
2023-01-02 17:01:44 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2023-01-04 08:52:15 +00:00
|
|
|
<div id="leases" class="mt-3"></div>
|
|
|
|
</div>
|
2023-01-02 17:01:44 +00:00
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block scripts %}
|
|
|
|
{{ super() }}
|
|
|
|
<script type="application/javascript">
|
2024-03-04 08:53:06 +00:00
|
|
|
let autoRefresh = true
|
|
|
|
|
2023-01-02 17:01:44 +00:00
|
|
|
function load() {
|
|
|
|
const leases = document.getElementById('leases')
|
|
|
|
fetchLeases(leases)
|
|
|
|
}
|
|
|
|
|
|
|
|
load()
|
2024-03-04 08:53:06 +00:00
|
|
|
|
|
|
|
setInterval(() => {
|
|
|
|
if(autoRefresh)
|
|
|
|
load()
|
|
|
|
}, 5000);
|
|
|
|
|
|
|
|
const btnAutoRefresh = document.getElementById('btn-auto-refresh')
|
|
|
|
btnAutoRefresh.addEventListener("click", () => {
|
|
|
|
if(btnAutoRefresh.classList.contains('active')) {
|
|
|
|
autoRefresh = false
|
|
|
|
btnAutoRefresh.classList.remove('active')
|
|
|
|
} else {
|
|
|
|
autoRefresh = false
|
|
|
|
btnAutoRefresh.classList.add('active')
|
|
|
|
}
|
|
|
|
}, true);
|
2023-01-02 17:01:44 +00:00
|
|
|
</script>
|
|
|
|
{% endblock %}
|