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