mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-08-16 01:37:27 +00:00
transport: add real PMG.TransportEditor definition
instead of hacking it together inside the gridpanel Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
c502e50c6c
commit
00b648d2c9
162
js/Transport.js
162
js/Transport.js
@ -29,89 +29,24 @@ Ext.define('PMG.Transport', {
|
|||||||
|
|
||||||
me.selModel = Ext.create('Ext.selection.RowModel', {});
|
me.selModel = Ext.create('Ext.selection.RowModel', {});
|
||||||
|
|
||||||
var remove_btn = Ext.createWidget('proxmoxStdRemoveButton', {
|
|
||||||
selModel: me.selModel,
|
|
||||||
baseurl: '/config/transport',
|
|
||||||
callback: reload,
|
|
||||||
waitMsgTarget: me
|
|
||||||
});
|
|
||||||
|
|
||||||
var common_properties = [
|
|
||||||
{
|
|
||||||
xtype: 'textfield',
|
|
||||||
name: 'host',
|
|
||||||
fieldLabel: gettext("Host")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
xtype: 'proxmoxKVComboBox',
|
|
||||||
name: 'protocol',
|
|
||||||
fieldLabel: gettext('Protocol'),
|
|
||||||
deleteEmpty: false,
|
|
||||||
comboItems: [
|
|
||||||
[ 'smtp', 'SMTP' ],
|
|
||||||
[ 'lmtp', 'LMTP' ]
|
|
||||||
],
|
|
||||||
allowBlank: true,
|
|
||||||
value: 'smtp'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
xtype: 'proxmoxintegerfield',
|
|
||||||
name: 'port',
|
|
||||||
value: 25,
|
|
||||||
minValue: 1,
|
|
||||||
maxValue: 65535,
|
|
||||||
fieldLabel: gettext("Port")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
xtype: 'proxmoxcheckbox',
|
|
||||||
name: 'use_mx',
|
|
||||||
checked: true,
|
|
||||||
uncheckedValue: 0,
|
|
||||||
fieldLabel: gettext("Use MX (SMTP)")
|
|
||||||
},
|
|
||||||
{
|
|
||||||
xtype: 'textfield',
|
|
||||||
name: 'comment',
|
|
||||||
fieldLabel: gettext("Comment")
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
var edit_properties = common_properties.slice();
|
|
||||||
edit_properties.unshift({
|
|
||||||
xtype: 'displayfield',
|
|
||||||
name: 'domain',
|
|
||||||
fieldLabel: gettext("Relay Domain")
|
|
||||||
});
|
|
||||||
|
|
||||||
var create_properties = common_properties.slice();
|
|
||||||
create_properties.unshift({
|
|
||||||
xtype: 'proxmoxtextfield',
|
|
||||||
name: 'domain',
|
|
||||||
fieldLabel: gettext("Relay Domain")
|
|
||||||
});
|
|
||||||
|
|
||||||
let run_editor = function() {
|
let run_editor = function() {
|
||||||
let rec = me.selModel.getSelection()[0];
|
let rec = me.selModel.getSelection()[0];
|
||||||
if (!rec) {
|
if (!rec) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var config = {
|
let win = Ext.createWidget('pmgTransportEditor', {
|
||||||
url: "/api2/extjs/config/transport/" + rec.data.domain,
|
url: "/api2/extjs/config/transport/" + rec.data.domain,
|
||||||
onlineHelp: 'pmgconfig_mailproxy_transports',
|
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
subject: gettext("Transport"),
|
});
|
||||||
items: edit_properties
|
|
||||||
};
|
|
||||||
|
|
||||||
var win = Ext.createWidget('proxmoxWindowEdit', config);
|
|
||||||
|
|
||||||
win.load();
|
win.load();
|
||||||
win.on('destroy', reload);
|
win.on('destroy', reload);
|
||||||
win.show();
|
win.show();
|
||||||
};
|
};
|
||||||
|
|
||||||
var tbar = [
|
Ext.apply(me, {
|
||||||
|
store: store,
|
||||||
|
tbar: [
|
||||||
{
|
{
|
||||||
xtype: 'proxmoxButton',
|
xtype: 'proxmoxButton',
|
||||||
text: gettext('Edit'),
|
text: gettext('Edit'),
|
||||||
@ -122,29 +57,23 @@ Ext.define('PMG.Transport', {
|
|||||||
{
|
{
|
||||||
text: gettext('Create'),
|
text: gettext('Create'),
|
||||||
handler: function() {
|
handler: function() {
|
||||||
var config = {
|
let win = Ext.createWidget('pmgTransportEditor', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url: "/api2/extjs/config/transport",
|
url: "/api2/extjs/config/transport",
|
||||||
onlineHelp: 'pmgconfig_mailproxy_transports',
|
|
||||||
isCreate: true,
|
isCreate: true,
|
||||||
subject: gettext("Transport"),
|
});
|
||||||
items: create_properties
|
|
||||||
};
|
|
||||||
|
|
||||||
var win = Ext.createWidget('proxmoxWindowEdit', config);
|
|
||||||
|
|
||||||
win.on('destroy', reload);
|
win.on('destroy', reload);
|
||||||
win.show();
|
win.show();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
remove_btn
|
{
|
||||||
];
|
xtype: 'proxmoxStdRemoveButton',
|
||||||
|
selModel: me.selModel,
|
||||||
Proxmox.Utils.monStoreErrors(me, store, true);
|
baseurl: '/config/transport',
|
||||||
|
callback: reload,
|
||||||
Ext.apply(me, {
|
waitMsgTarget: me
|
||||||
store: store,
|
},
|
||||||
tbar: tbar,
|
],
|
||||||
viewConfig: {
|
viewConfig: {
|
||||||
trackOver: false
|
trackOver: false
|
||||||
},
|
},
|
||||||
@ -191,3 +120,64 @@ Ext.define('PMG.Transport', {
|
|||||||
me.callParent();
|
me.callParent();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Ext.define('PMG.TransportEditor', {
|
||||||
|
extend: 'Proxmox.window.Edit',
|
||||||
|
alias: 'widget.pmgTransportEditor',
|
||||||
|
mixins: ['Proxmox.Mixin.CBind'],
|
||||||
|
|
||||||
|
cbindData: (cfg) => { return {
|
||||||
|
domainXType: cfg.method === 'POST' ? 'proxmoxtextfield' : 'displayfield',
|
||||||
|
}},
|
||||||
|
|
||||||
|
onlineHelp: 'pmgconfig_mailproxy_transports',
|
||||||
|
subject: gettext("Transport"),
|
||||||
|
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
xtype: 'displayfield',
|
||||||
|
cbind: {
|
||||||
|
xtype: '{domainXType}',
|
||||||
|
},
|
||||||
|
name: 'domain',
|
||||||
|
fieldLabel: gettext("Relay Domain")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'textfield',
|
||||||
|
name: 'host',
|
||||||
|
fieldLabel: gettext("Host")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'proxmoxKVComboBox',
|
||||||
|
name: 'protocol',
|
||||||
|
fieldLabel: gettext('Protocol'),
|
||||||
|
deleteEmpty: false,
|
||||||
|
comboItems: [
|
||||||
|
[ 'smtp', 'SMTP' ],
|
||||||
|
[ 'lmtp', 'LMTP' ]
|
||||||
|
],
|
||||||
|
allowBlank: true,
|
||||||
|
value: 'smtp',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'proxmoxintegerfield',
|
||||||
|
name: 'port',
|
||||||
|
value: 25,
|
||||||
|
minValue: 1,
|
||||||
|
maxValue: 65535,
|
||||||
|
fieldLabel: gettext("Port")
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'proxmoxcheckbox',
|
||||||
|
name: 'use_mx',
|
||||||
|
checked: true,
|
||||||
|
uncheckedValue: 0,
|
||||||
|
fieldLabel: gettext('Use MX'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
xtype: 'textfield',
|
||||||
|
name: 'comment',
|
||||||
|
fieldLabel: gettext("Comment")
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user