mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
fix history bug with open changesetviewer
This commit is contained in:
@@ -34,16 +34,16 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
|
||||
|
||||
repository: null,
|
||||
start: 0,
|
||||
limit: -1,
|
||||
pageSize: 20,
|
||||
historyId: null,
|
||||
changesetStore: null,
|
||||
|
||||
changesetViewerTitleText: 'Commits {0}',
|
||||
|
||||
initComponent: function(){
|
||||
this.historyId = 'changesetviewer|' + this.repository.id;
|
||||
|
||||
var changesetStore = new Sonia.rest.JsonStore({
|
||||
this.changesetStore = new Sonia.rest.JsonStore({
|
||||
id: 'changesetStore',
|
||||
proxy: new Ext.data.HttpProxy({
|
||||
url: restUrl + 'repositories/' + this.repository.id + '/changesets.json',
|
||||
@@ -57,7 +57,7 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
|
||||
autoDestroy: true,
|
||||
baseParams: {
|
||||
start: this.start,
|
||||
limit: this.limit > 0 ? this.limit : this.pageSize
|
||||
limit: this.pageSize
|
||||
},
|
||||
listeners: {
|
||||
load: {
|
||||
@@ -72,11 +72,11 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
|
||||
items: [{
|
||||
xtype: 'repositoryChangesetViewerGrid',
|
||||
repository: this.repository,
|
||||
store: changesetStore
|
||||
store: this.changesetStore
|
||||
}],
|
||||
bbar: {
|
||||
xtype: 'paging',
|
||||
store: changesetStore,
|
||||
store: this.changesetStore,
|
||||
displayInfo: true,
|
||||
pageSize: this.pageSize,
|
||||
prependButtons: true
|
||||
@@ -92,6 +92,13 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
|
||||
if (id){
|
||||
this.historyId = id;
|
||||
}
|
||||
},
|
||||
|
||||
loadChangesets: function(start, limit){
|
||||
this.changesetStore.load({params: {
|
||||
start: start,
|
||||
limit: limit
|
||||
}});
|
||||
}
|
||||
|
||||
});
|
||||
@@ -104,6 +111,19 @@ Sonia.History.register('changesetviewer', function(params){
|
||||
|
||||
if (params){
|
||||
|
||||
var id = params[0] + '-changesetViewer';
|
||||
var start = Sonia.util.parseInt(params[1], 0);
|
||||
var pageSize = Sonia.util.parseInt(params[2], 20);
|
||||
|
||||
if (debug){
|
||||
console.debug('load changesetviewer for ' + id + ', ' + start + ', ' + pageSize );
|
||||
}
|
||||
|
||||
var tab = Ext.getCmp(id);
|
||||
|
||||
if ( tab ){
|
||||
tab.loadChangesets(start, pageSize);
|
||||
} else {
|
||||
Ext.Ajax.request({
|
||||
url: restUrl + 'repositories/' + params[0] + '.json',
|
||||
method: 'GET',
|
||||
@@ -114,8 +134,8 @@ Sonia.History.register('changesetviewer', function(params){
|
||||
id: item.id + '-changesetViewer',
|
||||
xtype: 'repositoryChangesetViewerPanel',
|
||||
repository: item,
|
||||
start: parseInt(params[1]),
|
||||
limit: parseInt(params[2]),
|
||||
start: start,
|
||||
pageSize: pageSize,
|
||||
closable: true
|
||||
})
|
||||
},
|
||||
@@ -125,6 +145,7 @@ Sonia.History.register('changesetviewer', function(params){
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,20 @@ Sonia.util.clone = function(obj) {
|
||||
} return newObj;
|
||||
};
|
||||
|
||||
Sonia.util.parseInt = function(string, defaultValue){
|
||||
var result = defaultValue;
|
||||
try {
|
||||
result = parseInt(string);
|
||||
} catch (e){
|
||||
if (debug){
|
||||
console.debug(e);
|
||||
}
|
||||
}
|
||||
if (isNaN(result)){
|
||||
result = defaultValue;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Sonia.util.getStringFromArray = function(array){
|
||||
var value = '';
|
||||
|
||||
Reference in New Issue
Block a user