cleanup, add MailProxyPorts

This commit is contained in:
Dietmar Maurer 2017-02-24 11:00:42 +01:00
parent 7c876e1680
commit 7bf889cbbb
4 changed files with 77 additions and 39 deletions

View File

@ -11,7 +11,7 @@ Ext.define('PMG.MailProxyConfiguration', {
},
{
title: gettext('Ports'),
html: "Ports",
xtype: 'pmgMailProxyPorts'
},
{
title: gettext('Options'),

69
js/MailProxyPorts.js Normal file
View File

@ -0,0 +1,69 @@
Ext.define('PMG.MailProxyPorts', {
extend: 'Proxmox.grid.ObjectGrid',
alias: ['widget.pmgMailProxyPorts'],
initComponent : function() {
var me = this;
var rows = {
ext_port: {
required: true,
defaultValue: 26,
header: gettext('External SMTP Port'),
editor: {
xtype: 'proxmoxWindowEdit',
subject: gettext('External SMTP Port'),
items: {
xtype: 'proxmoxintegerfield',
name: 'ext_port',
minValue: 1,
maxValue: 65535,
deleteEmpty: true,
value: 26,
labelWidth: 150,
fieldLabel: gettext('External SMTP Port')
}
}
},
int_port: {
required: true,
defaultValue: 25,
header: gettext('Internal SMTP Port'),
editor: {
xtype: 'proxmoxWindowEdit',
subject: gettext('Internal SMTP Port'),
items: {
xtype: 'proxmoxintegerfield',
name: 'int_port',
minValue: 1,
maxValue: 65535,
deleteEmpty: true,
value: 25,
labelWidth: 150,
fieldLabel: gettext('Internal SMTP Port')
}
}
}
};
var baseurl = '/config/mail';
Ext.apply(me, {
url: '/api2/json' + baseurl,
editorConfig: {
url: '/api2/extjs' + baseurl,
},
interval: 5000,
cwidth1: 200,
rows: rows,
listeners: {
itemdblclick: me.run_editor
}
});
me.callParent();
me.on('activate', me.rstore.startUpdate);
me.on('destroy', me.rstore.stopUpdate);
}
});

View File

@ -27,7 +27,7 @@ Ext.define('PMG.MailProxyRelaying', {
header: gettext('SMTP port'),
editor: {
xtype: 'proxmoxWindowEdit',
subject: gettext('SMTP port'),
subject: gettext('SMTP Port'),
items: {
xtype: 'proxmoxintegerfield',
name: 'relayport',
@ -77,48 +77,16 @@ Ext.define('PMG.MailProxyRelaying', {
var baseurl = '/config/mail';
var reload = function() {
me.rstore.load();
};
var run_editor = function() {
var sm = me.getSelectionModel();
var rec = sm.getSelection()[0];
if (!rec) {
return;
}
var rowdef = rows[rec.data.key];
if (!rowdef.editor) {
return;
}
var win;
if (Ext.isString(rowdef.editor)) {
win = Ext.create(rowdef.editor, {
confid: rec.data.key,
url: '/api2/extjs/' + baseurl
});
} else {
var config = Ext.apply({
confid: rec.data.key,
url: '/api2/extjs/' + baseurl
}, rowdef.editor);
win = Ext.createWidget(rowdef.editor.xtype, config);
win.load();
}
win.show();
win.on('destroy', reload);
};
Ext.apply(me, {
url: '/api2/json/' + baseurl,
url: '/api2/json' + baseurl,
editorConfig: {
url: '/api2/extjs' + baseurl,
},
interval: 5000,
cwidth1: 200,
rows: rows,
listeners: {
itemdblclick: run_editor
itemdblclick: me.run_editor
}
});

View File

@ -5,6 +5,7 @@ JSSRC= \
RuleConfiguration.js \
SystemConfiguration.js \
MailProxyRelaying.js \
MailProxyPorts.js \
MailProxyConfiguration.js \
ConfigPanel.js \
Workspace.js