summaryrefslogtreecommitdiffstats
path: root/client/components/rules/ruleDetails.js
blob: 17c86dc3e54a594bb81d75e1600690a3839eb061 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
BlazeComponent.extendComponent({
  onCreated() {
    this.subscribe('allRules');
    this.subscribe('allTriggers');
    this.subscribe('allActions');

  },

  trigger() {
    const ruleId = this.data().ruleId;
    const rule = Rules.findOne({
      _id: ruleId.get(),
    });
    const trigger = Triggers.findOne({
      _id: rule.triggerId,
    });
    const desc = trigger.description();
    const upperdesc = desc.charAt(0).toUpperCase() + desc.substr(1);
    return upperdesc;
  },
  action() {
    const ruleId = this.data().ruleId;
    const rule = Rules.findOne({
      _id: ruleId.get(),
    });
    const action = Actions.findOne({
      _id: rule.actionId,
    });
    const desc = action.description();
    const upperdesc = desc.charAt(0).toUpperCase() + desc.substr(1);
    return upperdesc;
  },

  events() {
    return [{}];
  },

}).register('ruleDetails');