mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-03-06 04:10:52 +01:00
improve session timeout handling at the repository grid
This commit is contained in:
@@ -109,7 +109,8 @@ Sonia.repository.Grid = Ext.extend(Sonia.rest.Grid, {
|
||||
load: {
|
||||
fn: this.storeLoad,
|
||||
scope: this
|
||||
}
|
||||
},
|
||||
exception: Sonia.rest.ExceptionHandler
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -30,3 +30,28 @@
|
||||
*/
|
||||
Ext.ns("Sonia.rest");
|
||||
|
||||
|
||||
Sonia.rest.exceptionTitleText = 'Error';
|
||||
Sonia.rest.exceptionMsgText = 'Could not load items. Server returned status: {0}';
|
||||
|
||||
Sonia.rest.ExceptionHandler = function(proxy, type, action, options, response, arg){
|
||||
var status = response.status;
|
||||
if (debug){
|
||||
console.debug('store returned statuscode ' + status);
|
||||
}
|
||||
if ( status == 200 && action == 'read' && response.responseText == 'null' ){
|
||||
if ( debug ){
|
||||
console.debug( 'empty array, clear whole store' );
|
||||
}
|
||||
this.removeAll();
|
||||
} else {
|
||||
if (debug){
|
||||
console.debug( 'error during store load, status: ' + status );
|
||||
}
|
||||
main.handleRestFailure(
|
||||
response,
|
||||
Sonia.rest.exceptionTitleText,
|
||||
String.format(Sonia.rest.exceptionMsgText, status)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -31,36 +31,13 @@
|
||||
|
||||
Sonia.rest.JsonStore = Ext.extend( Ext.data.JsonStore, {
|
||||
|
||||
errorTitleText: 'Error',
|
||||
errorMsgText: 'Could not load items. Server returned status: {0}',
|
||||
|
||||
constructor: function(config) {
|
||||
if ( ! config.listeners ){
|
||||
config.listeners = {};
|
||||
}
|
||||
// fix jersey empty array problem
|
||||
config.listeners.exception = {
|
||||
fn: function(proxy, type, action, options, response, arg){
|
||||
var status = response.status;
|
||||
if (debug){
|
||||
console.debug('store returned statuscode ' + status);
|
||||
}
|
||||
if ( status == 200 && action == 'read' && response.responseText == 'null' ){
|
||||
if ( debug ){
|
||||
console.debug( 'empty array, clear whole store' );
|
||||
}
|
||||
this.removeAll();
|
||||
} else {
|
||||
if (debug){
|
||||
console.debug( 'error during store load, status: ' + status );
|
||||
}
|
||||
main.handleRestFailure(
|
||||
response,
|
||||
this.errorTitleText,
|
||||
this.errorMsgText
|
||||
);
|
||||
}
|
||||
},
|
||||
fn: Sonia.rest.ExceptionHandler,
|
||||
scope: this
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user