Added filter buttons in uptime view.

This commit is contained in:
Christian P. MOMON 2021-07-03 22:44:19 +02:00
parent 164498339d
commit 4159387133

View file

@ -15,6 +15,8 @@
<h2>Disponibilité des services</h2> <h2>Disponibilité des services</h2>
<div style="margin-left: 0px; margin-bottom: 10px;"> <div style="margin-left: 0px; margin-bottom: 10px;">
<a id="allButton" class="button" href="#">Tout</a> <a id="allButton" class="button" href="#">Tout</a>
<a href="#" id="alertButton" class="button">Alertes</a>
<a href="#" id="fixedButton" class="button">Rétablis</a>
<a id="nokButton" class="button" href="#">Indisponibles</a> <a id="nokButton" class="button" href="#">Indisponibles</a>
</div> </div>
@ -121,32 +123,48 @@ $(document).ready(function()
language: dataTableFrench language: dataTableFrench
}); });
var showAll=1;
$("#nokButton").click(function()
{
if (showAll == 1)
{
showAll=0;
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex)
{
return !table.cell(dataIndex, 23).data().includes('-ok');
}
);
table.draw();
}
});
$("#allButton").click(function() $("#allButton").click(function()
{ {
if (showAll == 0) $.fn.dataTable.ext.search.pop();
{ table.draw();
showAll=1;
$.fn.dataTable.ext.search.pop();
table.draw();
}
}); });
$("#nokButton").click(function()
{
$.fn.dataTable.ext.search.pop();
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex)
{
var result;
return !(table.cell(dataIndex, 23).data().includes('status-ok') || table.cell(dataIndex, 23).data().includes('status-warning'));
}
);
table.draw();
});
$("#fixedButton").click(function()
{
$.fn.dataTable.ext.search.pop();
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex)
{
return table.cell(dataIndex, 23).data().includes('status-warning');
}
);
table.draw();
});
$("#alertButton").click(function()
{
$.fn.dataTable.ext.search.pop();
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex)
{
return !table.cell(dataIndex, 23).data().includes('status-ok');
}
);
table.draw();
});
}); });
</script> </script>
</body> </body>