added auto configuration button to mercurial config panel

This commit is contained in:
Sebastian Sdorra
2011-01-07 16:34:20 +01:00
parent 2a407f65f7
commit 426f3fe525
3 changed files with 48 additions and 6 deletions

View File

@@ -78,6 +78,27 @@ public class HgConfigResource
this.handler = handler;
}
//~--- methods --------------------------------------------------------------
/**
* Method description
*
*
* @param uriInfo
*
* @return
*/
@POST
@Path("auto-configuration")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public HgConfig autoConfiguration(@Context UriInfo uriInfo)
{
handler.setConfig(null);
handler.doAutoConfiguration();
return handler.getConfig();
}
//~--- get methods ----------------------------------------------------------
/**

View File

@@ -101,11 +101,8 @@ public class HgRepositoryHandler
* Method description
*
*/
@Override
public void loadConfig()
public void doAutoConfiguration()
{
super.loadConfig();
HgInstaller installer = null;
if (SystemUtil.isWindows())
@@ -163,6 +160,17 @@ public class HgRepositoryHandler
storeConfig();
}
/**
* Method description
*
*/
@Override
public void loadConfig()
{
super.loadConfig();
doAutoConfiguration();
}
//~--- get methods ----------------------------------------------------------
/**

View File

@@ -30,6 +30,7 @@
*/
registerConfigPanel({
id: 'hgConfigForm',
xtype : 'configForm',
title : 'Mercurial Settings',
items : [{
@@ -56,6 +57,14 @@ registerConfigPanel({
name: 'useOptimizedBytecode',
fieldLabel: 'Optimized Bytecode (.pyo)',
inputValue: 'true'
},{
xtype: 'button',
text: 'Load Auto-Configuration',
fieldLabel: 'Auto-Configuration',
handler: function(){
var self = Ext.getCmp('hgConfigForm');
self.loadConfig( self.el, 'config/repositories/hg/auto-configuration.json', 'POST' );
}
}],
onSubmit: function(values){
@@ -76,10 +85,14 @@ registerConfigPanel({
},
onLoad: function(el){
this.loadConfig(el, 'config/repositories/hg.json', 'GET');
},
loadConfig: function(el, url, method){
var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100);
Ext.Ajax.request({
url: restUrl + 'config/repositories/hg.json',
method: 'GET',
url: restUrl + url,
method: method,
scope: this,
disableCaching: true,
success: function(response){