diff --git a/src/api/preset/presetRouter.ts b/src/api/preset/presetRouter.ts index c65c00c8..cf164c9d 100644 --- a/src/api/preset/presetRouter.ts +++ b/src/api/preset/presetRouter.ts @@ -27,10 +27,12 @@ export const presetRouter = ( e131.convertObjectToChannelData(value.data), value.fadeTime * 1000 ) + resolve({}) } else if (value.type === 'osc' && value.data !== null) { Object.entries(value.data).forEach(presetData => { osc.send(presetData) }) + resolve({}) } else if (value.type === 'http' && value.data !== null) { // Make the HTTP request axios({ @@ -42,15 +44,19 @@ export const presetRouter = ( }).catch(err => { logger.info('Preset HTTP request failed', { err }) }) + resolve({}) } else if (value.type === 'macro' && value.data !== null) { value.data.forEach((step: { type: string; value: string; key: string }) => { + logger.info(step) if (step.type === 'preset' && parseInt(step.value) !== value.id) { // Trigger the presets in the macro presetRouter(['recall', step.value], 'GET', {}) + resolve({}) + } else if (step.type === 'link') { + resolve({ redirect: step.value }) } }) } - resolve({}) }) } else if (method === 'PUT') { return PresetRepository.setAllFromApp(payload as Array) diff --git a/src/app/Components/Admin/Controls/Presets/EditModal/Macro.tsx b/src/app/Components/Admin/Controls/Presets/EditModal/Macro.tsx index ccf73ea1..d1dc3164 100644 --- a/src/app/Components/Admin/Controls/Presets/EditModal/Macro.tsx +++ b/src/app/Components/Admin/Controls/Presets/EditModal/Macro.tsx @@ -52,7 +52,10 @@ export const MacroPresetEditModal = (props: GetInputProps<'input'>) => { ) => { data={presetsForSelect} /> ) : null} + {form.values.steps[index].type === 'link' ? ( +