]>
git.proxmox.com Git - pmg-gui.git/blob - js/AttachmentGrid.js
6ef54cc7ed729140bdc69b72bf7abe5bfab50d68
1 Ext
.define('PMG.grid.AttachmentGrid', {
2 extend
: 'Ext.grid.GridPanel',
3 xtype
: 'pmgAttachmentGrid',
4 mixins
: ['Proxmox.Mixin.CBind'],
14 fields
: ['name', 'content-type', 'size'],
20 setID: function(rec
) {
22 if (!rec
|| !rec
.data
|| !rec
.data
.id
) {
23 me
.getStore().removeAll();
26 var url
= '/api2/json/quarantine/listattachments?id=' + rec
.data
.id
;
27 me
.mailid
= rec
.data
.id
;
28 me
.store
.proxy
.setUrl(url
);
32 emptyText
: gettext('No Attachments'),
34 download: function() {
35 Ext
.Msg
.alert(arguments
);
40 text
: gettext('Filename'),
45 text
: gettext('Filetype'),
46 dataIndex
: 'content-type',
47 renderer
: PMG
.Utils
.render_filetype
,
51 text
: gettext('Size'),
52 renderer
: Proxmox
.Utils
.format_size
,
57 header
: gettext('Download'),
59 hidden
: '{!showDownloads}',
61 renderer: function(value
, mD
, rec
) {
63 let url
= `/api2/json/quarantine/download?mailid=${me.mailid}&attachmentid=${rec.data.id}`;
64 return `<a target='_blank' class='download' download='${rec.data.name}' href='${url}'>
65 <i class='fa fa-fw fa-download'</i>