Add Boards Report to Admin Reports

This commit is contained in:
John R. Supplee 2021-12-20 16:52:18 +02:00
parent 84d0817894
commit d9c290deda
4 changed files with 107 additions and 0 deletions

View file

@ -26,6 +26,11 @@ template(name="adminReports")
i.fa.fa-magic
| {{_ 'rulesReportTitle'}}
li
a.js-report-boards(data-id="report-boards")
i.fa.fa-magic
| {{_ 'boardsReportTitle'}}
li
a.js-report-cards(data-id="report-cards")
i.fa.fa-magic
@ -42,6 +47,8 @@ template(name="adminReports")
+orphanedFilesReport
else if showRulesReport.get
+rulesReport
else if showBoardsReport.get
+boardsReport
else if showCardsReport.get
+cardsReport
@ -139,3 +146,20 @@ template(name="cardsReport")
td {{userNames card.assignees }}
else
div {{_ 'no-results' }}
template(name="boardsReport")
h1 {{_ 'boardsReportTitle'}}
if resultsCount
table.table
tr
th Title
th Id
th Members
each board in results
tr
td {{abbreviate board.title }}
td {{abbreviate board._id }}
td {{userNames board.members }}
else
div {{_ 'no-results' }}

View file

@ -11,6 +11,7 @@ BlazeComponent.extendComponent({
showOrphanedFilesReport: new ReactiveVar(false),
showRulesReport: new ReactiveVar(false),
showCardsReport: new ReactiveVar(false),
showBoardsReport: new ReactiveVar(false),
sessionId: null,
onCreated() {
@ -27,6 +28,7 @@ BlazeComponent.extendComponent({
'click a.js-report-orphaned-files': this.switchMenu,
'click a.js-report-rules': this.switchMenu,
'click a.js-report-cards': this.switchMenu,
'click a.js-report-boards': this.switchMenu,
},
];
},
@ -38,6 +40,9 @@ BlazeComponent.extendComponent({
this.showFilesReport.set(false);
this.showBrokenCardsReport.set(false);
this.showOrphanedFilesReport.set(false);
this.showRulesReport.set(false)
this.showBoardsReport.set(false);
this.showCardsReport.set(false);
if (this.subscription) {
this.subscription.stop();
}
@ -70,6 +75,11 @@ BlazeComponent.extendComponent({
this.showRulesReport.set(true);
this.loading.set(false);
});
} else if ('report-boards' === targetID) {
this.subscription = Meteor.subscribe('boardsReport', () => {
this.showBoardsReport.set(true);
this.loading.set(false);
});
} else if ('report-cards' === targetID) {
const qp = new QueryParams();
qp.addPredicate(OPERATOR_LIMIT, 300);
@ -149,6 +159,24 @@ class AdminReport extends BlazeComponent {
}
}.register('rulesReport'));
(class extends AdminReport {
collection = Boards;
userNames(members) {
let text = '';
members.forEach(member => {
const user = Users.findOne(member.userId);
text += text ? ', ' : '';
if (user) {
text += user.username;
} else {
text += member.userId
}
});
return text;
}
}.register('boardsReport'));
(class extends AdminReport {
collection = Cards;