* Add publications for admin reports

* remove broken cards from user menu
* Adjust report titles
This commit is contained in:
John R. Supplee 2021-04-06 12:42:15 +02:00
parent 0e593c7d81
commit 5a6f84ce34
4 changed files with 65 additions and 11 deletions

View file

@ -25,10 +25,6 @@ template(name="memberMenuPopup")
a.js-global-search(href="{{pathFor 'global-search'}}")
i.fa.fa-search
| {{_ 'globalSearch-title'}}
li
a.js-broken-cards(href="{{pathFor 'broken-cards'}}")
i.fa.fa-chain-broken
| {{_ 'broken-cards'}}
li
a(href="{{pathFor 'home'}}")
span.fa.fa-home

View file

@ -992,7 +992,7 @@
"move-swimlane": "Move Swimlane",
"moveSwimlanePopup-title": "Move Swimlane",
"creator": "Creator",
"filesReportTitle": "Attachments Report",
"filesReportTitle": "Files Report",
"orphanedFilesReportTitle": "Orphaned Files Report",
"reports": "Reports"
}

View file

@ -0,0 +1,60 @@
import Attachments, { AttachmentStorage } from '/models/attachments';
import { ObjectID } from 'bson';
Meteor.publish('attachmentsList', function() {
// eslint-disable-next-line no-console
// console.log('attachments:', AttachmentStorage.find());
const files = AttachmentStorage.find(
{},
{
fields: {
_id: 1,
filename: 1,
md5: 1,
length: 1,
contentType: 1,
metadata: 1,
},
sort: {
filename: 1,
},
limit: 250,
},
);
const attIds = [];
files.forEach(file => {
attIds.push(file._id._str);
});
return [
files,
Attachments.find({ 'copies.attachments.key': { $in: attIds } }),
];
});
Meteor.publish('orphanedAttachments', function() {
let keys = [];
Attachments.find({}, { fields: { copies: 1 } }).forEach(att => {
keys.push(new ObjectID(att.copies.attachments.key));
});
keys.sort();
keys = _.uniq(keys, true);
return AttachmentStorage.find(
{ _id: { $nin: keys } },
{
fields: {
_id: 1,
filename: 1,
md5: 1,
length: 1,
contentType: 1,
metadata: 1,
},
sort: {
filename: 1,
},
limit: 250,
},
);
});

View file

@ -45,8 +45,8 @@ import {
PREDICATE_PUBLIC,
PREDICATE_START_AT,
PREDICATE_SYSTEM,
} from '../../config/search-const';
import { QueryErrors, QueryParams, Query } from '../../config/query-classes';
} from '/config/search-const';
import { QueryErrors, QueryParams, Query } from '/config/query-classes';
const escapeForRegex = require('escape-string-regexp');
@ -598,10 +598,8 @@ function findCards(sessionId, query) {
// console.log('selector.$and:', query.selector.$and);
// eslint-disable-next-line no-console
// console.log('projection:', projection);
let cards;
// if (!query.hasErrors()) {
cards = Cards.find(query.selector, query.projection);
// }
const cards = Cards.find(query.selector, query.projection);
// eslint-disable-next-line no-console
// console.log('count:', cards.count());