collapsible: true,
titleCollapse: true,
+ tbar: [
+ '->',
+ {
+ xtype: 'checkbox',
+ boxLabel: gettext('Show All Parts'),
+ boxLabelAlgign: 'before',
+ listeners: {
+ change: function(checkBox, value) {
+ let store = this.up('pmgAttachmentGrid').getStore();
+ store.clearFilter();
+ if (!value) {
+ store.filter({
+ property: 'content-disposition',
+ value: 'attachment',
+ });
+ }
+ },
+ },
+ },
+ ],
+
store: {
autoDestroy: true,
- fields: ['name', 'content-type', 'size'],
+ fields: ['name', 'content-type', 'size', 'content-disposition'],
proxy: {
type: 'proxmox',
},
+ filters: {
+ property: 'content-disposition',
+ value: 'attachment',
+ },
},
controller: {
view.updateTitleStats(-1);
return;
}
- let totalSize = records.reduce((sum, { data }) => sum + data.size, 0);
- view.updateTitleStats(records.length, totalSize);
+ let attachments = records.filter(({ data }) => data['content-disposition'] === 'attachment');
+ let totalSize = attachments.reduce((sum, { data }) => sum + data.size, 0);
+ view.updateTitleStats(attachments.length, totalSize);
},
},