From 154a4fc9046c67116c728b00fb24241a25350892 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Fri, 21 Feb 2025 07:37:18 -0800 Subject: [PATCH] List sources not in a channel on channel edit page --- core/channel.go | 5 +++++ web/html/editChannels.html | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/core/channel.go b/core/channel.go index 73d5a0a..5633430 100644 --- a/core/channel.go +++ b/core/channel.go @@ -22,6 +22,11 @@ func GetSourcesInChannel(db DB) (map[string][]string, error) { rows, err := db.Query(` select name, source from channels + union + select '' as name, sources.name as source + from sources + left outer join channels on channels.source = sources.name + where channels.name is null order by name, source `) if err != nil { diff --git a/web/html/editChannels.html b/web/html/editChannels.html index ea61926..6e219a9 100644 --- a/web/html/editChannels.html +++ b/web/html/editChannels.html @@ -29,6 +29,7 @@ {{ range $channel, $sources := .ChannelSources }} +{{ if $channel }}

{{ $channel }}

{{- range $sources }} @@ -42,8 +43,17 @@ {{ end }} -
{{ . }}
{{ end }} +{{ end }} + +{{ if index .ChannelSources "" }} +

not in a channel

+ +{{ end }} {{- end }}