mirror of
https://github.com/wekan/wekan.git
synced 2025-12-18 00:10:13 +01:00
Add new rules report
This commit is contained in:
parent
4aee129cdc
commit
1d4a65d0b4
4 changed files with 108 additions and 0 deletions
|
|
@ -21,6 +21,11 @@ template(name="adminReports")
|
||||||
i.fa.fa-paperclip
|
i.fa.fa-paperclip
|
||||||
| {{_ 'filesReportTitle'}}
|
| {{_ 'filesReportTitle'}}
|
||||||
|
|
||||||
|
li
|
||||||
|
a.js-report-rules(data-id="report-rules")
|
||||||
|
i.fa.fa-paperclip
|
||||||
|
| {{_ 'rulesReportTitle'}}
|
||||||
|
|
||||||
.main-body
|
.main-body
|
||||||
if loading.get
|
if loading.get
|
||||||
+spinner
|
+spinner
|
||||||
|
|
@ -30,6 +35,8 @@ template(name="adminReports")
|
||||||
+filesReport
|
+filesReport
|
||||||
else if showOrphanedFilesReport.get
|
else if showOrphanedFilesReport.get
|
||||||
+orphanedFilesReport
|
+orphanedFilesReport
|
||||||
|
else if showRulesReport.get
|
||||||
|
+rulesReport
|
||||||
|
|
||||||
|
|
||||||
template(name="brokenCardsReport")
|
template(name="brokenCardsReport")
|
||||||
|
|
@ -40,6 +47,25 @@ template(name="brokenCardsReport")
|
||||||
else
|
else
|
||||||
div {{_ 'no-results' }}
|
div {{_ 'no-results' }}
|
||||||
|
|
||||||
|
template(name="rulesReport")
|
||||||
|
h1 {{_ 'rulesReportTitle'}}
|
||||||
|
if resultsCount
|
||||||
|
table.table
|
||||||
|
tr
|
||||||
|
th Rule Title
|
||||||
|
th Board Title
|
||||||
|
th actionType
|
||||||
|
th activityType
|
||||||
|
|
||||||
|
each rule in rows
|
||||||
|
tr
|
||||||
|
td {{ rule.title }}
|
||||||
|
td {{ rule.boardTitle }}
|
||||||
|
td {{ rule.action.actionType }}
|
||||||
|
td {{ rule.trigger.activityType }}
|
||||||
|
else
|
||||||
|
div {{_ 'no-results' }}
|
||||||
|
|
||||||
template(name="filesReport")
|
template(name="filesReport")
|
||||||
h1 {{_ 'filesReportTitle'}}
|
h1 {{_ 'filesReportTitle'}}
|
||||||
if resultsCount
|
if resultsCount
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ BlazeComponent.extendComponent({
|
||||||
showFilesReport: new ReactiveVar(false),
|
showFilesReport: new ReactiveVar(false),
|
||||||
showBrokenCardsReport: new ReactiveVar(false),
|
showBrokenCardsReport: new ReactiveVar(false),
|
||||||
showOrphanedFilesReport: new ReactiveVar(false),
|
showOrphanedFilesReport: new ReactiveVar(false),
|
||||||
|
showRulesReport: new ReactiveVar(false),
|
||||||
|
|
||||||
onCreated() {
|
onCreated() {
|
||||||
this.error = new ReactiveVar('');
|
this.error = new ReactiveVar('');
|
||||||
|
|
@ -19,6 +20,7 @@ BlazeComponent.extendComponent({
|
||||||
'click a.js-report-broken': this.switchMenu,
|
'click a.js-report-broken': this.switchMenu,
|
||||||
'click a.js-report-files': this.switchMenu,
|
'click a.js-report-files': this.switchMenu,
|
||||||
'click a.js-report-orphaned-files': this.switchMenu,
|
'click a.js-report-orphaned-files': this.switchMenu,
|
||||||
|
'click a.js-report-rules': this.switchMenu,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
@ -57,6 +59,11 @@ BlazeComponent.extendComponent({
|
||||||
this.subscription = Meteor.subscribe('orphanedAttachments', () => {
|
this.subscription = Meteor.subscribe('orphanedAttachments', () => {
|
||||||
this.loading.set(false);
|
this.loading.set(false);
|
||||||
});
|
});
|
||||||
|
} else if ('report-rules' === targetID) {
|
||||||
|
this.subscription = Meteor.subscribe('rulesReport', () => {
|
||||||
|
this.showRulesReport.set(true);
|
||||||
|
this.loading.set(false);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -70,6 +77,23 @@ Template.filesReport.helpers({
|
||||||
return AttachmentStorage.find();
|
return AttachmentStorage.find();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
rulesReport() {
|
||||||
|
const rules = [];
|
||||||
|
|
||||||
|
Rules.find().forEach(rule => {
|
||||||
|
rules.push({
|
||||||
|
_id: rule._id,
|
||||||
|
title: rule.title,
|
||||||
|
boardId: rule.boardId,
|
||||||
|
boardTitle: rule.board().title,
|
||||||
|
action: rule.action().fetch(),
|
||||||
|
trigger: rule.trigger().fetch(),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return rules;
|
||||||
|
},
|
||||||
|
|
||||||
resultsCount() {
|
resultsCount() {
|
||||||
return AttachmentStorage.find().count();
|
return AttachmentStorage.find().count();
|
||||||
},
|
},
|
||||||
|
|
@ -100,6 +124,30 @@ Template.orphanedFilesReport.helpers({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Template.rulesReport.helpers({
|
||||||
|
rows() {
|
||||||
|
const rules = [];
|
||||||
|
|
||||||
|
Rules.find().forEach(rule => {
|
||||||
|
rules.push({
|
||||||
|
_id: rule._id,
|
||||||
|
title: rule.title,
|
||||||
|
boardId: rule.boardId,
|
||||||
|
boardTitle: rule.board().title,
|
||||||
|
action: rule.action(),
|
||||||
|
trigger: rule.trigger(),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('rows:', rules);
|
||||||
|
return rules;
|
||||||
|
},
|
||||||
|
|
||||||
|
resultsCount() {
|
||||||
|
return Rules.find().count();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
class BrokenCardsComponent extends CardSearchPagedComponent {
|
class BrokenCardsComponent extends CardSearchPagedComponent {
|
||||||
onCreated() {
|
onCreated() {
|
||||||
super.onCreated();
|
super.onCreated();
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,15 @@ Rules.helpers({
|
||||||
getTrigger() {
|
getTrigger() {
|
||||||
return Triggers.findOne({ _id: this.triggerId });
|
return Triggers.findOne({ _id: this.triggerId });
|
||||||
},
|
},
|
||||||
|
board() {
|
||||||
|
return Boards.findOne({ _id: this.boardId });
|
||||||
|
},
|
||||||
|
trigger() {
|
||||||
|
return Triggers.findOne({ _id: this.triggerId });
|
||||||
|
},
|
||||||
|
action() {
|
||||||
|
return Actions.findOne({ _id: this.actionId });
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Rules.allow({
|
Rules.allow({
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,8 @@
|
||||||
|
import Boards from '/models/boards';
|
||||||
|
import Actions from '/models/actions';
|
||||||
|
import Triggers from '/models/triggers';
|
||||||
|
import Rules from '/models/rules';
|
||||||
|
|
||||||
Meteor.publish('rules', ruleId => {
|
Meteor.publish('rules', ruleId => {
|
||||||
check(ruleId, String);
|
check(ruleId, String);
|
||||||
return Rules.find({
|
return Rules.find({
|
||||||
|
|
@ -16,3 +21,23 @@ Meteor.publish('allTriggers', () => {
|
||||||
Meteor.publish('allActions', () => {
|
Meteor.publish('allActions', () => {
|
||||||
return Actions.find({});
|
return Actions.find({});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Meteor.publish('rulesReport', () => {
|
||||||
|
const rules = Rules.find();
|
||||||
|
const actionIds = [];
|
||||||
|
const triggerIds = [];
|
||||||
|
const boardIds = [];
|
||||||
|
|
||||||
|
rules.forEach(rule => {
|
||||||
|
actionIds.push(rule.actionId);
|
||||||
|
triggerIds.push(rule.triggerId);
|
||||||
|
boardIds.push(rule.boardId);
|
||||||
|
});
|
||||||
|
|
||||||
|
return [
|
||||||
|
rules,
|
||||||
|
Actions.find({ _id: { $in: actionIds } }),
|
||||||
|
Triggers.find({ _id: { $in: triggerIds } }),
|
||||||
|
Boards.find({ _id: { $in: boardIds } }, { fields: { title: 1 } }),
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue