Web Interface ok
This commit is contained in:
56
web/public/static/table.js
Normal file
56
web/public/static/table.js
Normal file
@ -0,0 +1,56 @@
|
||||
function pagination_link(name, value){
|
||||
let link_args = db_args;
|
||||
if (name && value){
|
||||
link_args[name] = value;
|
||||
}
|
||||
else if(name){
|
||||
delete link_args[name];
|
||||
}
|
||||
return '?' + $.param( link_args );
|
||||
}
|
||||
$(".value_filter").change((e)=>{
|
||||
window.location = pagination_link($(e.target).attr('name').substr('filter_'.length), $(e.target).val())
|
||||
});
|
||||
|
||||
function enable_auto_refresh(){
|
||||
setInterval( () => {
|
||||
if($('#autoRefresh').prop('checked')){
|
||||
$.get(
|
||||
'/app/table/total' + pagination_link(),
|
||||
(v) => {
|
||||
if( v != db_total ){
|
||||
window.location = pagination_link()
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}, 1000);
|
||||
sessionStorage.setItem('auto_refresh', $('#autoRefresh').prop('checked'));
|
||||
}
|
||||
$("#autoRefresh").click(enable_auto_refresh);
|
||||
if(sessionStorage.hasOwnProperty('auto_refresh') && sessionStorage.getItem('auto_refresh') === 'true'){
|
||||
$("#autoRefresh").prop('checked', true);
|
||||
enable_auto_refresh()
|
||||
}
|
||||
|
||||
function send_json_message(json_str){
|
||||
$.ajax(
|
||||
"/message",
|
||||
{
|
||||
contentType : 'application/json',
|
||||
type : 'POST',
|
||||
data: json_str,
|
||||
},
|
||||
).then((d) => {
|
||||
$("#message_sent .modal-title").text("Message Sent");
|
||||
$("#message_sent .modal-body").html('<pre>'+JSON.stringify(d, null, 2)+'</pre>');
|
||||
new bootstrap.Modal('#message_sent').show();
|
||||
}).fail((d)=>{
|
||||
$("#message_sent .modal-title").text("Error Sending Message");
|
||||
$("#message_sent .modal-body").html('<pre>'+JSON.stringify(d, null, 2)+'</pre>');
|
||||
new bootstrap.Modal('#message_sent').show();
|
||||
});
|
||||
}
|
||||
$(".send_message_again").click(
|
||||
(e) => send_json_message( $("pre#row_message_raw_"+$(e.target).attr('idx')).text() )
|
||||
);
|
Reference in New Issue
Block a user