feat: display source in user and group table (#225)

Co-authored-by: Elias Schneider <login@eliasschneider.com>
This commit is contained in:
Kyle Mendell
2025-02-11 10:24:10 -06:00
committed by GitHub
parent 43790dc1be
commit 9ed2adb0f8
3 changed files with 4765 additions and 4768 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,7 @@
<script lang="ts">
import AdvancedTable from '$lib/components/advanced-table.svelte';
import { openConfirmDialog } from '$lib/components/confirm-dialog/';
import { Badge } from '$lib/components/ui/badge/index';
import { Button } from '$lib/components/ui/button';
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
import * as Table from '$lib/components/ui/table';
@@ -35,7 +36,7 @@
toast.success('User group deleted successfully');
} catch (e) {
axiosErrorToast(e);
}
}
}
}
});
@@ -50,6 +51,7 @@
{ label: 'Friendly Name', sortColumn: 'friendlyName' },
{ label: 'Name', sortColumn: 'name' },
{ label: 'User Count', sortColumn: 'userCount' },
...($appConfigStore.ldapEnabled ? [{ label: 'Source' }] : []),
{ label: 'Actions', hidden: true }
]}
>
@@ -57,6 +59,12 @@
<Table.Cell>{item.friendlyName}</Table.Cell>
<Table.Cell>{item.name}</Table.Cell>
<Table.Cell>{item.userCount}</Table.Cell>
{#if $appConfigStore.ldapEnabled}
<Table.Cell>
<Badge variant={item.ldapId ? 'default' : 'outline'}>{item.ldapId ? 'LDAP' : 'Local'}</Badge
>
</Table.Cell>
{/if}
<Table.Cell class="flex justify-end">
<DropdownMenu.Root>
<DropdownMenu.Trigger asChild let:builder>

View File

@@ -7,6 +7,7 @@
import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
import * as Table from '$lib/components/ui/table';
import UserService from '$lib/services/user-service';
import appConfigStore from '$lib/stores/application-configuration-store';
import type { Paginated, SearchPaginationSortRequest } from '$lib/types/pagination.type';
import type { User } from '$lib/types/user.type';
import { axiosErrorToast } from '$lib/utils/error-util';
@@ -14,7 +15,6 @@
import Ellipsis from 'lucide-svelte/icons/ellipsis';
import { toast } from 'svelte-sonner';
import OneTimeLinkModal from './one-time-link-modal.svelte';
import appConfigStore from '$lib/stores/application-configuration-store';
let { users = $bindable() }: { users: Paginated<User> } = $props();
let requestOptions: SearchPaginationSortRequest | undefined = $state();
@@ -49,30 +49,13 @@
{requestOptions}
onRefresh={async (options) => (users = await userService.list(options))}
columns={[
{
label: 'First name',
sortColumn: 'firstName'
},
{
label: 'Last name',
sortColumn: 'lastName'
},
{
label: 'Email',
sortColumn: 'email'
},
{
label: 'Username',
sortColumn: 'username'
},
{
label: 'Role',
sortColumn: 'isAdmin'
},
{
label: 'Actions',
hidden: true
}
{ label: 'First name', sortColumn: 'firstName' },
{ label: 'Last name', sortColumn: 'lastName' },
{ label: 'Email', sortColumn: 'email' },
{ label: 'Username', sortColumn: 'username' },
{ label: 'Role', sortColumn: 'isAdmin' },
...($appConfigStore.ldapEnabled ? [{ label: 'Source' }] : []),
{ label: 'Actions', hidden: true }
]}
>
{#snippet rows({ item })}
@@ -80,9 +63,15 @@
<Table.Cell>{item.lastName}</Table.Cell>
<Table.Cell>{item.email}</Table.Cell>
<Table.Cell>{item.username}</Table.Cell>
<Table.Cell class="hidden lg:table-cell">
<Table.Cell>
<Badge variant="outline">{item.isAdmin ? 'Admin' : 'User'}</Badge>
</Table.Cell>
{#if $appConfigStore.ldapEnabled}
<Table.Cell>
<Badge variant={item.ldapId ? 'default' : 'outline'}>{item.ldapId ? 'LDAP' : 'Local'}</Badge
>
</Table.Cell>
{/if}
<Table.Cell>
<DropdownMenu.Root>
<DropdownMenu.Trigger class={buttonVariants({ variant: 'ghost', size: 'icon' })}>