mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Add ipsec widget to new centralized refresh system
This commit is contained in:
parent
d7c2f4fe6c
commit
53547a05e0
@ -569,7 +569,7 @@ function set_widget_checkbox_events(checkbox_panel_ref, all_none_button_id) {
|
||||
|
||||
// --------------------- EXPERIMENTAL centralized widget refresh system ------------------------------
|
||||
// These need to live outsie of the events.push() function to enable the widgets to see them
|
||||
var ajaxspecs = new Array(); // Array to hold each widget refresh specification (object)
|
||||
var ajaxspecs = new Array(); // Array to hold widget refresh specifications (objects )
|
||||
var ajaxidx = 0;
|
||||
var ajaxmutex = false;
|
||||
|
||||
@ -658,7 +658,7 @@ events.push(function() {
|
||||
}
|
||||
|
||||
// Loop through each AJAX widget refresh object, make the AJAX call and pass the
|
||||
//results back to the widget's callback function
|
||||
// results back to the widget's callback function
|
||||
function executewidget() {
|
||||
if (ajaxspecs.length > 0) {
|
||||
if (!ajaxmutex) {
|
||||
|
||||
@ -221,9 +221,8 @@ if ($_REQUEST['widgetkey']) {
|
||||
// POST data to send via AJAX
|
||||
var postdata = '{"widgetkey":"<?=$widgetkey?>"}';
|
||||
|
||||
// Create aN object defining widget refresh AJAX call
|
||||
// Create an object defining the widget refresh AJAX call
|
||||
var interfacesObject = new Object();
|
||||
|
||||
interfacesObject.name = "Interfaces";
|
||||
interfacesObject.url = "/widgets/widgets/interfaces.widget.php";
|
||||
interfacesObject.callback = interfaces_callback;
|
||||
|
||||
@ -291,32 +291,31 @@ function changeTabDIV(selectedDiv) {
|
||||
}
|
||||
}
|
||||
|
||||
function get_ipsec_stats_<?=$widgetkey_nodash?>() {
|
||||
var ajaxRequest;
|
||||
|
||||
ajaxRequest = $.ajax({
|
||||
url: "/widgets/widgets/ipsec.widget.php",
|
||||
type: "post",
|
||||
data: {
|
||||
ajax: "ajax",
|
||||
tab: curtab
|
||||
}
|
||||
});
|
||||
|
||||
// Deal with the results of the above ajax call
|
||||
ajaxRequest.done(function (response, textStatus, jqXHR) {
|
||||
|
||||
$('tbody', '#<?=$widgetkey_nodash?>-' + curtab).html(response);
|
||||
|
||||
// and do it again
|
||||
setTimeout(get_ipsec_stats_<?=$widgetkey_nodash?>, "<?=$widgetperiod?>");
|
||||
});
|
||||
}
|
||||
|
||||
events.push(function(){
|
||||
// Start polling for updates some small random number of seconds from now (so that all the widgets don't
|
||||
// hit the server at exactly the same time)
|
||||
setTimeout(get_ipsec_stats_<?=$widgetkey_nodash?>, Math.floor((Math.random() * 10000) + 1000));
|
||||
// --------------------- EXPERIMENTAL centralized widget refresh system ------------------------------
|
||||
|
||||
// Callback function called by refresh system when data is retrieved
|
||||
function ipsec_callback(s) {
|
||||
$('tbody', '#<?=$widgetkey_nodash?>-' + curtab).html(s);
|
||||
}
|
||||
|
||||
// POST data to send via AJAX
|
||||
var postdata = {
|
||||
ajax: "ajax",
|
||||
tab : curtab
|
||||
};
|
||||
|
||||
// Create an object defining the widget refresh AJAX call
|
||||
var ipsecObject = new Object();
|
||||
ipsecObject.name = "IPsec";
|
||||
ipsecObject.url = "/widgets/widgets/ipsec.widget.php";
|
||||
ipsecObject.callback = ipsec_callback;
|
||||
ipsecObject.parms = postdata;
|
||||
|
||||
// Register the AJAX object
|
||||
register_ajax(ipsecObject);
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/*
|
||||
* support.widget.php
|
||||
* netgate_serives_and_support.widget.php
|
||||
*
|
||||
* part of pfSense (https://www.pfsense.org)
|
||||
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user