2018-08-15 18:47:09 +02:00
|
|
|
BlazeComponent.extendComponent({
|
|
|
|
|
onCreated() {
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
events() {
|
2018-09-14 17:39:37 +02:00
|
|
|
return [{
|
2019-01-02 22:32:08 +01:00
|
|
|
'click .js-create-card-action' (event) {
|
|
|
|
|
const ruleName = this.data().ruleName.get();
|
|
|
|
|
const trigger = this.data().triggerVar.get();
|
|
|
|
|
const cardName = this.find('#card-name').value;
|
|
|
|
|
const listName = this.find('#list-name').value;
|
|
|
|
|
const swimlaneName = this.find('#swimlane-name2').value;
|
|
|
|
|
const boardId = Session.get('currentBoard');
|
|
|
|
|
const desc = Utils.getTriggerActionDesc(event, this);
|
|
|
|
|
const triggerId = Triggers.insert(trigger);
|
|
|
|
|
const actionId = Actions.insert({
|
|
|
|
|
actionType: 'createCard',
|
|
|
|
|
swimlaneName,
|
|
|
|
|
cardName,
|
|
|
|
|
listName,
|
|
|
|
|
boardId,
|
|
|
|
|
desc,
|
|
|
|
|
});
|
|
|
|
|
Rules.insert({
|
|
|
|
|
title: ruleName,
|
|
|
|
|
triggerId,
|
|
|
|
|
actionId,
|
|
|
|
|
boardId,
|
|
|
|
|
});
|
2019-01-02 22:51:00 +01:00
|
|
|
|
2019-01-02 22:32:08 +01:00
|
|
|
},
|
2019-01-02 15:42:10 +01:00
|
|
|
'click .js-add-swimlane-action' (event) {
|
|
|
|
|
const ruleName = this.data().ruleName.get();
|
|
|
|
|
const trigger = this.data().triggerVar.get();
|
|
|
|
|
const swimlaneName = this.find('#swimlane-name').value;
|
|
|
|
|
const boardId = Session.get('currentBoard');
|
|
|
|
|
const desc = Utils.getTriggerActionDesc(event, this);
|
|
|
|
|
const triggerId = Triggers.insert(trigger);
|
|
|
|
|
const actionId = Actions.insert({
|
|
|
|
|
actionType: 'addSwimlane',
|
|
|
|
|
swimlaneName,
|
|
|
|
|
boardId,
|
|
|
|
|
desc,
|
|
|
|
|
});
|
|
|
|
|
Rules.insert({
|
|
|
|
|
title: ruleName,
|
|
|
|
|
triggerId,
|
|
|
|
|
actionId,
|
|
|
|
|
boardId,
|
|
|
|
|
});
|
2019-01-02 22:51:00 +01:00
|
|
|
|
2019-01-02 15:42:10 +01:00
|
|
|
},
|
2018-09-14 17:39:37 +02:00
|
|
|
'click .js-add-spec-move-action' (event) {
|
|
|
|
|
const ruleName = this.data().ruleName.get();
|
|
|
|
|
const trigger = this.data().triggerVar.get();
|
|
|
|
|
const actionSelected = this.find('#move-spec-action').value;
|
|
|
|
|
const listTitle = this.find('#listName').value;
|
|
|
|
|
const boardId = Session.get('currentBoard');
|
|
|
|
|
const desc = Utils.getTriggerActionDesc(event, this);
|
2018-09-16 01:50:36 +03:00
|
|
|
if (actionSelected === 'top') {
|
2018-09-14 17:39:37 +02:00
|
|
|
const triggerId = Triggers.insert(trigger);
|
|
|
|
|
const actionId = Actions.insert({
|
2018-09-16 01:50:36 +03:00
|
|
|
actionType: 'moveCardToTop',
|
|
|
|
|
listTitle,
|
|
|
|
|
boardId,
|
|
|
|
|
desc,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
Rules.insert({
|
|
|
|
|
title: ruleName,
|
2018-09-16 01:50:36 +03:00
|
|
|
triggerId,
|
|
|
|
|
actionId,
|
|
|
|
|
boardId,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
}
|
2018-09-16 01:50:36 +03:00
|
|
|
if (actionSelected === 'bottom') {
|
2018-09-14 17:39:37 +02:00
|
|
|
const triggerId = Triggers.insert(trigger);
|
|
|
|
|
const actionId = Actions.insert({
|
2018-09-16 01:50:36 +03:00
|
|
|
actionType: 'moveCardToBottom',
|
|
|
|
|
listTitle,
|
|
|
|
|
boardId,
|
|
|
|
|
desc,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
Rules.insert({
|
|
|
|
|
title: ruleName,
|
2018-09-16 01:50:36 +03:00
|
|
|
triggerId,
|
|
|
|
|
actionId,
|
|
|
|
|
boardId,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'click .js-add-gen-move-action' (event) {
|
|
|
|
|
const desc = Utils.getTriggerActionDesc(event, this);
|
|
|
|
|
const boardId = Session.get('currentBoard');
|
|
|
|
|
const ruleName = this.data().ruleName.get();
|
|
|
|
|
const trigger = this.data().triggerVar.get();
|
|
|
|
|
const actionSelected = this.find('#move-gen-action').value;
|
2018-09-16 01:50:36 +03:00
|
|
|
if (actionSelected === 'top') {
|
2018-09-14 17:39:37 +02:00
|
|
|
const triggerId = Triggers.insert(trigger);
|
|
|
|
|
const actionId = Actions.insert({
|
2018-09-16 01:50:36 +03:00
|
|
|
actionType: 'moveCardToTop',
|
|
|
|
|
'listTitle': '*',
|
|
|
|
|
boardId,
|
|
|
|
|
desc,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
Rules.insert({
|
|
|
|
|
title: ruleName,
|
2018-09-16 01:50:36 +03:00
|
|
|
triggerId,
|
|
|
|
|
actionId,
|
|
|
|
|
boardId,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
}
|
2018-09-16 01:50:36 +03:00
|
|
|
if (actionSelected === 'bottom') {
|
2018-09-14 17:39:37 +02:00
|
|
|
const triggerId = Triggers.insert(trigger);
|
|
|
|
|
const actionId = Actions.insert({
|
2018-09-16 01:50:36 +03:00
|
|
|
actionType: 'moveCardToBottom',
|
|
|
|
|
'listTitle': '*',
|
|
|
|
|
boardId,
|
|
|
|
|
desc,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
Rules.insert({
|
|
|
|
|
title: ruleName,
|
2018-09-16 01:50:36 +03:00
|
|
|
triggerId,
|
|
|
|
|
actionId,
|
|
|
|
|
boardId,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
'click .js-add-arch-action' (event) {
|
|
|
|
|
const desc = Utils.getTriggerActionDesc(event, this);
|
|
|
|
|
const boardId = Session.get('currentBoard');
|
|
|
|
|
const ruleName = this.data().ruleName.get();
|
|
|
|
|
const trigger = this.data().triggerVar.get();
|
|
|
|
|
const actionSelected = this.find('#arch-action').value;
|
2018-09-16 01:50:36 +03:00
|
|
|
if (actionSelected === 'archive') {
|
2018-09-14 17:39:37 +02:00
|
|
|
const triggerId = Triggers.insert(trigger);
|
|
|
|
|
const actionId = Actions.insert({
|
2018-09-16 01:50:36 +03:00
|
|
|
actionType: 'archive',
|
|
|
|
|
boardId,
|
|
|
|
|
desc,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
Rules.insert({
|
|
|
|
|
title: ruleName,
|
2018-09-16 01:50:36 +03:00
|
|
|
triggerId,
|
|
|
|
|
actionId,
|
|
|
|
|
boardId,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
}
|
2018-09-16 01:50:36 +03:00
|
|
|
if (actionSelected === 'unarchive') {
|
2018-09-14 17:39:37 +02:00
|
|
|
const triggerId = Triggers.insert(trigger);
|
|
|
|
|
const actionId = Actions.insert({
|
2018-09-16 01:50:36 +03:00
|
|
|
actionType: 'unarchive',
|
|
|
|
|
boardId,
|
|
|
|
|
desc,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
Rules.insert({
|
|
|
|
|
title: ruleName,
|
2018-09-16 01:50:36 +03:00
|
|
|
triggerId,
|
|
|
|
|
actionId,
|
|
|
|
|
boardId,
|
2018-09-14 17:39:37 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}];
|
|
|
|
|
},
|
2018-08-15 18:47:09 +02:00
|
|
|
|
2018-09-16 01:50:36 +03:00
|
|
|
}).register('boardActions');
|
|
|
|
|
/* eslint-no-undef */
|