mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 01:15:44 +01:00
added auto configuration button to mercurial config panel
This commit is contained in:
@@ -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 ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -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){
|
||||
|
||||
Reference in New Issue
Block a user