feat(web): add an 'all' option to notification filter

allows users to "reset" after selecting a filter. ideally, we'd be able to
clear the filter if it was clicked again, but I couldn't find a way to listen
to a second/repeat click on a SelectItem, so I added a new filter item instead.
This commit is contained in:
Pujit Mehrotra
2024-11-19 13:51:01 -05:00
parent acccb3694c
commit 939d7a304d

View File

@@ -11,9 +11,7 @@ const { teleportTarget, determineTeleportTarget } = useTeleport();
const importance = ref<Importance | undefined>(undefined); const importance = ref<Importance | undefined>(undefined);
const confirmAndArchiveAll = async () => { const confirmAndArchiveAll = async () => {
if ( if (confirm('This will archive all notifications on your Unraid server. Continue?')) {
confirm('This will archive all notifications on your Unraid server. Continue?')
) {
await archiveAll(); await archiveAll();
} }
}; };
@@ -81,7 +79,7 @@ const confirmAndDeleteAll = async () => {
<Select <Select
@update:model-value=" @update:model-value="
(val) => { (val) => {
importance = val as Importance; importance = val === 'all' ? undefined : (val as Importance);
} }
" "
> >
@@ -91,7 +89,8 @@ const confirmAndDeleteAll = async () => {
<SelectContent :to="teleportTarget"> <SelectContent :to="teleportTarget">
<SelectGroup> <SelectGroup>
<SelectLabel>Notification Types</SelectLabel> <SelectLabel>Notification Types</SelectLabel>
<SelectItem :value="Importance.Alert">Alert</SelectItem> <SelectItem value="all">All Types</SelectItem>
<SelectItem :value="Importance.Alert"> Alert </SelectItem>
<SelectItem :value="Importance.Info">Info</SelectItem> <SelectItem :value="Importance.Info">Info</SelectItem>
<SelectItem :value="Importance.Warning">Warning</SelectItem> <SelectItem :value="Importance.Warning">Warning</SelectItem>
</SelectGroup> </SelectGroup>