mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +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,
|
repository: null,
|
||||||
start: 0,
|
start: 0,
|
||||||
limit: -1,
|
|
||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
historyId: null,
|
historyId: null,
|
||||||
|
changesetStore: null,
|
||||||
|
|
||||||
changesetViewerTitleText: 'Commits {0}',
|
changesetViewerTitleText: 'Commits {0}',
|
||||||
|
|
||||||
initComponent: function(){
|
initComponent: function(){
|
||||||
this.historyId = 'changesetviewer|' + this.repository.id;
|
this.historyId = 'changesetviewer|' + this.repository.id;
|
||||||
|
|
||||||
var changesetStore = new Sonia.rest.JsonStore({
|
this.changesetStore = new Sonia.rest.JsonStore({
|
||||||
id: 'changesetStore',
|
id: 'changesetStore',
|
||||||
proxy: new Ext.data.HttpProxy({
|
proxy: new Ext.data.HttpProxy({
|
||||||
url: restUrl + 'repositories/' + this.repository.id + '/changesets.json',
|
url: restUrl + 'repositories/' + this.repository.id + '/changesets.json',
|
||||||
@@ -57,7 +57,7 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
|
|||||||
autoDestroy: true,
|
autoDestroy: true,
|
||||||
baseParams: {
|
baseParams: {
|
||||||
start: this.start,
|
start: this.start,
|
||||||
limit: this.limit > 0 ? this.limit : this.pageSize
|
limit: this.pageSize
|
||||||
},
|
},
|
||||||
listeners: {
|
listeners: {
|
||||||
load: {
|
load: {
|
||||||
@@ -72,11 +72,11 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
|
|||||||
items: [{
|
items: [{
|
||||||
xtype: 'repositoryChangesetViewerGrid',
|
xtype: 'repositoryChangesetViewerGrid',
|
||||||
repository: this.repository,
|
repository: this.repository,
|
||||||
store: changesetStore
|
store: this.changesetStore
|
||||||
}],
|
}],
|
||||||
bbar: {
|
bbar: {
|
||||||
xtype: 'paging',
|
xtype: 'paging',
|
||||||
store: changesetStore,
|
store: this.changesetStore,
|
||||||
displayInfo: true,
|
displayInfo: true,
|
||||||
pageSize: this.pageSize,
|
pageSize: this.pageSize,
|
||||||
prependButtons: true
|
prependButtons: true
|
||||||
@@ -92,6 +92,13 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
|
|||||||
if (id){
|
if (id){
|
||||||
this.historyId = 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){
|
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({
|
Ext.Ajax.request({
|
||||||
url: restUrl + 'repositories/' + params[0] + '.json',
|
url: restUrl + 'repositories/' + params[0] + '.json',
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
@@ -114,8 +134,8 @@ Sonia.History.register('changesetviewer', function(params){
|
|||||||
id: item.id + '-changesetViewer',
|
id: item.id + '-changesetViewer',
|
||||||
xtype: 'repositoryChangesetViewerPanel',
|
xtype: 'repositoryChangesetViewerPanel',
|
||||||
repository: item,
|
repository: item,
|
||||||
start: parseInt(params[1]),
|
start: start,
|
||||||
limit: parseInt(params[2]),
|
pageSize: pageSize,
|
||||||
closable: true
|
closable: true
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -125,6 +145,7 @@ Sonia.History.register('changesetviewer', function(params){
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,6 +43,20 @@ Sonia.util.clone = function(obj) {
|
|||||||
} return newObj;
|
} 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){
|
Sonia.util.getStringFromArray = function(array){
|
||||||
var value = '';
|
var value = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user