diff --git a/actions.js b/actions.js index c03f571e70a4e9a28d9389ca728bcef4e751395a..acccc8cccc3b920409337fd4fc945da27213de95 100644 --- a/actions.js +++ b/actions.js @@ -1,25 +1,37 @@ module.exports = function (self) { self.setActionDefinitions({ - pad_trigger_action: { - name: 'Trigger Pad', + pad_playback_action: { + name: 'Pad Playback', options: [ + { + id: 'type', + type: "dropdown", + choices: [ + { id: 'NAME', label: 'Name' }, + { id: 'NUMBER', label: 'Number' } + ], + label: 'Type', + default: 'NUMBER' + }, { id: 'name', type: 'textinput', label: 'Pad Name', default: '', - required: false + required: true, + isVisible: (options) => options.type === 'NAME' }, { id: 'index', type: 'number', - label: 'Pad ID', + label: 'Pad Number', default: '', - required: false + required: true, + isVisible: (options) => options.type === 'NUMBER' }, ], callback: async (event) => { - if (event.options.name) { + if (event.options.type === 'NAME') { const pad = self.currentProject.findPadByName(event.options.name); if (!pad) { self.log('warning', 'Cannot find a pad with name ' + event.options.name); @@ -35,8 +47,8 @@ module.exports = function (self) { } }, }, - page_action: { - name: 'Set Page', + page_set_action: { + name: 'Page Set', options: [ { id: 'page', @@ -51,8 +63,8 @@ module.exports = function (self) { }); }, }, - navigate_action: { - name: 'Navigate', + pad_navigate_action: { + name: 'Page Navigate', options: [ { id: 'type', diff --git a/feedbacks.js b/feedbacks.js index 7ae5627e5e3a150e360f39f69f078d4d69632e01..2586a35dc0085aa18ad0b6eeaf418f2b08df50a3 100644 --- a/feedbacks.js +++ b/feedbacks.js @@ -5,26 +5,37 @@ module.exports = async function (self) { PadStatus: { name: 'Pad Status', type: 'advanced', - label: 'Pad Status', options: [ + { + id: 'type', + type: "dropdown", + choices: [ + { id: 'NAME', label: 'Name' }, + { id: 'NUMBER', label: 'Number' } + ], + label: 'Type', + default: 'NUMBER' + }, { id: 'name', type: 'textinput', label: 'Pad Name', default: '', - required: false + required: true, + isVisible: (options) => options.type === 'NAME' }, { id: 'index', type: 'number', - label: 'Pad ID', + label: 'Pad Number', default: '', - required: false + required: true, + isVisible: (options) => options.type === 'NUMBER' }, ], callback: (feedback, context) => { let pad; - if (feedback.options.name) { + if (feedback.options.type === 'NAME') { self.log('debug', `Update feedback for pad name ${feedback.options.name}`); pad = self.currentProject.findPadByName(feedback.options.name); } else { @@ -53,10 +64,9 @@ module.exports = async function (self) { } }, }, - CurrentPage: { - name: 'Current Page', + PageActive: { + name: 'Page Active', type: 'boolean', - label: 'Pad Status', defaultStyle: { color: combineRgb(255, 255, 255), bgcolor: combineRgb(255, 0, 0) diff --git a/main.js b/main.js index 349696bc8f9641943a24e22691acb67c6adf86e6..dc91ec8760178e323d01472300235b0b88cc35a8 100644 --- a/main.js +++ b/main.js @@ -63,6 +63,7 @@ class ModuleInstance extends InstanceBase { type: 'textinput', id: 'host', label: 'PlayWall IP', + default: '127.0.0.1', width: 8, regex: Regex.IP, }, @@ -70,6 +71,7 @@ class ModuleInstance extends InstanceBase { type: 'textinput', id: 'port', label: 'PlayWall Port', + default: '9876', width: 4, regex: Regex.PORT, },