Add instance selection to modlog

This commit is contained in:
CmdrKeen committed 2023-11-27 15:39:22 -08:00
1 parent e5d7e7824e
commit 189a4e1e32
2 files changed
+19 -1

No files matched your search

+17
View File
@@ -74,6 +74,22 @@
</Select> </Select>
</div> </div>
<div class="flex flex-col md:flex-row md:items-center gap-2 w-full"> <div class="flex flex-col md:flex-row md:items-center gap-2 w-full">
<ObjectAutocomplete
type="instance"
placeholder="Filter by instance"
jwt={$profile?.jwt}
showWhenEmpty={true}
label="Instance"
class="flex-1"
q={$page.url.searchParams.get('instance') || ''}
on:select={(e) =>
searchParam(
$page.url,
'instance',
e.detail?.domain.toString() ?? '',
'page', 'community', 'user', 'mod_id'
)}
/>
<ObjectAutocomplete <ObjectAutocomplete
placeholder="Filter by community" placeholder="Filter by community"
jwt={$profile?.jwt} jwt={$profile?.jwt}
@@ -91,6 +107,7 @@
)} )}
/> />
<UserAutocomplete <UserAutocomplete
instance={$page.url.searchParams.get('instance') || undefined}
placeholder="Filter by user" placeholder="Filter by user"
jwt={$profile?.jwt} jwt={$profile?.jwt}
listing_type="All" listing_type="All"
+2 -1
View File
@@ -203,6 +203,7 @@ export const _toModLog = (item: ModAction): ModLog => {
} }
export async function load({ url }) { export async function load({ url }) {
let instance = url.searchParams.get('instance') || undefined
let community = Number(url.searchParams.get('community')) || undefined let community = Number(url.searchParams.get('community')) || undefined
let user = Number(url.searchParams.get('user')) || undefined let user = Number(url.searchParams.get('user')) || undefined
let modId = Number(url.searchParams.get('mod_id')) || undefined let modId = Number(url.searchParams.get('mod_id')) || undefined
@@ -210,7 +211,7 @@ export async function load({ url }) {
let type: ModlogActionType = let type: ModlogActionType =
(url.searchParams.get('type') as ModlogActionType) || 'All' (url.searchParams.get('type') as ModlogActionType) || 'All'
const results = await getClient().getModlog({ const results = await getClient(instance).getModlog({
community_id: community, community_id: community,
limit: 40, limit: 40,
type_: type, type_: type,