Ext.define('pmg-mynetworks', {
extend: 'Ext.data.Model',
- fields: [ 'cidr', 'comment' ],
+ fields: ['cidr', 'comment'],
proxy: {
type: 'proxmox',
- url: "/api2/json/config/mynetworks"
+ url: "/api2/json/config/mynetworks",
},
- idProperty: 'cidr'
+ idProperty: 'cidr',
});
Ext.define('PMG.MyNetworks', {
extend: 'Ext.grid.GridPanel',
alias: ['widget.pmgMyNetworks'],
- initComponent : function() {
+ initComponent: function() {
var me = this;
var store = new Ext.data.Store({
model: 'pmg-mynetworks',
sorters: {
property: 'cidr',
- order: 'DESC'
- }
+ direction: 'ASC',
+ },
});
var reload = function() {
me.selModel = Ext.create('Ext.selection.RowModel', {});
- var remove_btn = Ext.createWidget('proxmoxButton', {
- text: gettext('Remove'),
- disabled: true,
+ var remove_btn = Ext.createWidget('proxmoxStdRemoveButton', {
selModel: me.selModel,
- confirmMsg: function (rec) {
- return Ext.String.format(
- gettext('Are you sure you want to remove entry {0}'),
- "'" + rec.data.cidr + "'");
- },
- handler: function(btn, event, rec) {
- Proxmox.Utils.API2Request({
- url: '/config/mynetworks/' + rec.data.cidr,
- method: 'DELETE',
- waitMsgTarget: me,
- callback: function() {
- reload();
- },
- failure: function (response, opts) {
- Ext.Msg.alert(gettext('Error'), response.htmlStatus);
- }
- });
- }
+ baseurl: '/config/mynetworks',
+ callback: reload,
+ waitMsgTarget: me,
});
var run_editor = function() {
var config = {
url: "/api2/extjs/config/mynetworks/" + rec.data.cidr,
+ onlineHelp: 'pmgconfig_mailproxy_networks',
method: 'PUT',
subject: gettext("Trusted Network"),
items: [
{
xtype: 'displayfield',
name: 'cidr',
- fieldLabel: 'CIDR'
+ fieldLabel: 'CIDR',
},
{
xtype: 'textfield',
name: 'comment',
- fieldLabel: gettext("Comment")
- }
- ]
+ fieldLabel: gettext("Comment"),
+ },
+ ],
};
var win = Ext.createWidget('proxmoxWindowEdit', config);
text: gettext('Edit'),
disabled: true,
selModel: me.selModel,
- handler: run_editor
+ handler: run_editor,
},
{
text: gettext('Create'),
var config = {
method: 'POST',
url: "/api2/extjs/config/mynetworks",
- create: true,
+ onlineHelp: 'pmgconfig_mailproxy_networks',
+ isCreate: true,
subject: gettext("Trusted Network"),
items: [
{
xtype: 'proxmoxtextfield',
name: 'cidr',
- fieldLabel: 'CIDR'
+ fieldLabel: 'CIDR',
},
{
xtype: 'proxmoxtextfield',
name: 'comment',
- fieldLabel: gettext("Comment")
- }
- ]
+ fieldLabel: gettext("Comment"),
+ },
+ ],
};
var win = Ext.createWidget('proxmoxWindowEdit', config);
win.on('destroy', reload);
win.show();
- }
+ },
},
- remove_btn
+ remove_btn,
];
- Proxmox.Utils.monStoreErrors(me, store);
+ Proxmox.Utils.monStoreErrors(me, store, true);
Ext.apply(me, {
store: store,
tbar: tbar,
+ run_editor: run_editor,
viewConfig: {
- trackOver: false
+ trackOver: false,
},
columns: [
{
- header: gettext('Trusted Netowrk'),
+ header: gettext('Trusted Network'),
width: 200,
sortable: true,
- dataIndex: 'cidr'
+ dataIndex: 'cidr',
},
{
header: gettext('Comment'),
sortable: false,
renderer: Ext.String.htmlEncode,
dataIndex: 'comment',
- flex: 1
- }
+ flex: 1,
+ },
],
listeners: {
itemdblclick: run_editor,
- activate: reload
- }
+ activate: reload,
+ },
});
me.callParent();
- }
+ },
});