mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
History panel: remove sessionStorage for panel when user logs out
This commit is contained in:
@@ -212,6 +212,14 @@ var HistoryPanel = Backbone.View.extend( LoggableMixin ).extend(
|
||||
this.log( this + ' (init\'d) storage:', this.storage.get() );
|
||||
},
|
||||
|
||||
clearWebStorage : function(){
|
||||
for( var key in sessionStorage ){
|
||||
if( key.indexOf( 'HistoryView.' ) === 0 ){
|
||||
sessionStorage.removeItem( key );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/** Add an hda to this history's collection
|
||||
* @param {HistoryDatasetAssociation} hda hda to add to the collection
|
||||
*/
|
||||
|
||||
@@ -70,6 +70,17 @@ var User = Backbone.Model.extend( LoggableMixin ).extend(
|
||||
return BaseModel.prototype.fetch.call( this, options );
|
||||
},
|
||||
|
||||
/** Clears all data from the sessionStorage.
|
||||
*/
|
||||
clearSessionStorage : function(){
|
||||
for( var key in sessionStorage ){
|
||||
//TODO: currently only history
|
||||
if( key.indexOf( 'HistoryView.' ) === 0 ){
|
||||
sessionStorage.removeItem( key );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/** string representation */
|
||||
toString : function(){
|
||||
var userInfo = [ this.get( 'username' ) ];
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
var User=Backbone.Model.extend(LoggableMixin).extend({urlRoot:"api/users",defaults:{id:null,username:"("+_l("anonymous user")+")",email:"",total_disk_usage:0,nice_total_disk_usage:"",quota_percent:null},initialize:function(a){this.log("User.initialize:",a);this.on("loaded",function(b,c){this.log(this+" has loaded:",b,c)});this.on("change",function(b,c){this.log(this+" has changed:",b,c.changes)})},isAnonymous:function(){return(!this.get("email"))},loadFromApi:function(d,b){d=d||User.CURRENT_ID_STR;b=b||{};var a=this,c=b.success;b.success=function(f,e){a.trigger("loaded",f,e);if(c){c(f,e)}};if(d===User.CURRENT_ID_STR){b.url=this.urlRoot+"/"+User.CURRENT_ID_STR}return BaseModel.prototype.fetch.call(this,b)},toString:function(){var a=[this.get("username")];if(this.get("id")){a.unshift(this.get("id"));a.push(this.get("email"))}return"User("+a.join(":")+")"}});User.CURRENT_ID_STR="current";User.getCurrentUserFromApi=function(b){var a=new User();a.loadFromApi(User.CURRENT_ID_STR,b);return a};var UserCollection=Backbone.Collection.extend(LoggableMixin).extend({model:User,urlRoot:"api/users"});
|
||||
var User=Backbone.Model.extend(LoggableMixin).extend({urlRoot:"api/users",defaults:{id:null,username:"("+_l("anonymous user")+")",email:"",total_disk_usage:0,nice_total_disk_usage:"",quota_percent:null},initialize:function(a){this.log("User.initialize:",a);this.on("loaded",function(b,c){this.log(this+" has loaded:",b,c)});this.on("change",function(b,c){this.log(this+" has changed:",b,c.changes)})},isAnonymous:function(){return(!this.get("email"))},loadFromApi:function(d,b){d=d||User.CURRENT_ID_STR;b=b||{};var a=this,c=b.success;b.success=function(f,e){a.trigger("loaded",f,e);if(c){c(f,e)}};if(d===User.CURRENT_ID_STR){b.url=this.urlRoot+"/"+User.CURRENT_ID_STR}return BaseModel.prototype.fetch.call(this,b)},clearSessionStorage:function(){for(var a in sessionStorage){if(a.indexOf("HistoryView.")===0){sessionStorage.removeItem(a)}}},toString:function(){var a=[this.get("username")];if(this.get("id")){a.unshift(this.get("id"));a.push(this.get("email"))}return"User("+a.join(":")+")"}});User.CURRENT_ID_STR="current";User.getCurrentUserFromApi=function(b){var a=new User();a.loadFromApi(User.CURRENT_ID_STR,b);return a};var UserCollection=Backbone.Collection.extend(LoggableMixin).extend({model:User,urlRoot:"api/users"});
|
||||
@@ -39,6 +39,14 @@ def inherit(context):
|
||||
</%def>
|
||||
|
||||
<%def name="body()">
|
||||
<script type="text/javascript">
|
||||
$(function(){
|
||||
//HACK: should happen before we get to this page - _before_ logged out of session
|
||||
if( top.Galaxy && top.Galaxy.currUser ){
|
||||
top.Galaxy.currUser.clearSessionStorage();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
%if message:
|
||||
${render_msg( message, status )}
|
||||
%endif
|
||||
|
||||
Reference in New Issue
Block a user