Project

General

Profile

Feature #231

java script refresh

Added by prmarino1-gmail-com - about 12 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Target version:
Start date:
Due date:
% Done:

0%

Resolution:
fixed

Description

A java script based auto refresh would be a very usefull thing.
the script is easy i was able to find an example of a java script auto refresh script and insert it into functions.js easily but 3 problem arrose when i did that.

1) if a user clicked on a link if it took longer for the page to load than the remaining time in the counter it would refresh the users current page rather than load the one they clicked on. as a side effech the queries against the database would keep going.

2) there was now way for the user to enable, disable or adjust the timeing of the auto refersh on the page.

3) this applies the auto refresh to all pages even the ones where it is not usefull.

if we can add two variables readable by java script this could allow the use of such an auto refresh.

1) a simple refresh=(TRUE|FALSE)
a variable to enable or disable the autorefresh. this could be turned of when a link is clicked, when a page should not use an auto refresh, of when the user has the option disabled

2) refreshtime=111111
a refresh time in seconds for the timer to count down

this would requier some changes which could be roled in to the prewikka pages slowly over time also it would requier two new field added to the users preferences in the prewikka database

in addition the javascript should also send a paramiter back to prewikka indicating not to update the user activity time so the time outs still work. this would also have a side effect of automaticaly redirecting the user to the logout page when their activity timer runs out rather than leaving the last viewed page vissible in the users browser.

MessageListing.py.autoapply.diff View - auto apply (912 Bytes) prmarino1-gmail-com -, 06/29/2007 04:09 AM

MessageListing.tmpl.autoapply.diff View - auto apply patch (857 Bytes) prmarino1-gmail-com -, 06/29/2007 04:10 AM

TopLayout.py.autoapply.diff View - auto apply patch (517 Bytes) prmarino1-gmail-com -, 06/29/2007 04:10 AM

TopLayout.tmplautoapply.diff View - auto apply patch (358 Bytes) prmarino1-gmail-com -, 06/29/2007 04:11 AM

alertlisting.py.autoapply.diff View - auto apply patch (517 Bytes) prmarino1-gmail-com -, 06/29/2007 04:12 AM

functions.js.autoapply.diff View - auto apply patch (2.08 KB) prmarino1-gmail-com -, 06/29/2007 04:12 AM

messagelisting.py.autoapply.diff View - auto apply patch (1.67 KB) prmarino1-gmail-com -, 06/29/2007 05:44 AM

autoupdate.full.diff View - full patch against svn version of prewikka (6.17 KB) , 07/04/2007 02:13 AM

autoupdate.full.withcheckbox.diff View - full copy of the patch against the svn version with the check box added (7.64 KB) prmarino1-gmail-com -, 07/07/2007 01:15 AM

autoupdate.full.withcheckbox.2.diff View - full copy of the patch against the svn version with the check box added (7.64 KB) prmarino1-gmail-com -, 07/07/2007 01:22 AM

prewikka-refresh.diff View - Second version of the modified Prewikka refresh patch (10.4 KB) Yoann VANDOORSELAERE, 07/16/2007 01:36 PM

prewikka-refresh-improved-compatability.diff View - revised version of the patch debuged on konqueror, Opera, and IE7 (9.29 KB) prmarino1-gmail-com -, 07/24/2007 06:18 AM

History

#1 Updated by about 12 years ago

Just curious, do you get the same behavior if using a pure HTML auto-refresh:

<meta http-equiv="refresh" content="3600">

#2 Updated by prmarino1-gmail-com - about 12 years ago

that was the first thing i tried and i imediatly relized that the problem with a html refersh is it does not repost the user selections so any frontend selections such as filters, groupings, and time ranges revert the users saved defaults every time it refreshes.

#3 Updated by about 12 years ago

I changed my idea a little to a auto apply because of several issues due to some differences between how java script handle refreshes of a page which was posted. I found the refresh had different results on different browsers so instead I added an auto submit apply. i also added a field on in the menu on the left side which specifies how often to apply, I named it "Auto Update Time" in the menu. the new field takes seconds however it can also take 1:10 for one minute and ten seconds or 1:20:10 for one hour twenty minutes and ten seconds, and 0 disables the timer.
there are still two more things to be done these are nice to haves but it is fully functional and very useful as it is now

1) a check box should to enable/disable the timer
if some one could do the python coding i already have the java script code to make it work i just had some trouble figuring out how to make the check box work correctly in the form. it does not have to have any meaning to the python its self i just had trouble getting the check box to keep state after an apply. my patches should point out where this code change would have to happen.

2) stop auto apply from updating the session expiration time
i still haven,t added a method to stop it from updating the session timeout so if it is enabled the session will never time out
this is actually a good thing it the console is being used by a 24x7 operations staff working out of a secure operations center however it is not necessarily ideal for a non secure desktop environment so while this is not a show stopper in my opinion it is some thing that should be changed in the future. this will also require an additional hidden field to be added to to the form as with the first one if some one would write the python code i can quickly add the java script to use the field

