]> git.proxmox.com Git - pmg-gui.git/blob - js/MailProxyTLSInboundDomains.js
mail proxy: transports: consitent add/edit/remove button
[pmg-gui.git] / js / MailProxyTLSInboundDomains.js
1 Ext.define('pmg-tls-inbound-domains', {
2 extend: 'Ext.data.Model',
3 fields: ['domain'],
4 idProperty: 'domain',
5 proxy: {
6 type: 'proxmox',
7 url: '/api2/json/config/tls-inbound-domains',
8 },
9 sorters: {
10 property: 'domain',
11 direction: 'ASC',
12 },
13 });
14
15 Ext.define('PMG.TLSInboundDomainsEdit', {
16 extend: 'Proxmox.window.Edit',
17 xtype: 'pmgTLSInboundDomainsEdit',
18 onlineHelp: 'pmgconfig_mailproxy_tls',
19
20 subject: gettext('TLS Inbound domains'),
21 url: '/api2/extjs/config/tls-inbound-domains',
22 method: 'POST',
23
24 items: [
25 {
26 xtype: 'proxmoxtextfield',
27 name: 'domain',
28 fieldLabel: gettext('Domain'),
29 },
30 ],
31 });
32
33 Ext.define('PMG.MailProxyTLSInboundDomains', {
34 extend: 'Ext.grid.GridPanel',
35 alias: ['widget.pmgMailProxyTLSInboundDomains'],
36
37 viewConfig: {
38 trackOver: false,
39 },
40
41 columns: [
42 {
43 header: gettext('Domain'),
44 flex: 1,
45 sortable: true,
46 dataIndex: 'domain',
47 },
48 ],
49
50 initComponent: function() {
51 const me = this;
52
53 const rstore = Ext.create('Proxmox.data.UpdateStore', {
54 model: 'pmg-tls-inbound-domains',
55 storeid: 'pmg-mailproxy-tls-inbound-domains-store-' + ++Ext.idSeed,
56 });
57
58 const store = Ext.create('Proxmox.data.DiffStore', { rstore: rstore });
59 const reload = () => rstore.load();
60 me.selModel = Ext.create('Ext.selection.RowModel', {});
61 Proxmox.Utils.monStoreErrors(me, store, true);
62
63 Ext.apply(me, {
64 store,
65 tbar: [
66 {
67 text: gettext('Create'),
68 handler: () => {
69 Ext.createWidget('pmgTLSInboundDomainsEdit', {
70 autoShow: true,
71 listeners: {
72 destroy: reload,
73 },
74 });
75 },
76 },
77 {
78 xtype: 'proxmoxStdRemoveButton',
79 baseurl: '/config/tls-inbound-domains',
80 callback: reload,
81 waitMsgTarget: me,
82 },
83 ],
84 listeners: {
85 activate: rstore.startUpdate,
86 destroy: rstore.stopUpdate,
87 deactivate: rstore.stopUpdate,
88 },
89 });
90
91 me.callParent();
92 },
93 });