129 lines
4.4 KiB
HTML
129 lines
4.4 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
|
||
|
<head>
|
||
|
<title>Sector List</title>
|
||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.21.1/axios.min.js"></script>
|
||
|
<script type="module" src="/ux/curio-ux.mjs"></script>
|
||
|
|
||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
|
||
|
|
||
|
<link rel="stylesheet" href="https://cdn.datatables.net/2.0.3/css/dataTables.dataTables.min.css" />
|
||
|
<script src="https://cdn.datatables.net/2.0.2/js/dataTables.min.js"></script>
|
||
|
<link rel="stylesheet" href="https://cdn.datatables.net/2.0.3/css/dataTables.bootstrap5.min.css" />
|
||
|
|
||
|
<link rel="stylesheet" href="https://cdn.datatables.net/scroller/2.4.1/css/scroller.dataTables.min.css" />
|
||
|
<script src="https://cdn.datatables.net/scroller/2.4.1/js/dataTables.scroller.min.js"></script>
|
||
|
|
||
|
<link rel="stylesheet" href="https://cdn.datatables.net/responsive/3.0.1/css/responsive.dataTables.min.css" />
|
||
|
<script src="https://cdn.datatables.net/responsive/3.0.1/js/dataTables.responsive.min.js"></script>
|
||
|
|
||
|
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/3.0.1/css/buttons.dataTables.min.css" />
|
||
|
<script src="https://cdn.datatables.net/buttons/3.0.1/js/dataTables.buttons.min.js"></script>
|
||
|
|
||
|
<link rel="stylesheet" href="https://cdn.datatables.net/select/2.0.0/css/select.dataTables.min.css" />
|
||
|
<script src="https://cdn.datatables.net/select/2.0.0/js/dataTables.select.min.js"></script>
|
||
|
</head>
|
||
|
|
||
|
<body style="visibility:hidden" data-bs-theme="dark">
|
||
|
<curio-ux>
|
||
|
<section class="section container-fluid">
|
||
|
<div class="row justify-content-center content">
|
||
|
<div class="col-md-auto" style="max-width: 95%">
|
||
|
<table id="sectorTable" class="hover">
|
||
|
<tr>
|
||
|
<td>Loading...</td>
|
||
|
</tr>
|
||
|
</table>
|
||
|
</div>
|
||
|
</div>
|
||
|
</section>
|
||
|
</curio-ux>
|
||
|
<script>
|
||
|
|
||
|
let dt = new DataTable('#sectorTable', {
|
||
|
ajax: '/api/sector/all',
|
||
|
columns: [
|
||
|
{title: "", data: null},
|
||
|
{title: "Miner", data:'MinerID'},
|
||
|
{title: "Sector", data:'SectorNum'},
|
||
|
{title: "Expiry", data:'ExpiresAt'},
|
||
|
{title: "🔗", data:'IsOnChain'},
|
||
|
{title: "Proving", data:'Proving'},
|
||
|
{title: "Has Sealed", data:'HasSealed'},
|
||
|
{title: "Has Unsealed", data:'HasUnsealed'},
|
||
|
{title: "DealWeight", data:"DealWeight"},
|
||
|
{title: "Deals", data:"Deals"},
|
||
|
{title: "Fil+", data:'IsFilPlus'},
|
||
|
{title: "Has Snap", data:'HasSnap'},
|
||
|
{title: "Size", data:"SealInfo"},
|
||
|
{title: "Flag", data:"Flag"}
|
||
|
],
|
||
|
layout: {
|
||
|
topStart: 'buttons',
|
||
|
bottomStart: 'info',
|
||
|
},
|
||
|
buttons: [
|
||
|
{
|
||
|
extend: 'copy',
|
||
|
text: '📋'
|
||
|
},
|
||
|
'csv',
|
||
|
{
|
||
|
extend: 'selected',
|
||
|
text: 'Terminate & Delete',
|
||
|
action: function (e, dt, button, config) {
|
||
|
var res = dt.rows({ selected: true }).data().map(function (row) {
|
||
|
return {MinerID: row.MinerID, Sector: row.SectorNum};
|
||
|
});
|
||
|
|
||
|
if (confirm("Terminate & Delete: "+res.join(", "))) {
|
||
|
axios.post('/api/sector/terminate', res)
|
||
|
.then(function (response) {
|
||
|
console.log(response);
|
||
|
document.cookie = "sector_refresh=true; path=/";
|
||
|
location.reload();
|
||
|
})
|
||
|
.catch(function (error) {
|
||
|
console.log(error);
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
},
|
||
|
{
|
||
|
text: 'Refresh',
|
||
|
action: function (e, dt, button, config) {
|
||
|
document.cookie = "sector_refresh=true; path=/";
|
||
|
location.reload();
|
||
|
}
|
||
|
}
|
||
|
],
|
||
|
responsive: true,
|
||
|
columnDefs: [
|
||
|
{
|
||
|
orderable: false,
|
||
|
render: DataTable.render.select(),
|
||
|
targets: 0
|
||
|
},
|
||
|
{
|
||
|
targets: 13,
|
||
|
visible: false, // Make the "Flag" column hidden
|
||
|
searchable: false,
|
||
|
}
|
||
|
],
|
||
|
order: [[13, 'desc'], [1, 'asc'], [2, 'asc']],
|
||
|
select: {
|
||
|
style: 'multi',
|
||
|
selector: 'td:first-child',
|
||
|
items: 'row',
|
||
|
rows: '%d rows selected',
|
||
|
headerCheckbox: true,
|
||
|
},
|
||
|
scrollY: window.innerHeight - 150,
|
||
|
deferRender: true,
|
||
|
scroller: true,
|
||
|
});
|
||
|
</script>
|
||
|
</body>
|
||
|
|
||
|
</html>
|