From 99f2b5b4b1d520434fe4a0591af32b7ae6b162aa Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Thu, 26 Jun 2025 13:42:56 -0500 Subject: [PATCH] Add no change options to bulk edit. --- .../src/components/forms/ChannelBatch.jsx | 29 ++++++++++--------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/frontend/src/components/forms/ChannelBatch.jsx b/frontend/src/components/forms/ChannelBatch.jsx index e5b4504e..ca88d8ab 100644 --- a/frontend/src/components/forms/ChannelBatch.jsx +++ b/frontend/src/components/forms/ChannelBatch.jsx @@ -46,7 +46,7 @@ const ChannelBatchForm = ({ channelIds, isOpen, onClose }) => { mode: 'uncontrolled', initialValues: { channel_group: '', - stream_profile_id: '0', + stream_profile_id: '-1', user_level: '-1', }, }); @@ -56,17 +56,13 @@ const ChannelBatchForm = ({ channelIds, isOpen, onClose }) => { const values = { ...form.getValues(), - }; - - // Handle channel group ID - convert to integer if it exists - if (selectedChannelGroup) { + }; // Handle channel group ID - convert to integer if it exists + if (selectedChannelGroup && selectedChannelGroup !== '-1') { values.channel_group_id = parseInt(selectedChannelGroup); } else { delete values.channel_group_id; - } - - if (!values.stream_profile_id || values.stream_profile_id === '0') { - values.stream_profile_id = null; + } if (!values.stream_profile_id || values.stream_profile_id === '-1') { + delete values.stream_profile_id; } if (values.user_level == '-1') { @@ -124,10 +120,12 @@ const ChannelBatchForm = ({ channelIds, isOpen, onClose }) => { }); } }; - - const filteredGroups = groupOptions.filter((group) => - group.name.toLowerCase().includes(groupFilter.toLowerCase()) - ); + const filteredGroups = [ + { id: '-1', name: '(no change)' }, + ...groupOptions.filter((group) => + group.name.toLowerCase().includes(groupFilter.toLowerCase()) + ) + ]; if (!isOpen) { return <>; @@ -276,7 +274,10 @@ const ChannelBatchForm = ({ channelIds, isOpen, onClose }) => { name="stream_profile_id" {...form.getInputProps('stream_profile_id')} key={form.key('stream_profile_id')} - data={[{ value: '0', label: '(use default)' }].concat( + data={[ + { value: '-1', label: '(no change)' }, + { value: '0', label: '(use default)' } + ].concat( streamProfiles.map((option) => ({ value: `${option.id}`, label: option.name,