Issue 11082

Admin console - Do not load stuff into the session, use jquery/javascript temp storage.

11082
Reporter: jcuadra
Type: Improvement
Summary: Admin console - Do not load stuff into the session, use jquery/javascript temp storage.
Priority: Major
Resolution: Invalid
Status: Closed
Created: 2012-05-11 18:06:13.549
Updated: 2013-08-29 15:28:49.646
Resolved: 2013-08-29 15:28:49.619


Author: mdoering@gbif.org
Created: 2012-05-12 14:17:34.832
Updated: 2012-05-12 14:17:34.832
        
just for curiosity, what is the advantage of doing this?
And would it be very hard to implement a non stateful solution?
    


Author: trobertson@gbif.org
Created: 2012-05-12 19:34:08.629
Updated: 2012-05-12 19:34:08.629
        
Scalability and maintenance basically, which become difficult when the application is made stateful.
i) can load balance machines easier (don't need a sticky load balancer)
ii) can hot swap [e.g. new deploy with no application downtime]

While we probably don't need i) for load reasons, I'd like to implement anyway so we can do ii).  People notice most times the current portal redeploys (which is too often).  With Varnish you just have 2 backends defined, and on deploy you do one, then the other.  It is trivial to implement in the UI Jose presented, with the only slightly tricky part coming on validation (need to validate nested resources) but with Jquery should still be pretty easy to implement.  I've provided a skeleton HTML illustrating the JS to Jose.


    


Author: mdoering@gbif.org
Created: 2012-05-13 11:58:29.196
Updated: 2012-05-13 11:58:29.196
        
If i) and ii) are principles to follow we might need to review how we use sessions already in other areas and create new issues.
The language and current user for example is held in the session. To avoid future accidental use of sessions I would then also remove the SessionAware interface from the BaseAction.


    


Author: mdoering@gbif.org
Comment: Im curious to understand why the session was used initially. Can't we just persist changes or keep the unsaved state in request parameters?
Created: 2012-05-13 12:01:19.488
Updated: 2012-05-13 12:01:19.488


Author: jcuadra@gbif.org
Created: 2012-05-14 10:51:36.554
Updated: 2012-05-14 10:51:59.982
        
In EDIT mode, changes are persisted inmediately( e.g. adding a tag to an existing Org, adding a contact to an existing DS, etc), so in EDIT, this is not a problem and the session is not used at all.

The main problem is when creating a new network entity because I need, for example, to open a popup window to add new contacts to the entity that will be created, and I need to refresh the parent's window view with the newly added contacts (but obviously these contacts have not been persisted anywhere - the network entity has not been created at this step) so that is why I was using the session. I tried using action chaining or redirect after post to pass these values, but was not successful.

This issue is high priority, but there are other issues that I need to attack before coming to this one later. So any other suggestions (besides the JS storage) are welcomed at this point.


    


Author: mdoering@gbif.org
Comment: we have a shiny new console using angular
Created: 2013-08-29 15:28:49.643
Updated: 2013-08-29 15:28:49.643