From ee355b4373c126b419e920adaffb89f485d6b1dd Mon Sep 17 00:00:00 2001 From: tobias <thinkdifferent055@gmail.com> Date: Sun, 8 Oct 2023 21:45:13 +0200 Subject: [PATCH] Rename actions and feedback --- actions.js | 32 ++++++++++++++++++++++---------- feedbacks.js | 26 ++++++++++++++++++-------- main.js | 2 ++ 3 files changed, 42 insertions(+), 18 deletions(-) diff --git a/actions.js b/actions.js index c03f571..acccc8c 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 7ae5627..2586a35 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 349696b..dc91ec8 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, }, -- GitLab