java script refresh
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
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
#2 Updated by prmarino1-gmail-com - about 14 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 almost 14 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 - almost 14 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 almost 14 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?
#7 Updated by prmarino1-gmail-com - almost 14 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 almost 14 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.
#9 Updated by Yoann VANDOORSELAERE almost 14 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 - almost 14 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