mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 09:46:16 +01:00
improve plugin config api
This commit is contained in:
@@ -62,7 +62,14 @@ public class HgConfigResource
|
||||
@GET
|
||||
public HgConfig getConfig()
|
||||
{
|
||||
return handler.getConfig();
|
||||
HgConfig config = handler.getConfig();
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
config = new HgConfig();
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
@@ -35,9 +35,9 @@ public class HgConfig
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public File getConfigDirectory()
|
||||
public String getBaseUrl()
|
||||
{
|
||||
return configDirectory;
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,11 +68,11 @@ public class HgConfig
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param configDirectory
|
||||
* @param baseUrl
|
||||
*/
|
||||
public void setConfigDirectory(File configDirectory)
|
||||
public void setBaseUrl(String baseUrl)
|
||||
{
|
||||
this.configDirectory = configDirectory;
|
||||
this.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +100,7 @@ public class HgConfig
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private File configDirectory;
|
||||
private String baseUrl;
|
||||
|
||||
/** Field description */
|
||||
private String hgBinary = "hg";
|
||||
|
||||
@@ -2,49 +2,23 @@
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
repositoryConfigPanels.push({
|
||||
style: 'margin: 10px',
|
||||
trackResetOnLoad : true,
|
||||
autoScroll : true,
|
||||
border : false,
|
||||
frame : false,
|
||||
collapsible : false,
|
||||
collapsed : false,
|
||||
layoutConfig : {
|
||||
labelSeparator : ''
|
||||
},
|
||||
registerConfigPanel({
|
||||
xtype : 'configForm',
|
||||
title : 'Mercurial Settings',
|
||||
items : [{
|
||||
xtype : 'fieldset',
|
||||
checkboxToggle : false,
|
||||
title : 'Mercurial Settings',
|
||||
collapsible : true,
|
||||
autoHeight : true,
|
||||
labelWidth : 140,
|
||||
buttonAlign: 'left',
|
||||
layoutConfig : {
|
||||
labelSeparator : ''
|
||||
},
|
||||
items : [{
|
||||
xtype : 'textfield',
|
||||
fieldLabel : 'HG Binary',
|
||||
name : 'hgBinary',
|
||||
allowBlank : false
|
||||
},{
|
||||
xtype: 'textfield',
|
||||
name: 'hgRepoDirectroy',
|
||||
fieldLabel: 'Repository directory',
|
||||
allowBlank : false
|
||||
},{
|
||||
xtype: 'textfield',
|
||||
name: 'hgBaseUrl',
|
||||
fieldLabel: 'Base URL',
|
||||
allowBlank : false
|
||||
}],
|
||||
buttons: [{
|
||||
text: 'Save'
|
||||
},{
|
||||
text: 'Cancel'
|
||||
}]
|
||||
xtype : 'textfield',
|
||||
fieldLabel : 'HG Binary',
|
||||
name : 'hgBinary',
|
||||
allowBlank : false
|
||||
},{
|
||||
xtype: 'textfield',
|
||||
name: 'repositoryDirectory',
|
||||
fieldLabel: 'Repository directory',
|
||||
allowBlank : false
|
||||
},{
|
||||
xtype: 'textfield',
|
||||
name: 'baseUrl',
|
||||
fieldLabel: 'Base URL',
|
||||
allowBlank : false
|
||||
}]
|
||||
|
||||
});
|
||||
|
||||
@@ -12,6 +12,10 @@ var authCallbacks = [];
|
||||
// config form panels
|
||||
var repositoryConfigPanels = [];
|
||||
|
||||
function registerConfigPanel(panel){
|
||||
repositoryConfigPanels.push( panel );
|
||||
}
|
||||
|
||||
var repositoryTypeStore = new Ext.data.JsonStore({
|
||||
id: 1,
|
||||
fields: [ 'displayName', 'name' ]
|
||||
|
||||
@@ -27,4 +27,51 @@ Sonia.config.ConfigPanel = Ext.extend(Ext.Panel, {
|
||||
|
||||
});
|
||||
|
||||
Ext.reg("configPanel", Sonia.config.ConfigPanel);
|
||||
Ext.reg("configPanel", Sonia.config.ConfigPanel);
|
||||
|
||||
Sonia.config.ConfigForm = Ext.extend(Ext.form.FormPanel, {
|
||||
|
||||
title: 'Config Form',
|
||||
items: null,
|
||||
|
||||
initComponent: function(){
|
||||
|
||||
var config = {
|
||||
title: null,
|
||||
style: 'margin: 10px',
|
||||
trackResetOnLoad : true,
|
||||
autoScroll : true,
|
||||
border : false,
|
||||
frame : false,
|
||||
collapsible : false,
|
||||
collapsed : false,
|
||||
layoutConfig : {
|
||||
labelSeparator : ''
|
||||
},
|
||||
items : [{
|
||||
xtype : 'fieldset',
|
||||
checkboxToggle : false,
|
||||
title : this.title,
|
||||
collapsible : true,
|
||||
autoHeight : true,
|
||||
labelWidth : 140,
|
||||
buttonAlign: 'left',
|
||||
layoutConfig : {
|
||||
labelSeparator : ''
|
||||
},
|
||||
items: this.items,
|
||||
buttons: [{
|
||||
text: 'Save'
|
||||
},{
|
||||
text: 'Cancel'
|
||||
}]
|
||||
}]
|
||||
};
|
||||
|
||||
Ext.apply(this, Ext.apply(this.initialConfig, config));
|
||||
Sonia.config.ConfigForm.superclass.initComponent.apply(this, arguments);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Ext.reg("configForm", Sonia.config.ConfigForm);
|
||||
|
||||
Reference in New Issue
Block a user