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; 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 ---------------------------------------------------------- //~--- get methods ----------------------------------------------------------
/** /**

View File

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

View File

@@ -30,6 +30,7 @@
*/ */
registerConfigPanel({ registerConfigPanel({
id: 'hgConfigForm',
xtype : 'configForm', xtype : 'configForm',
title : 'Mercurial Settings', title : 'Mercurial Settings',
items : [{ items : [{
@@ -56,6 +57,14 @@ registerConfigPanel({
name: 'useOptimizedBytecode', name: 'useOptimizedBytecode',
fieldLabel: 'Optimized Bytecode (.pyo)', fieldLabel: 'Optimized Bytecode (.pyo)',
inputValue: 'true' 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){ onSubmit: function(values){
@@ -76,10 +85,14 @@ registerConfigPanel({
}, },
onLoad: function(el){ onLoad: function(el){
this.loadConfig(el, 'config/repositories/hg.json', 'GET');
},
loadConfig: function(el, url, method){
var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100); var tid = setTimeout( function(){ el.mask('Loading ...'); }, 100);
Ext.Ajax.request({ Ext.Ajax.request({
url: restUrl + 'config/repositories/hg.json', url: restUrl + url,
method: 'GET', method: method,
scope: this, scope: this,
disableCaching: true, disableCaching: true,
success: function(response){ success: function(response){