mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-03-31 19:56:35 +00:00
fix: make sorting consistent around tables
This commit is contained in:
@@ -6,19 +6,14 @@ import type { PageServerLoad } from './$types';
|
||||
export const load: PageServerLoad = async ({ cookies }) => {
|
||||
const oidcService = new OIDCService(cookies.get(ACCESS_TOKEN_COOKIE_NAME));
|
||||
|
||||
// Create request options with default sorting
|
||||
const requestOptions: SearchPaginationSortRequest = {
|
||||
const clientsRequestOptions: SearchPaginationSortRequest = {
|
||||
sort: {
|
||||
column: 'name',
|
||||
direction: 'asc'
|
||||
},
|
||||
pagination: {
|
||||
page: 1,
|
||||
limit: 10
|
||||
}
|
||||
};
|
||||
|
||||
const clients = await oidcService.listClients(requestOptions);
|
||||
const clients = await oidcService.listClients(clientsRequestOptions);
|
||||
|
||||
return clients;
|
||||
return { clients, clientsRequestOptions };
|
||||
};
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
import OIDCClientList from './oidc-client-list.svelte';
|
||||
|
||||
let { data } = $props();
|
||||
let clients = $state(data);
|
||||
let clients = $state(data.clients);
|
||||
let clientsRequestOptions = $state(data.clientsRequestOptions);
|
||||
let expandAddClient = $state(false);
|
||||
|
||||
const oidcService = new OIDCService();
|
||||
@@ -71,6 +72,6 @@
|
||||
<Card.Title>Manage OIDC Clients</Card.Title>
|
||||
</Card.Header>
|
||||
<Card.Content>
|
||||
<OIDCClientList {clients} />
|
||||
<OIDCClientList {clients} requestOptions={clientsRequestOptions} />
|
||||
</Card.Content>
|
||||
</Card.Root>
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
import Label from '$lib/components/ui/label/label.svelte';
|
||||
import UserGroupSelection from '$lib/components/user-group-selection.svelte';
|
||||
import OidcService from '$lib/services/oidc-service';
|
||||
import UserGroupService from '$lib/services/user-group-service';
|
||||
import clientSecretStore from '$lib/stores/client-secret-store';
|
||||
import type { OidcClientCreateWithLogo } from '$lib/types/oidc.type';
|
||||
import { axiosErrorToast } from '$lib/utils/error-util';
|
||||
@@ -26,7 +25,6 @@
|
||||
let showAllDetails = $state(false);
|
||||
|
||||
const oidcService = new OidcService();
|
||||
const userGroupService = new UserGroupService();
|
||||
|
||||
const setupDetails = $state({
|
||||
'Authorization URL': `https://${$page.url.hostname}/authorize`,
|
||||
@@ -177,9 +175,7 @@
|
||||
title="Allowed User Groups"
|
||||
description="Add user groups to this client to restrict access to users in these groups. If no user groups are selected, all users will have access to this client."
|
||||
>
|
||||
{#await userGroupService.list() then groups}
|
||||
<UserGroupSelection {groups} bind:selectedGroupIds={client.allowedUserGroupIds} />
|
||||
{/await}
|
||||
<UserGroupSelection bind:selectedGroupIds={client.allowedUserGroupIds} />
|
||||
<div class="mt-5 flex justify-end">
|
||||
<Button on:click={() => updateUserGroupClients(client.allowedUserGroupIds)}>Save</Button>
|
||||
</div>
|
||||
|
||||
@@ -12,23 +12,14 @@
|
||||
import OneTimeLinkModal from './client-secret.svelte';
|
||||
|
||||
let {
|
||||
clients: initialClients
|
||||
clients = $bindable(),
|
||||
requestOptions
|
||||
}: {
|
||||
clients: Paginated<OidcClient>;
|
||||
requestOptions: SearchPaginationSortRequest;
|
||||
} = $props();
|
||||
let clients = $state<Paginated<OidcClient>>(initialClients);
|
||||
let oneTimeLink = $state<string | null>(null);
|
||||
let requestOptions: SearchPaginationSortRequest | undefined = $state({
|
||||
sort: { column: 'name', direction: 'asc' },
|
||||
pagination: {
|
||||
page: initialClients.pagination.currentPage,
|
||||
limit: initialClients.pagination.itemsPerPage
|
||||
}
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
clients = initialClients;
|
||||
});
|
||||
let oneTimeLink = $state<string | null>(null);
|
||||
|
||||
const oidcService = new OIDCService();
|
||||
|
||||
@@ -56,7 +47,6 @@
|
||||
<AdvancedTable
|
||||
items={clients}
|
||||
{requestOptions}
|
||||
defaultSort={{ column: 'name', direction: 'asc' }}
|
||||
onRefresh={async (o) => (clients = await oidcService.listClients(o))}
|
||||
columns={[
|
||||
{ label: 'Logo' },
|
||||
|
||||
Reference in New Issue
Block a user