these changes shouldn't take to long it just I have several other projects to work on and I have already expended the time my employer will allow me to spend on it right now. most of the work has already been done its just the last two minor details that have to be finished.

I have attached all of the patches necessary to make this work to the ticket

#4 Updated by prmarino1-gmail-com - about 12 years ago

one more thing that should be changed latter but isn't urgent. I used window.status to display the count down until the next update unfortunitly Firefox has this disabled by default in its java script preferences. Its an easy setting to change in the advance options for java script but it is inconvenient for Firefox users, and probably at some time latter time this should be moved into the page rather than the status bar in the browser. As far as I know Firefox and Opera are the only browsers that have an issue with this Konqueror,IE,and links had no problem with it in my tests.
yes I'm crazy enough to test links :)

Opera issue is strange by default in opera the status bar can be updated by java script by default but the status bar is not displayed at all by default again this can be corrected easily by the user enabling the status bar in view->toolbars in the drop down menubut again it is inconvenient

#5 Updated by Yoann VANDOORSELAERE about 12 years ago

Hello Paul, and thanks for working on this great contribution!

Rather than having this new setting in the Prewikka left tab, I'd like to suggest that you move the auto-apply preference in the user setting page (accessible when clicking on your user login, in the top right of the Prewikka screen).

The preference shall be available below the Language option, as an HTML form, allowing the user to specify the amount of time between screen refresh. There might also be a checkbox to completely disable the setting (and then "freeze" the form entry so that the user can not edit it).

What do you think?

#6 Updated by about 12 years ago

I have attached a full version of the patch against the SVN version named autoupdate.full.diff
this patch this diff covers all of the files which were changed

#7 Updated by prmarino1-gmail-com - about 12 years ago

I have attached the patch with the check box named autoupdate.full.withcheckbox.2.diff
please ignore autoupdate.full.withcheckbox.diff it has a typo which I noticed right after I uploaded it

In responce to moving the time to the preferences I think it would be a good idea to have a global default there but i still think its a good idea to have it where it is. the reason is that durring an event the user may want to adjust the setting for a particular view temporaraly. however there could be two check boxes in the preferences one to allow the user to change the setting and one to make the global setting over ride the view setting. we can also make the field dissapear from the page if the user doesn't have the privledge to save the setting

#8 Updated by Yoann VANDOORSELAERE about 12 years ago

  • Status changed from New to Assigned

Attached is an update to your patch. It does the following:

  • Clean various things, factor the code.
  • Improve HTML rendering.
  • Implement notification of the remaining time within the Prewikka left tabs.
  • Pause the timer while the user focus the input widget.
  • Make it work with the heartbeat listing.

From the testing we did here, the patch seems to work great. However, a timer "auto pause/stop" should be implemented to stop the timer while the user edit a filter, or click a link.

Feedbacks welcome,

#9 Updated by Yoann VANDOORSELAERE about 12 years ago

Another update, attached.

  • Pause the timer when a link is clicked, and the page is loading.
  • Pause the timer when a CSS popup is triggered, activate it again when it is hidden.
  • Don't activate the timer on page load, if the checkbox is not checked.

This has been tested successfully under firefox, but would need to be tested on IE6/7, Opera, and Konqueror:

  • Check that the counter stop updating if the timer box is unchecked.
  • Check that the counter stop updating when you click on a CSS popup (example: classification under the alert tabs), and that it start updating again when you click it again (hide it).
  • Check that the counter stop when you edit the timer time, and that it start updating again when you leave that field.

#10 Updated by prmarino1-gmail-com - about 12 years ago

I found two issues with the patch both of which i corrected and put into prewikka-refresh-improved-compatability.diff

1) a quoting issue in the checkbox resulted in "checked="checked"" Firefox detects and fixes this without complaint but other browsers had issues with it.

2)with some of the browsers i tested


status = document.getElementById("auto_apply_current")
status.innerHTML = Math.floor(second_count / 60) + ":" + pad((second_count % 60))


didn't work so i changed it to

document.getElementById("auto_apply_current").innerHTML = Math.floor(second_count / 60) + ":" + pad((second_count % 60))


this worked with all of the browsers I tested

I successfully tested this version of the patch with the following browsers.
on Linux konqueror, Firefox, Opera
on Windows IE7

#11 Updated by Yoann VANDOORSELAERE about 12 years ago

Initial implementation checked in r9715, although the IE7 timer issue still remain.

#12 Updated by Yoann VANDOORSELAERE about 12 years ago

  • Status changed from Assigned to Closed
  • Resolution set to fixed

Integration is finished, the IE7 timer issue remain, but less frequently with the updated cache headers: marking as closed.

Thanks for the contribution!

#13 Updated by Yoann VANDOORSELAERE over 10 years ago

  • Project changed from PRELUDE SIEM to Prewikka
  • Category deleted (5)
  • Target version deleted (0.9.12)

Also available in: Atom PDF