diff --git a/src/lib/components/admin/Users/UserList.svelte b/src/lib/components/admin/Users/UserList.svelte index 1a18bf8f85..f9b0b7937b 100644 --- a/src/lib/components/admin/Users/UserList.svelte +++ b/src/lib/components/admin/Users/UserList.svelte @@ -32,13 +32,14 @@ import About from '$lib/components/chat/Settings/About.svelte'; import Banner from '$lib/components/common/Banner.svelte'; import Markdown from '$lib/components/chat/Messages/Markdown.svelte'; + import Spinner from '$lib/components/common/Spinner.svelte'; const i18n = getContext('i18n'); let page = 1; - let users = []; - let total = 0; + let users = null; + let total = null; let query = ''; let orderBy = 'created_at'; // default sort key @@ -181,314 +182,293 @@ {/if} -
-
-
- {$i18n.t('Users')} -
-
+{#if users === null || total === null} +
+ +
+{:else} +
+
+
+ {$i18n.t('Users')} +
+
- {#if ($config?.license_metadata?.seats ?? null) !== null} - {#if total > $config?.license_metadata?.seats} - {total} of {$config?.license_metadata?.seats} - available users + {#if ($config?.license_metadata?.seats ?? null) !== null} + {#if total > $config?.license_metadata?.seats} + {total} of {$config?.license_metadata?.seats} + available users + {:else} + {total} of {$config?.license_metadata?.seats} + available users + {/if} {:else} - {total} of {$config?.license_metadata?.seats} - available users + {total} {/if} - {:else} - {total} - {/if} -
- -
-
-
-
- - - -
- -
- -
- - - -
-
-
-
- - - - - - - - - - - - - - - - {#each users as user, userIdx} - - - - +
+
setSortKey('role')} - > -
- {$i18n.t('Role')} - - {#if orderBy === 'role'} - {#if direction === 'asc'} - - {:else} - - {/if} - - {:else} - - {/if} +
+
+
+
+ + +
-
setSortKey('name')} - > -
- {$i18n.t('Name')} + +
- {#if orderBy === 'name'} - {#if direction === 'asc'} - - {:else} - - {/if} - - {:else} - - {/if} - -
setSortKey('email')} - > -
- {$i18n.t('Email')} - - {#if orderBy === 'email'} - {#if direction === 'asc'} - - {:else} - - {/if} - - {:else} - - {/if} -
-
setSortKey('last_active_at')} - > -
- {$i18n.t('Last Active')} - - {#if orderBy === 'last_active_at'} - {#if direction === 'asc'} - - {:else} - - {/if} - - {:else} - - {/if} -
-
setSortKey('created_at')} - > -
- {$i18n.t('Created at')} - {#if orderBy === 'created_at'} - {#if direction === 'asc'} - - {:else} - - {/if} - - {:else} - - {/if} -
-
setSortKey('oauth_sub')} - > -
- {$i18n.t('OAuth ID')} - - {#if orderBy === 'oauth_sub'} - {#if direction === 'asc'} - - {:else} - - {/if} - - {:else} - - {/if} -
-
-
+
+ -
-
- user + +
+ + + -
{user.name}
- -
{user.email}
+ + + - - - - - - + + + + + + + + + + + {#each users as user, userIdx} + + + + + + + + + + + + - - {/each} - -
setSortKey('role')} + > +
+ {$i18n.t('Role')} -
- {dayjs(user.last_active_at * 1000).fromNow()} - - {dayjs(user.created_at * 1000).format('LL')} - {user.oauth_sub ?? ''} -
- {#if $config.features.enable_admin_chat_access && user.role !== 'admin'} - - - + {#if orderBy === 'role'} + {#if direction === 'asc'} + + {:else} + + {/if} + + {:else} + {/if} +
+ +
setSortKey('name')} + > +
+ {$i18n.t('Name')} - - - + {#if orderBy === 'name'} + {#if direction === 'asc'} + + {:else} + + {/if} + + {:else} + + {/if} +
+
setSortKey('email')} + > +
+ {$i18n.t('Email')} - {#if user.role !== 'admin'} - + {#if orderBy === 'email'} + {#if direction === 'asc'} + + {:else} + + {/if} + + {:else} + + {/if} +
+
setSortKey('last_active_at')} + > +
+ {$i18n.t('Last Active')} + + {#if orderBy === 'last_active_at'} + {#if direction === 'asc'} + + {:else} + + {/if} + + {:else} + + {/if} +
+
setSortKey('created_at')} + > +
+ {$i18n.t('Created at')} + {#if orderBy === 'created_at'} + {#if direction === 'asc'} + + {:else} + + {/if} + + {:else} + + {/if} +
+
setSortKey('oauth_sub')} + > +
+ {$i18n.t('OAuth ID')} + + {#if orderBy === 'oauth_sub'} + {#if direction === 'asc'} + + {:else} + + {/if} + + {:else} + + {/if} +
+
+
+ + +
+ user + +
{user.name}
+
+
{user.email} + {dayjs(user.last_active_at * 1000).fromNow()} + + {dayjs(user.created_at * 1000).format('LL')} + {user.oauth_sub ?? ''} +
+ {#if $config.features.enable_admin_chat_access && user.role !== 'admin'} + + + + {/if} + + - {/if} -
-
-
-
- ⓘ {$i18n.t("Click on the user role button to change a user's role.")} -
+ {#if user.role !== 'admin'} + + + + {/if} +
+ + + {/each} + + +
- +
+ ⓘ {$i18n.t("Click on the user role button to change a user's role.")} +
+ + +{/if} {#if !$config?.license_metadata} {#if total > 50}