added history view of a file to ui

This commit is contained in:
Sebastian Sdorra
2011-11-14 16:29:45 +01:00
parent b37beeadbc
commit f6b83ba815
2 changed files with 40 additions and 9 deletions

View File

@@ -36,6 +36,8 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
pageSize: 20,
historyId: null,
changesetStore: null,
path: null,
inline: false,
changesetViewerTitleText: 'Commits {0}',
@@ -47,10 +49,23 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
this.pageSize
]);
if (! this.url){
this.url = restUrl + 'repositories/' + this.repository.id + '/changesets.json';
}
var params = {
start: this.start,
limit: this.pageSize
}
if (this.path){
params.path = this.path;
}
this.changesetStore = new Sonia.rest.JsonStore({
id: 'changesetStore',
proxy: new Ext.data.HttpProxy({
url: restUrl + 'repositories/' + this.repository.id + '/changesets.json',
url: this.url,
method: 'GET'
}),
fields: ['id', 'date', 'author', 'description', 'modifications', 'tags', 'branches', 'properties'],
@@ -59,10 +74,7 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
totalProperty: 'total',
autoLoad: true,
autoDestroy: true,
baseParams: {
start: this.start,
limit: this.pageSize
},
baseParams: params,
listeners: {
load: {
fn: this.updateHistory,
@@ -72,20 +84,23 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, {
});
var config = {
title: String.format(this.changesetViewerTitleText, this.repository.name),
items: [{
xtype: 'repositoryChangesetViewerGrid',
repository: this.repository,
store: this.changesetStore
}],
bbar: {
}]
};
if ( ! this.inline ){
config.title = String.format(this.changesetViewerTitleText, this.repository.name)
config.bbar = {
xtype: 'paging',
store: this.changesetStore,
displayInfo: true,
pageSize: this.pageSize,
prependButtons: true
}
};
}
Ext.apply(this, Ext.apply(this.initialConfig, config));
Sonia.repository.ChangesetViewerPanel.superclass.initComponent.apply(this, arguments);

View File

@@ -58,6 +58,10 @@ Sonia.repository.ContentPanel = Ext.extend(Ext.Panel, {
text: 'Blame',
handler: this.openBlamePanel,
scope: this
},{
text: 'History',
handler: this.openHistoryPanel,
scope: this
}],
bbar: bottomBar,
items: [{
@@ -71,6 +75,18 @@ Sonia.repository.ContentPanel = Ext.extend(Ext.Panel, {
Sonia.repository.ContentPanel.superclass.initComponent.apply(this, arguments);
},
openHistoryPanel: function(){
this.openPanel({
xtype: 'repositoryChangesetViewerPanel',
repository: this.repository,
revision: this.revision,
path: this.path,
inline: true,
// TODO find a better way
pageSize: 9999
});
},
openSyntaxPanel: function(){
this.openPanel({
xtype: 'syntaxHighlighterPanel',