]>
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'],
10 fields
: ['name', 'content-type', 'size'],
16 setID: function(rec
) {
18 if (!rec
|| !rec
.data
|| !rec
.data
.id
) {
19 me
.getStore().removeAll();
22 var url
= '/api2/json/quarantine/listattachments?id=' + rec
.data
.id
;
23 me
.mailid
= rec
.data
.id
;
24 me
.store
.proxy
.setUrl(url
);
28 emptyText
: gettext('No Attachments'),
30 download: function() {
31 Ext
.Msg
.alert(arguments
);
36 text
: gettext('Filename'),
41 text
: gettext('Filetype'),
42 dataIndex
: 'content-type',
43 renderer
: PMG
.Utils
.render_filetype
,
47 text
: gettext('Size'),
48 renderer
: Proxmox
.Utils
.format_size
,
53 header
: gettext('Download'),
55 hidden
: '{!showDownloads}',
57 renderer: function(value
, mD
, rec
) {
59 let url
= `/api2/json/quarantine/download?mailid=${me.mailid}&attachmentid=${rec.data.id}`;
60 return `<a target='_blank' class='download' download='${rec.data.name}' href='${url}'>
61 <i class='fa fa-fw fa-download'</i>