diff --git a/actions.js b/actions.js index d730f5530197130d9dda1c79d4be636f514361a8..c03f571e70a4e9a28d9389ca728bcef4e751395a 100644 --- a/actions.js +++ b/actions.js @@ -8,17 +8,31 @@ module.exports = function (self) { type: 'textinput', label: 'Pad Name', default: '', + required: false + }, + { + id: 'index', + type: 'number', + label: 'Pad ID', + default: '', + required: false }, ], callback: async (event) => { - const pad = self.currentProject.findPadByName(event.options.name); - if (!pad) { - self.log('warning', 'Cannot find a pad with name ' + event.options.name); - return; + if (event.options.name) { + const pad = self.currentProject.findPadByName(event.options.name); + if (!pad) { + self.log('warning', 'Cannot find a pad with name ' + event.options.name); + return; + } + self.sendToWebSocket('cart-action', { + 'padId': pad.id + }); + } else if (event.options.index) { + self.sendToWebSocket('cart-action', { + 'padIndex': event.options.index - 1 + }); } - self.sendToWebSocket('cart-action', { - 'pad': pad.id - }); }, }, page_action: {