]> git.proxmox.com Git - pmg-gui.git/blame - js/SpamInfoGrid.js
SpamInfoGrid.js - use single store object
[pmg-gui.git] / js / SpamInfoGrid.js
CommitLineData
79a3f18d
DC
1Ext.define('PMG.grid.SpamInfoGrid',{
2 extend: 'Ext.grid.GridPanel',
3 xtype: 'pmgSpamInfoGrid',
4
c8114985
DM
5 store: {
6 autoDestroy: true,
7 fields: [ 'desc', 'name', { type: 'number', name: 'score' } ],
8 proxy: {
9 type: 'proxmox',
10 root: 'data.spaminfo'
11 }
12 },
13
79a3f18d
DC
14 setID: function(rec) {
15 var me = this;
16 if (!rec || !rec.data || !rec.data.id) {
17 me.getStore().removeAll();
18 return;
19 }
c8114985
DM
20 var url = '/api2/json/quarantine/content?id=' + rec.data.id;
21 me.store.proxy.setUrl(url);
22 me.store.load();
79a3f18d
DC
23 },
24
25 emptyText: gettext('No Spam Info'),
26 hidden: true,
79a3f18d
DC
27
28 features: [{
29 ftype: 'summary'
30 }],
31
32 columns: [
33 {
34 text: gettext('Test Name'),
35 dataIndex: 'name',
36 flex: 2,
37 summaryType: 'count',
38 summaryRenderer: function(value, summaryData, dataIndex, metaData) {
39 return gettext('Spamscore');
40 }
41 },
42 {
43 text: gettext('Score'),
44 dataIndex: 'score',
45 align: 'right',
46 summaryType: 'sum',
47 summaryRenderer: function(value, summaryData, dataIndex, metaData) {
48 return Ext.util.Format.round(value, 5);
49 }
50 },
51 {
52 text: gettext('Description'),
53 dataIndex: 'desc',
54 flex: 3
55 }
56 ],
57});