aboutsummaryrefslogtreecommitdiffstats
path: root/config/openbgpd
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2013-07-25 14:33:21 -0300
committerRenato Botelho <garga@FreeBSD.org>2013-07-25 14:33:21 -0300
commit8ca29f03d5b68ad6064989ad25ce138b2b54b202 (patch)
treed724d158b7e393da4c6ba49f6c400b398060cdaa /config/openbgpd
parent2480d44d5d59b2ca934c8ca70d0a3ff2076cb2f4 (diff)
downloadpfsense-packages-8ca29f03d5b68ad6064989ad25ce138b2b54b202.tar.gz
pfsense-packages-8ca29f03d5b68ad6064989ad25ce138b2b54b202.tar.bz2
pfsense-packages-8ca29f03d5b68ad6064989ad25ce138b2b54b202.zip
Call commands after page is loaded to improve speed
Diffstat (limited to 'config/openbgpd')
-rw-r--r--config/openbgpd/openbgpd_status.php98
1 files changed, 61 insertions, 37 deletions
diff --git a/config/openbgpd/openbgpd_status.php b/config/openbgpd/openbgpd_status.php
index 42b77574..522d3d41 100644
--- a/config/openbgpd/openbgpd_status.php
+++ b/config/openbgpd/openbgpd_status.php
@@ -114,7 +114,7 @@ function showCmdT($idx, $data) {
}
echo "<tr><td colspan=\"2\" class=\"listlr\"><pre id=\"{$idx}\">"; /* no newline after pre */
- echo doCmdT($data['command'], $limit_default, "", $data['header_size']);
+ echo "Gathering data, please wait...\n";
echo "</pre></td></tr>\n";
echo "</table>\n";
}
@@ -149,8 +149,68 @@ function execCmds() {
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+
+<script type="text/javascript">
+//<![CDATA[
+
+ function update_filter(cmd, header_size) {
+ var url = "openbgpd_status.php";
+ var filter = "";
+ var limit = "all";
+ var limit_field = document.getElementById(cmd + "_limit");
+ if (limit_field) {
+ var index = limit_field.selectedIndex;
+ limit = limit_field.options[index].value;
+ filter = document.getElementById(cmd + "_filter").value;
+ }
+ var params = "isAjax=true&cmd=" + cmd + "&limit=" + limit + "&filter=" + filter + "&header_size=" + header_size;
+ var myAjax = new Ajax.Request(
+ url,
+ {
+ method: 'post',
+ parameters: params,
+ onComplete: update_filter_callback
+ });
+ }
+
+ function update_filter_callback(transport) {
+ // First line contain field id to be updated
+ var responseTextArr = transport.responseText.split("\n");
+ var result = "";
+ var i;
+
+ for (i = 1; i < responseTextArr.length; i++) {
+ result += responseTextArr[i];
+ if (i < responseTextArr.length - 1)
+ result += "\n";
+ }
+
+ document.getElementById(responseTextArr[0]).textContent = result;
+ }
+
+//]]>
+</script>
+
<?php include("fbegin.inc"); ?>
+<script type="text/javascript">
+//<![CDATA[
+
+ function exec_all_cmds() {
+<?php
+ foreach ($commands as $idx => $command)
+ echo "\t\tupdate_filter('{$idx}', {$command['header_size']});\n";
+?>
+ }
+
+if (jQuery)
+ jQuery(document).ready(exec_all_cmds());
+else
+ document.observe('dom:loaded', exec_all_cmds());
+
+//]]>
+</script>
+
<?php
if ($config['version'] < 6)
echo '<p class="pgtitle">' . $pgtitle . '</font></p>';
@@ -185,42 +245,6 @@ function execCmds() {
</table>
</div>
-<script type="text/javascript">
-//<![CDATA[
-
- function update_filter(cmd, header_size) {
- var url = "openbgpd_status.php";
- var index = document.getElementById(cmd + "_limit").selectedIndex;
- var limit = document.getElementById(cmd + "_limit").options[index].value;
- var filter = document.getElementById(cmd + "_filter").value;
- var params = "isAjax=true&cmd=" + cmd + "&limit=" + limit + "&filter=" + filter + "&header_size=" + header_size;
- var myAjax = new Ajax.Request(
- url,
- {
- method: 'post',
- parameters: params,
- onComplete: update_filter_callback
- });
- }
-
- function update_filter_callback(transport) {
- // First line contain field id to be updated
- var responseTextArr = transport.responseText.split("\n");
- var result = "";
- var i;
-
- for (i = 1; i < responseTextArr.length; i++) {
- result += responseTextArr[i];
- if (i < responseTextArr.length - 1)
- result += "\n";
- }
-
- document.getElementById(responseTextArr[0]).textContent = result;
- }
-
-//]]>
-</script>
-
<?php include("fend.inc"); ?>
</body>