From b1b6f5e4d11575c3d4f8bcd0e9b533cba30b89c7 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Fri, 27 Jul 2012 10:56:11 +0200 Subject: [PATCH] start implementation of branch support for the user interface --- .../sonia.repository.changesetviewerpanel.js | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetviewerpanel.js b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetviewerpanel.js index ec6a9848ec..a1b33f20dd 100644 --- a/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetviewerpanel.js +++ b/scm-webapp/src/main/webapp/resources/js/repository/sonia.repository.changesetviewerpanel.js @@ -101,6 +101,7 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, { if ( ! this.inline ){ config.title = String.format(this.changesetViewerTitleText, this.repository.name) + config.tbar = this.createTopToolbar(); config.bbar = { xtype: 'paging', store: this.changesetStore, @@ -114,6 +115,56 @@ Sonia.repository.ChangesetViewerPanel = Ext.extend(Ext.Panel, { Sonia.repository.ChangesetViewerPanel.superclass.initComponent.apply(this, arguments); }, + createTopToolbar: function(){ + var branchStore = new Sonia.rest.JsonStore({ + proxy: new Ext.data.HttpProxy({ + url: restUrl + 'repositories/' + this.repository.id + '/branches.json', + method: 'GET', + disableCaching: false + }), + root: 'branch', + idProperty: 'name', + fields: [ 'name' ], + sortInfo: { + field: 'name' + } + }); + + return { + xtype: 'toolbar', + items: ['->', + 'Branches:', ' ',{ + xtype: 'combo', + valueField: 'name', + displayField: 'name', + typeAhead: false, + editable: false, + triggerAction: 'all', + store: branchStore, + listeners: { + select: { + fn: this.selectBranch, + scope: this + } + } + }] + } + }, + + selectBranch: function(combo, rec){ + var branch = rec.get('name'); + if (debug){ + console.debug('select branch ' + branch); + } + this.changesetStore.load({ + params: { + start: this.start, + limit: this.startLimit, + branch: branch + } + }); + }, + updateHistory: function(store, records, options){ if ( ! this.inline && options && options.params ){ this.start = options.params.start;