From bcd302ea3fbd3618fecd727123f7cf9412c63efc Mon Sep 17 00:00:00 2001 From: dekzter Date: Thu, 24 Apr 2025 17:54:24 -0400 Subject: [PATCH 1/6] fixed reference to channel streams --- .../src/components/tables/StreamsTable.jsx | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/tables/StreamsTable.jsx b/frontend/src/components/tables/StreamsTable.jsx index b7645e1a..c899fda9 100644 --- a/frontend/src/components/tables/StreamsTable.jsx +++ b/frontend/src/components/tables/StreamsTable.jsx @@ -52,7 +52,7 @@ const StreamRowActions = ({ handleWatchStream, selectedChannelIds, }) => { - const channelSelectionStreamIds = useChannelsTableStore( + const channelSelectionStreams = useChannelsTableStore( (state) => state.channels.find((chan) => chan.id === selectedChannelIds[0])?.streams ); @@ -72,7 +72,9 @@ const StreamRowActions = ({ await API.updateChannel({ id: selectedChannelIds[0], streams: [ - ...new Set(channelSelectionStreamIds.concat([row.original.id])), + ...new Set( + channelSelectionStreams.map((s) => s.id).concat([row.original.id]) + ), ], }); await API.requeryChannels(); @@ -101,8 +103,10 @@ const StreamRowActions = ({ style={{ background: 'none' }} disabled={ selectedChannelIds.length !== 1 || - (channelSelectionStreamIds && - channelSelectionStreamIds.includes(row.original.id)) + (channelSelectionStreams && + channelSelectionStreams + .map((s) => s.id) + .includes(row.original.id)) } > @@ -192,7 +196,7 @@ const StreamsTable = ({}) => { const channelGroups = useChannelsStore((s) => s.channelGroups); const selectedChannelIds = useChannelsTableStore((s) => s.selectedChannelIds); const fetchLogos = useChannelsStore((s) => s.fetchLogos); - const channelSelectionStreamIds = useChannelsTableStore( + const channelSelectionStreams = useChannelsTableStore( (state) => state.channels.find((chan) => chan.id === selectedChannelIds[0])?.streams ); @@ -385,7 +389,9 @@ const StreamsTable = ({}) => { await API.updateChannel({ id: selectedChannelIds[0], streams: [ - ...new Set(channelSelectionStreamIds.concat(selectedStreamIds)), + ...new Set( + channelSelectionStreams.map((s) => s.id).concat(selectedStreamIds) + ), ], }); await API.requeryChannels(); @@ -536,7 +542,7 @@ const StreamsTable = ({}) => { ); } }, - [selectedChannelIds, channelSelectionStreamIds] + [selectedChannelIds, channelSelectionStreams] ); const table = useTable({ From cb18c4266c0bcb0c90de9937bbd4dcc4a9653451 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 24 Apr 2025 21:54:47 +0000 Subject: [PATCH 2/6] Increment build number to 12 [skip ci] --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 3a79f5a2..8880ca5b 100644 --- a/version.py +++ b/version.py @@ -2,4 +2,4 @@ Dispatcharr version information. """ __version__ = '0.3.3' # Follow semantic versioning (MAJOR.MINOR.PATCH) -__build__ = '11' # Auto-incremented on builds +__build__ = '12' # Auto-incremented on builds From 8e6f8d59e0862b383b6811a46dc8ea0f0e85904e Mon Sep 17 00:00:00 2001 From: dekzter Date: Thu, 24 Apr 2025 17:58:06 -0400 Subject: [PATCH 3/6] fixed channel creation from stream --- apps/channels/serializers.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/channels/serializers.py b/apps/channels/serializers.py index b1e2af46..69f25286 100644 --- a/apps/channels/serializers.py +++ b/apps/channels/serializers.py @@ -174,14 +174,14 @@ class ChannelSerializer(serializers.ModelSerializer): return StreamSerializer(obj.streams.all().order_by('channelstream__order'), many=True).data def create(self, validated_data): - stream_ids = validated_data.pop('streams', []) + streams = validated_data.pop('streams', []) channel_number = validated_data.pop('channel_number', Channel.get_next_available_channel_number()) validated_data["channel_number"] = channel_number channel = Channel.objects.create(**validated_data) # Add streams in the specified order - for index, stream_id in enumerate(stream_ids): - ChannelStream.objects.create(channel=channel, stream_id=stream_id, order=index) + for index, stream in enumerate(streams): + ChannelStream.objects.create(channel=channel, stream_id=stream.id, order=index) return channel From 8625f2e524f30f88d112e773981ea1b92cb94530 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 24 Apr 2025 21:58:29 +0000 Subject: [PATCH 4/6] Increment build number to 13 [skip ci] --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index 8880ca5b..b0ae1d60 100644 --- a/version.py +++ b/version.py @@ -2,4 +2,4 @@ Dispatcharr version information. """ __version__ = '0.3.3' # Follow semantic versioning (MAJOR.MINOR.PATCH) -__build__ = '12' # Auto-incremented on builds +__build__ = '13' # Auto-incremented on builds From c5f7b183f153abd8344d65eb38917b918ea274a2 Mon Sep 17 00:00:00 2001 From: dekzter Date: Thu, 24 Apr 2025 18:06:32 -0400 Subject: [PATCH 5/6] update all row IDs in the store so stream table changes reflect in channel table --- frontend/src/api.js | 10 +++++++--- frontend/src/components/tables/ChannelsTable.jsx | 3 ++- frontend/src/store/channelsTable.jsx | 7 +++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/frontend/src/api.js b/frontend/src/api.js index b2619427..5c9e415d 100644 --- a/frontend/src/api.js +++ b/frontend/src/api.js @@ -192,13 +192,17 @@ export default class API { static async requeryChannels() { try { - const response = await request( - `${host}/api/channels/channels/?${API.lastQueryParams.toString()}` - ); + const [response, ids] = await Promise.all([ + request( + `${host}/api/channels/channels/?${API.lastQueryParams.toString()}` + ), + API.getAllChannelIds(API.lastQueryParams), + ]); useChannelsTableStore .getState() .queryChannels(response, API.lastQueryParams); + useChannelsTableStore.getState().setAllQueryIds(ids); return response; } catch (e) { diff --git a/frontend/src/components/tables/ChannelsTable.jsx b/frontend/src/components/tables/ChannelsTable.jsx index dfdfbebd..c3ab40cc 100644 --- a/frontend/src/components/tables/ChannelsTable.jsx +++ b/frontend/src/components/tables/ChannelsTable.jsx @@ -199,6 +199,8 @@ const ChannelsTable = ({}) => { const setSorting = useChannelsTableStore((s) => s.setSorting); const totalCount = useChannelsTableStore((s) => s.totalCount); const setChannelStreams = useChannelsTableStore((s) => s.setChannelStreams); + const allRowIds = useChannelsTableStore((s) => s.allQueryIds); + const setAllRowIds = useChannelsTableStore((s) => s.setAllQueryIds); // store/channels const channels = useChannelsStore((s) => s.channels); @@ -228,7 +230,6 @@ const ChannelsTable = ({}) => { /** * useState */ - const [allRowIds, setAllRowIds] = useState([]); const [channel, setChannel] = useState(null); const [channelModalOpen, setChannelModalOpen] = useState(false); const [recordingModalOpen, setRecordingModalOpen] = useState(false); diff --git a/frontend/src/store/channelsTable.jsx b/frontend/src/store/channelsTable.jsx index 23cba8e4..592e5c86 100644 --- a/frontend/src/store/channelsTable.jsx +++ b/frontend/src/store/channelsTable.jsx @@ -13,6 +13,7 @@ const useChannelsTableStore = create((set, get) => ({ pageSize: 50, }, selectedChannelIds: [], + allQueryIds: [], queryChannels: ({ results, count }, params) => { set((state) => { @@ -24,6 +25,12 @@ const useChannelsTableStore = create((set, get) => ({ }); }, + setAllQueryIds: (allQueryIds) => { + set((state) => ({ + allQueryIds, + })); + }, + setSelectedChannelIds: (selectedChannelIds) => { set({ selectedChannelIds, From 4340f82d38f7a7d6391958a09de9f86cf042c1a4 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 24 Apr 2025 22:06:58 +0000 Subject: [PATCH 6/6] Increment build number to 14 [skip ci] --- version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.py b/version.py index b0ae1d60..d60feb3e 100644 --- a/version.py +++ b/version.py @@ -2,4 +2,4 @@ Dispatcharr version information. """ __version__ = '0.3.3' # Follow semantic versioning (MAJOR.MINOR.PATCH) -__build__ = '13' # Auto-incremented on builds +__build__ = '14' # Auto-incremented on builds