mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 00:10:13 +01:00
Files Report works now with Meteor-Files (needed migration to new code)
This commit is contained in:
parent
cfb88baa7f
commit
dace63d4dc
3 changed files with 15 additions and 36 deletions
|
|
@ -88,18 +88,14 @@ template(name="filesReport")
|
||||||
th Filename
|
th Filename
|
||||||
th.right Size (kB)
|
th.right Size (kB)
|
||||||
th MIME Type
|
th MIME Type
|
||||||
th.center Usage
|
|
||||||
th MD5 Sum
|
|
||||||
th ID
|
th ID
|
||||||
|
|
||||||
each att in results
|
each att in results
|
||||||
tr
|
tr
|
||||||
td {{ att.filename }}
|
td {{ att.name }}
|
||||||
td.right {{fileSize att.length }}
|
td.right {{fileSize att.size }}
|
||||||
td {{ att.contentType }}
|
td {{ att.type }}
|
||||||
td.center {{usageCount att._id.toHexString }}
|
td {{ att._id }}
|
||||||
td {{ att.md5 }}
|
|
||||||
td {{ att._id.toHexString }}
|
|
||||||
else
|
else
|
||||||
div {{_ 'no-results' }}
|
div {{_ 'no-results' }}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { AttachmentStorage } from '/models/attachments';
|
import Attachments from '/models/attachments';
|
||||||
import { CardSearchPagedComponent } from '/client/lib/cardSearch';
|
import { CardSearchPagedComponent } from '/client/lib/cardSearch';
|
||||||
import SessionData from '/models/usersessiondata';
|
import SessionData from '/models/usersessiondata';
|
||||||
import { QueryParams } from '/config/query-classes';
|
import { QueryParams } from '/config/query-classes';
|
||||||
|
|
@ -103,8 +103,6 @@ class AdminReport extends BlazeComponent {
|
||||||
|
|
||||||
results() {
|
results() {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
// console.log('attachments:', AttachmentStorage.find());
|
|
||||||
// console.log('attachments.count:', AttachmentStorage.find().count());
|
|
||||||
return this.collection.find();
|
return this.collection.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -124,10 +122,6 @@ class AdminReport extends BlazeComponent {
|
||||||
return Math.round(size / 1024);
|
return Math.round(size / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
usageCount(key) {
|
|
||||||
return Attachments.find({ 'copies.attachments.key': key }).count();
|
|
||||||
}
|
|
||||||
|
|
||||||
abbreviate(text) {
|
abbreviate(text) {
|
||||||
if (text.length > 30) {
|
if (text.length > 30) {
|
||||||
return `${text.substr(0, 29)}...`;
|
return `${text.substr(0, 29)}...`;
|
||||||
|
|
@ -137,7 +131,7 @@ class AdminReport extends BlazeComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
(class extends AdminReport {
|
(class extends AdminReport {
|
||||||
collection = AttachmentStorage;
|
collection = Attachments;
|
||||||
}.register('filesReport'));
|
}.register('filesReport'));
|
||||||
|
|
||||||
(class extends AdminReport {
|
(class extends AdminReport {
|
||||||
|
|
|
||||||
|
|
@ -1,35 +1,24 @@
|
||||||
import Attachments, { AttachmentStorage } from '/models/attachments';
|
import Attachments from '/models/attachments';
|
||||||
import { ObjectID } from 'bson';
|
import { ObjectID } from 'bson';
|
||||||
|
|
||||||
Meteor.publish('attachmentsList', function() {
|
Meteor.publish('attachmentsList', function() {
|
||||||
// eslint-disable-next-line no-console
|
const ret = Attachments.find(
|
||||||
// console.log('attachments:', AttachmentStorage.find());
|
|
||||||
const files = AttachmentStorage.find(
|
|
||||||
{},
|
{},
|
||||||
{
|
{
|
||||||
fields: {
|
fields: {
|
||||||
_id: 1,
|
_id: 1,
|
||||||
filename: 1,
|
name: 1,
|
||||||
md5: 1,
|
size: 1,
|
||||||
length: 1,
|
type: 1,
|
||||||
contentType: 1,
|
meta: 1,
|
||||||
metadata: 1,
|
|
||||||
},
|
},
|
||||||
sort: {
|
sort: {
|
||||||
filename: 1,
|
name: 1,
|
||||||
},
|
},
|
||||||
limit: 250,
|
limit: 250,
|
||||||
},
|
},
|
||||||
);
|
).cursor;
|
||||||
const attIds = [];
|
return ret;
|
||||||
files.forEach(file => {
|
|
||||||
attIds.push(file._id._str);
|
|
||||||
});
|
|
||||||
|
|
||||||
return [
|
|
||||||
files,
|
|
||||||
Attachments.find({ 'copies.attachments.key': { $in: attIds } }),
|
|
||||||
];
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Meteor.publish('orphanedAttachments', function() {
|
Meteor.publish('orphanedAttachments', function() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue