]> git.proxmox.com Git - pmg-gui.git/blame - js/PostfixQShape.js
pbs remote: add namespace support
[pmg-gui.git] / js / PostfixQShape.js
CommitLineData
a1da2b36
DM
1Ext.define('pmg-qshape', {
2 extend: 'Ext.data.Model',
3 fields: [
4 'domain',
c87d46fb
TL
5 { type: 'integer', name: 'total' },
6 { type: 'integer', name: '5m' },
7 { type: 'integer', name: '10m' },
8 { type: 'integer', name: '20m' },
9 { type: 'integer', name: '40m' },
10 { type: 'integer', name: '80m' },
11 { type: 'integer', name: '160m' },
12 { type: 'integer', name: '320m' },
13 { type: 'integer', name: '640m' },
14 { type: 'integer', name: '1280m' },
15 { type: 'integer', name: '1280m+' },
a1da2b36 16 ],
c87d46fb 17 idProperty: 'domain',
a1da2b36
DM
18});
19
20Ext.define('PMG.Postfix.QShape', {
21 extend: 'Ext.grid.GridPanel',
22 alias: 'widget.pmgPostfixQShape',
23
c87d46fb 24 nodename: undefined,
f24df9c1 25
a1da2b36
DM
26 store: {
27 autoLoad: true,
c87d46fb 28 model: 'pmg-qshape',
a1da2b36
DM
29 },
30
31 controller: {
32
33 xclass: 'Ext.app.ViewController',
34
f24df9c1 35 init: function(view) {
c17f9fe4
DC
36 if (view.nodename) {
37 view.setNodename(view.nodename);
38 }
f24df9c1
DM
39 },
40
a1da2b36 41 onFlush: function() {
153408d5
DM
42 var view = this.getView();
43
44 Proxmox.Utils.API2Request({
723e6671 45 url: '/api2/extjs/nodes/' + view.nodename + '/postfix/flush_queues',
153408d5
DM
46 method: 'POST',
47 waitMsgTarget: view,
48 success: function(response, opts) {
49 view.store.load();
50 },
c87d46fb 51 failure: function(response, opts) {
153408d5 52 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
c87d46fb 53 },
153408d5 54 });
a1da2b36
DM
55 },
56
57 onDeleteAll: function() {
153408d5
DM
58 var view = this.getView();
59
60 Proxmox.Utils.API2Request({
91814a76
DM
61 url: '/api2/extjs/nodes/' + view.nodename + '/postfix/queue/deferred',
62 method: 'DELETE',
153408d5
DM
63 waitMsgTarget: view,
64 success: function(response, opts) {
65 view.store.load();
66 },
c87d46fb 67 failure: function(response, opts) {
153408d5 68 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
c87d46fb 69 },
153408d5 70 });
a1da2b36
DM
71 },
72
73 onDiscardVerifyDatabase: function() {
153408d5
DM
74 var view = this.getView();
75
76 Proxmox.Utils.API2Request({
723e6671 77 url: '/api2/extjs/nodes/' + view.nodename + '/postfix/discard_verify_cache',
153408d5
DM
78 method: 'POST',
79 waitMsgTarget: view,
c87d46fb 80 failure: function(response, opts) {
153408d5 81 Ext.Msg.alert(gettext('Error'), response.htmlStatus);
c87d46fb 82 },
153408d5 83 });
f24df9c1
DM
84 },
85
86 control: {
87 '#': {
88 activate: function() {
89 this.view.store.load(); // reload
c87d46fb
TL
90 },
91 },
92 },
a1da2b36
DM
93 },
94
95 tbar: [
96 {
97 text: gettext('Flush Queue'),
c87d46fb 98 handler: 'onFlush',
a1da2b36
DM
99 },
100 {
101 xtype: 'proxmoxButton',
102 text: gettext('Delete all Messages'),
153408d5
DM
103 dangerous: true,
104 confirmMsg: "Are you sure you want to delete all deferred mails?",
a1da2b36 105 selModel: null,
c87d46fb 106 handler: 'onDeleteAll',
a1da2b36
DM
107 },
108 {
a1da2b36 109 text: gettext('Discard address verification database'),
c87d46fb
TL
110 handler: 'onDiscardVerifyDatabase',
111 },
a1da2b36
DM
112 ],
113
114 columns: [
115 {
116 header: gettext('Domain'),
117 width: 200,
c87d46fb 118 dataIndex: 'domain',
a1da2b36
DM
119 },
120 {
121 header: gettext('Total'),
122 width: 80,
c87d46fb 123 dataIndex: 'total',
a1da2b36
DM
124 },
125 {
cc66960f 126 header: '5m',
a1da2b36 127 width: 80,
c87d46fb 128 dataIndex: '5m',
a1da2b36
DM
129 },
130 {
cc66960f 131 header: '10m',
a1da2b36 132 width: 80,
c87d46fb 133 dataIndex: '10m',
a1da2b36
DM
134 },
135 {
cc66960f 136 header: '20m',
a1da2b36 137 width: 80,
c87d46fb 138 dataIndex: '20m',
a1da2b36
DM
139 },
140 {
cc66960f 141 header: '40m',
a1da2b36 142 width: 80,
c87d46fb 143 dataIndex: '40m',
a1da2b36
DM
144 },
145 {
cc66960f 146 header: '80m',
a1da2b36 147 width: 80,
c87d46fb 148 dataIndex: '80m',
a1da2b36
DM
149 },
150 {
cc66960f 151 header: '160m',
a1da2b36 152 width: 80,
c87d46fb 153 dataIndex: '160m',
a1da2b36
DM
154 },
155 {
cc66960f 156 header: '320m',
a1da2b36 157 width: 80,
c87d46fb 158 dataIndex: '320m',
a1da2b36
DM
159 },
160 {
cc66960f 161 header: '640m',
a1da2b36 162 width: 80,
c87d46fb 163 dataIndex: '640m',
a1da2b36
DM
164 },
165 {
cc66960f 166 header: '1280m',
a1da2b36 167 width: 80,
c87d46fb 168 dataIndex: '1280m',
a1da2b36
DM
169 },
170 {
cc66960f 171 header: '1280m+',
a1da2b36 172 width: 80,
c87d46fb
TL
173 dataIndex: '1280m+',
174 },
f24df9c1
DM
175 ],
176
177 setNodename: function(nodename) {
178 var me = this;
179
180 me.nodename = nodename;
181
182 me.store.setProxy({
183 type: 'proxmox',
c87d46fb 184 url: "/api2/json/nodes/" + me.nodename + "/postfix/qshape",
f24df9c1
DM
185 });
186
187 me.store.load();
c87d46fb 188 },
f24df9c1 189
a1da2b36 190});