mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-05 11:07:55 -05:00
refac
This commit is contained in:
1 parent
b6317157f3
commit
ca16f2c576
97 files changed
+441
-518
No files matched your search
@@ -6,7 +6,7 @@ from typing import Optional
|
||||
from open_webui.internal.db import Base, JSONField, get_async_db_context
|
||||
from open_webui.models.users import User, UserModel
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
from sqlalchemy import JSON, BigInteger, Boolean, Column, Text, delete, func, select
|
||||
from sqlalchemy import JSON, BigInteger, Boolean, Column, Text, delete, func, or_, select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -220,6 +220,18 @@ class FeedbackTable:
|
||||
count_stmt = select(func.count(Feedback.id)).select_from(Feedback).join(User, Feedback.user_id == User.id)
|
||||
|
||||
if filter:
|
||||
query_key = filter.get('query')
|
||||
if query_key:
|
||||
query_filter = or_(
|
||||
User.name.ilike(f'%{query_key}%'),
|
||||
User.email.ilike(f'%{query_key}%'),
|
||||
Feedback.data['model_id'].as_string().ilike(f'%{query_key}%'),
|
||||
Feedback.data['reason'].as_string().ilike(f'%{query_key}%'),
|
||||
Feedback.data['comment'].as_string().ilike(f'%{query_key}%'),
|
||||
)
|
||||
stmt = stmt.filter(query_filter)
|
||||
count_stmt = count_stmt.filter(query_filter)
|
||||
|
||||
# Apply model_id filter (exact match)
|
||||
model_id = filter.get('model_id')
|
||||
if model_id:
|
||||
|
||||
@@ -326,6 +326,7 @@ async def get_feedbacks(
|
||||
direction: Optional[str] = None,
|
||||
page: Optional[int] = 1,
|
||||
model_id: Optional[str] = None,
|
||||
query: Optional[str] = None,
|
||||
user=Depends(get_admin_user),
|
||||
db: AsyncSession = Depends(get_async_session),
|
||||
):
|
||||
@@ -341,6 +342,8 @@ async def get_feedbacks(
|
||||
filter['direction'] = direction
|
||||
if model_id:
|
||||
filter['model_id'] = model_id
|
||||
if query:
|
||||
filter['query'] = query
|
||||
|
||||
result = await Feedbacks.get_feedback_items(filter=filter, skip=skip, limit=limit, db=db)
|
||||
return result
|
||||
|
||||
@@ -101,7 +101,8 @@ export const getFeedbackItems = async (
|
||||
orderBy,
|
||||
direction,
|
||||
page,
|
||||
modelId: string = ''
|
||||
modelId: string = '',
|
||||
query: string = ''
|
||||
) => {
|
||||
let error = null;
|
||||
|
||||
@@ -110,6 +111,7 @@ export const getFeedbackItems = async (
|
||||
if (direction) searchParams.append('direction', direction);
|
||||
if (page) searchParams.append('page', page.toString());
|
||||
if (modelId) searchParams.append('model_id', modelId);
|
||||
if (query) searchParams.append('query', query);
|
||||
|
||||
const res = await fetch(
|
||||
`${WEBUI_API_BASE_URL}/evaluations/feedbacks/list?${searchParams.toString()}`,
|
||||
|
||||
@@ -1,14 +1,36 @@
|
||||
<script>
|
||||
import { onMount, getContext } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import { user } from '$lib/stores';
|
||||
import { config, user } from '$lib/stores';
|
||||
|
||||
import Dashboard from './Analytics/Dashboard.svelte';
|
||||
import Leaderboard from './Evaluations/Leaderboard.svelte';
|
||||
import Feedbacks from './Evaluations/Feedbacks.svelte';
|
||||
import Select from '$lib/components/common/Select.svelte';
|
||||
import ChevronDown from '$lib/components/icons/ChevronDown.svelte';
|
||||
import Check from '$lib/components/icons/Check.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
let loaded = false;
|
||||
|
||||
// The view an address asks for, such as the leaderboard from the old Evaluations address.
|
||||
export let openView = '';
|
||||
|
||||
// Usage analytics can be turned off; the arena leaderboard and feedback are always here.
|
||||
const usageEnabled = $config?.features?.enable_admin_analytics ?? true;
|
||||
let view = ['leaderboard', 'feedback'].includes(openView)
|
||||
? openView
|
||||
: usageEnabled
|
||||
? 'usage'
|
||||
: 'leaderboard';
|
||||
|
||||
$: views = [
|
||||
...(usageEnabled ? [{ value: 'usage', label: $i18n.t('Analytics') }] : []),
|
||||
{ value: 'leaderboard', label: $i18n.t('Leaderboard') },
|
||||
{ value: 'feedback', label: $i18n.t('Feedback') }
|
||||
];
|
||||
|
||||
onMount(async () => {
|
||||
if ($user?.role !== 'admin') {
|
||||
await goto('/');
|
||||
@@ -19,6 +41,30 @@
|
||||
|
||||
{#if loaded}
|
||||
<div class="w-full h-full overflow-y-auto scrollbar-hover pr-1.5 pb-2">
|
||||
<Dashboard />
|
||||
<!-- The page title picks the view. -->
|
||||
<svelte:component
|
||||
this={view === 'usage' ? Dashboard : view === 'leaderboard' ? Leaderboard : Feedbacks}
|
||||
>
|
||||
<svelte:fragment slot="title">
|
||||
<Select
|
||||
bind:value={view}
|
||||
items={views}
|
||||
triggerClass="flex items-center gap-1 bg-transparent text-sm font-normal text-base-900 dark:text-base-0"
|
||||
itemClass="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-lg bg-transparent px-2 text-xs hover:text-base-900 dark:hover:text-base-100"
|
||||
>
|
||||
<svelte:fragment slot="trigger" let:selectedLabel>
|
||||
{selectedLabel}
|
||||
<ChevronDown className="size-3 text-base-400 dark:text-base-600" strokeWidth="2" />
|
||||
</svelte:fragment>
|
||||
|
||||
<svelte:fragment slot="item" let:item let:selected>
|
||||
{item.label}
|
||||
<div class="ml-auto {selected ? '' : 'invisible'}">
|
||||
<Check className="size-3" />
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Select>
|
||||
</svelte:fragment>
|
||||
</svelte:component>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -349,7 +349,7 @@
|
||||
|
||||
<div class="flex flex-wrap items-center justify-between mb-1 gap-x-4 gap-y-2">
|
||||
<h2 class="text-sm font-normal text-base-900 dark:text-base-0 shrink-0">
|
||||
{$i18n.t('Analytics')}
|
||||
<slot name="title">{$i18n.t('Analytics')}</slot>
|
||||
</h2>
|
||||
<div class="flex items-center gap-2 flex-wrap justify-end min-w-0">
|
||||
{#if groups.length > 0}
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
<script>
|
||||
import { getContext, onMount } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import { adminFeedbackCount, adminLeaderboardCount, models as _models } from '$lib/stores';
|
||||
import { getFeedbackItems, getLeaderboard } from '$lib/apis/evaluations';
|
||||
import { formatNumber } from '$lib/utils';
|
||||
|
||||
import Leaderboard from './Evaluations/Leaderboard.svelte';
|
||||
import Feedbacks from './Evaluations/Feedbacks.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
let selectedTab;
|
||||
$: {
|
||||
const pathParts = $page.url.pathname.split('/');
|
||||
const tabFromPath = pathParts[pathParts.length - 1];
|
||||
selectedTab = ['leaderboard', 'feedback'].includes(tabFromPath) ? tabFromPath : 'leaderboard';
|
||||
}
|
||||
|
||||
$: if (selectedTab) {
|
||||
// scroll to selectedTab
|
||||
scrollToTab(selectedTab);
|
||||
}
|
||||
|
||||
const scrollToTab = (tabId) => {
|
||||
const tabElement = document.getElementById(tabId);
|
||||
if (tabElement) {
|
||||
tabElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
|
||||
}
|
||||
};
|
||||
|
||||
let loaded = false;
|
||||
$: formattedLeaderboardCount =
|
||||
$adminLeaderboardCount === null ? null : formatNumber($adminLeaderboardCount);
|
||||
$: formattedFeedbackCount =
|
||||
$adminFeedbackCount === null ? null : formatNumber($adminFeedbackCount);
|
||||
|
||||
const getLeaderboardCount = (res) => {
|
||||
const entries = res?.entries ?? [];
|
||||
const modelMap = new Map(($_models ?? []).map((model) => [model.id, model]));
|
||||
const activeModelCount = ($_models ?? []).filter(
|
||||
(model) => model?.owned_by !== 'router' && !model?.info?.meta?.hidden
|
||||
).length;
|
||||
const evaluatedModelCount = entries.filter((entry) => !modelMap.has(entry.model_id)).length;
|
||||
|
||||
return activeModelCount + evaluatedModelCount;
|
||||
};
|
||||
|
||||
const loadCounts = async () => {
|
||||
const [leaderboardRes, feedbackRes] = await Promise.all([
|
||||
getLeaderboard(localStorage.token).catch(() => null),
|
||||
getFeedbackItems(localStorage.token, 'updated_at', 'desc', 1).catch(() => null)
|
||||
]);
|
||||
|
||||
adminLeaderboardCount.set(getLeaderboardCount(leaderboardRes));
|
||||
adminFeedbackCount.set(feedbackRes?.total ?? null);
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
await loadCounts();
|
||||
loaded = true;
|
||||
|
||||
const containerElement = document.getElementById('users-tabs-container');
|
||||
|
||||
if (containerElement) {
|
||||
containerElement.addEventListener('wheel', function (event) {
|
||||
if (event.deltaY !== 0) {
|
||||
// Adjust horizontal scroll position based on vertical scroll
|
||||
containerElement.scrollLeft += event.deltaY;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Scroll to the selected tab on mount
|
||||
scrollToTab(selectedTab);
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if loaded}
|
||||
<div class="flex flex-col lg:flex-row w-full h-full pb-2 lg:space-x-4">
|
||||
<div
|
||||
id="users-tabs-container"
|
||||
class="tabs mx-2 px-2 sm:mx-2.5 lg:mx-0 lg:px-2.5 flex flex-row overflow-x-auto gap-2.5 max-w-full lg:gap-0 lg:flex-col lg:flex-none lg:w-50 dark:text-base-200 text-sm font-normal text-left scrollbar-none"
|
||||
>
|
||||
<a
|
||||
id="leaderboard"
|
||||
href="/admin/evaluations/leaderboard"
|
||||
draggable="false"
|
||||
aria-current={selectedTab === 'leaderboard' ? 'page' : null}
|
||||
class="px-0.5 py-1 min-w-fit rounded-lg lg:flex-none flex items-center gap-1.5 text-right transition select-none {selectedTab ===
|
||||
'leaderboard'
|
||||
? ''
|
||||
: ' text-base-300 dark:text-base-600 hover:text-base-700 dark:hover:text-base-0'}"
|
||||
>
|
||||
<div class="self-center">{$i18n.t('Leaderboard')}</div>
|
||||
{#if formattedLeaderboardCount !== null}
|
||||
<div class="self-center text-sm opacity-60">
|
||||
{formattedLeaderboardCount}
|
||||
</div>
|
||||
{/if}
|
||||
</a>
|
||||
|
||||
<a
|
||||
id="feedback"
|
||||
href="/admin/evaluations/feedback"
|
||||
draggable="false"
|
||||
aria-current={selectedTab === 'feedback' ? 'page' : null}
|
||||
class="px-0.5 py-1 min-w-fit rounded-lg lg:flex-none flex items-center gap-1.5 text-right transition select-none {selectedTab ===
|
||||
'feedback'
|
||||
? ''
|
||||
: ' text-base-300 dark:text-base-600 hover:text-base-700 dark:hover:text-base-0'}"
|
||||
>
|
||||
<div class="self-center">{$i18n.t('Feedback')}</div>
|
||||
{#if formattedFeedbackCount !== null}
|
||||
<div class="self-center text-sm opacity-60">
|
||||
{formattedFeedbackCount}
|
||||
</div>
|
||||
{/if}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 mt-1 lg:mt-0 px-[1rem] lg:pr-[1rem] lg:pl-0 overflow-y-scroll">
|
||||
{#if selectedTab === 'leaderboard'}
|
||||
<Leaderboard />
|
||||
{:else if selectedTab === 'feedback'}
|
||||
<Feedbacks />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -35,8 +35,9 @@
|
||||
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
|
||||
import { adminFeedbackCount, config } from '$lib/stores';
|
||||
import Spinner from '$lib/components/common/Spinner.svelte';
|
||||
import Select from '$lib/components/common/Select.svelte';
|
||||
import Check from '$lib/components/icons/Check.svelte';
|
||||
import FilterMenu from '$lib/components/workspace/common/FilterMenu.svelte';
|
||||
import FileNavIcon from '$lib/components/chat/FileNav/Icon.svelte';
|
||||
import XMark from '$lib/components/icons/XMark.svelte';
|
||||
|
||||
let page = 1;
|
||||
let items = null;
|
||||
@@ -46,6 +47,8 @@
|
||||
let direction: 'asc' | 'desc' = 'desc';
|
||||
|
||||
let selectedModelId: string = '';
|
||||
let query = '';
|
||||
let debounceTimer: ReturnType<typeof setTimeout>;
|
||||
let modelIds: string[] = [];
|
||||
|
||||
const setSortKey = (key) => {
|
||||
@@ -80,7 +83,8 @@
|
||||
orderBy,
|
||||
direction,
|
||||
page,
|
||||
selectedModelId
|
||||
selectedModelId,
|
||||
query
|
||||
).catch((error) => {
|
||||
toast.error(`${error}`);
|
||||
return null;
|
||||
@@ -100,6 +104,18 @@
|
||||
getFeedbacks();
|
||||
}
|
||||
|
||||
// Searches the server once typing pauses, from the first page.
|
||||
const searchHandler = () => {
|
||||
clearTimeout(debounceTimer);
|
||||
debounceTimer = setTimeout(() => {
|
||||
if (page === 1) {
|
||||
getFeedbacks();
|
||||
} else {
|
||||
page = 1;
|
||||
}
|
||||
}, 500);
|
||||
};
|
||||
|
||||
const loadModelIds = async () => {
|
||||
try {
|
||||
const res = await getFeedbackModelIds(localStorage.token);
|
||||
@@ -218,84 +234,100 @@
|
||||
|
||||
<FeedbackModal bind:show={showFeedbackModal} {selectedFeedback} onClose={closeFeedbackModal} />
|
||||
|
||||
{#if items === null || total === null}
|
||||
<div class="my-10">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{:else}
|
||||
<div bind:this={listElement}>
|
||||
{#if modelIds.length > 0 || total > 0}
|
||||
<div class="flex h-8 flex-1 items-center w-full gap-2">
|
||||
<div
|
||||
class="flex min-w-0 flex-1 bg-transparent overflow-x-auto scrollbar-none"
|
||||
on:wheel={(e) => {
|
||||
if (e.deltaY !== 0) {
|
||||
e.preventDefault();
|
||||
e.currentTarget.scrollLeft += e.deltaY;
|
||||
}
|
||||
}}
|
||||
>
|
||||
{#if modelIds.length > 0}
|
||||
<div
|
||||
class="flex gap-0.5 w-fit text-center text-sm rounded-full bg-transparent whitespace-nowrap"
|
||||
>
|
||||
<Select
|
||||
bind:value={selectedModelId}
|
||||
items={[
|
||||
{ value: '', label: $i18n.t('All') },
|
||||
...modelIds.map((mid) => ({ value: mid, label: mid }))
|
||||
]}
|
||||
placeholder={$i18n.t('All')}
|
||||
triggerClass="relative w-full flex items-center gap-0.5 px-2.5 py-1.5 bg-transparent rounded-xl text-[0.8125rem] font-normal text-base-700 transition hover:text-base-900 dark:text-base-200 dark:hover:text-base-100"
|
||||
onChange={() => {
|
||||
page = 1;
|
||||
getFeedbacks();
|
||||
}}
|
||||
>
|
||||
<svelte:fragment slot="trigger" let:selectedLabel>
|
||||
<span
|
||||
class="inline-flex h-input px-0.5 w-full outline-hidden bg-transparent truncate placeholder-base-400 focus:outline-hidden"
|
||||
>
|
||||
{selectedLabel}
|
||||
</span>
|
||||
<ChevronDown className="size-3.5" strokeWidth="2.5" />
|
||||
</svelte:fragment>
|
||||
<h2 class="mb-1 text-sm font-normal text-base-900 dark:text-base-0">
|
||||
<slot name="title" />
|
||||
</h2>
|
||||
|
||||
<svelte:fragment slot="item" let:item let:selected>
|
||||
{item.label}
|
||||
<div class="ml-auto {selected ? '' : 'invisible'}">
|
||||
<Check />
|
||||
</div>
|
||||
</svelte:fragment>
|
||||
</Select>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div bind:this={listElement}>
|
||||
<div class="sticky top-0 z-10 pb-1 bg-base-0 dark:bg-base-900">
|
||||
<div class="flex h-8 items-center gap-1">
|
||||
<label
|
||||
class="flex h-full min-w-0 flex-1 items-center gap-2 px-1 text-base-400 dark:text-base-500"
|
||||
>
|
||||
<FileNavIcon name="search" size={14} class="shrink-0" />
|
||||
<input
|
||||
class="min-w-0 flex-1 bg-transparent text-[0.8125rem] text-base-800 outline-hidden placeholder:text-base-400 dark:text-base-100 dark:placeholder:text-base-500"
|
||||
bind:value={query}
|
||||
on:input={searchHandler}
|
||||
aria-label={$i18n.t('Search')}
|
||||
placeholder={$i18n.t('Search')}
|
||||
/>
|
||||
{#if query}
|
||||
<button
|
||||
type="button"
|
||||
class="flex size-4 shrink-0 items-center justify-center rounded-full hover:text-base-700 dark:hover:text-base-200"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
searchHandler();
|
||||
}}
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
{/if}
|
||||
</label>
|
||||
<div class="flex shrink-0 items-center gap-1">
|
||||
<FilterMenu
|
||||
sections={[
|
||||
...(modelIds.length > 0
|
||||
? [
|
||||
{
|
||||
label: $i18n.t('Model'),
|
||||
value: selectedModelId,
|
||||
items: modelIds.map((mid) => ({ value: mid, label: mid })),
|
||||
onChange: (value: string) => {
|
||||
selectedModelId = value;
|
||||
page = 1;
|
||||
getFeedbacks();
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
{
|
||||
label: $i18n.t('Sort'),
|
||||
value: orderBy === 'updated_at' ? '' : orderBy,
|
||||
items: [
|
||||
{ value: 'rating', label: $i18n.t('Result') },
|
||||
{ value: 'model_id', label: $i18n.t('Model') },
|
||||
{ value: 'username', label: $i18n.t('User') }
|
||||
],
|
||||
onChange: (value: string) => {
|
||||
orderBy = value || 'updated_at';
|
||||
direction = orderBy === 'updated_at' ? 'desc' : 'asc';
|
||||
page = 1;
|
||||
}
|
||||
}
|
||||
]}
|
||||
/>
|
||||
|
||||
{#if total > 0}
|
||||
<Dropdown align="end">
|
||||
<Dropdown closeOnSelect align="end">
|
||||
<button
|
||||
class="flex h-7 shrink-0 items-center justify-center gap-1.5 rounded-lg bg-base-100 px-2.5 text-xs font-normal text-base-800 transition hover:bg-base-100/70 disabled:opacity-60 dark:bg-base-850 dark:text-base-0 dark:hover:bg-base-850/60"
|
||||
class="relative flex size-6.5 shrink-0 items-center justify-center rounded-full border border-base-100 bg-base-50/60 text-base-500 transition-colors hover:bg-base-100 hover:text-base-900 aria-expanded:bg-base-100 aria-expanded:text-base-900 dark:border-base-850 dark:bg-base-850/50 dark:text-base-400 dark:hover:bg-base-850 dark:hover:text-base-0 dark:aria-expanded:bg-base-850 dark:aria-expanded:text-base-0"
|
||||
type="button"
|
||||
aria-label={$i18n.t('Actions')}
|
||||
title={$i18n.t('Actions')}
|
||||
>
|
||||
{$i18n.t('Export')}
|
||||
<ChevronDown className="size-3" strokeWidth="2.5" />
|
||||
<EllipsisHorizontal className="size-3.5" />
|
||||
</button>
|
||||
|
||||
<div slot="content">
|
||||
<DropdownMenu className="min-w-[10.625rem]">
|
||||
<DropdownMenu className="min-w-[10.625rem] shadow-sm">
|
||||
<button
|
||||
class="select-none flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-base-50/40 dark:hover:bg-base-800/40 rounded-xl"
|
||||
class="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-base-900 dark:hover:text-base-100"
|
||||
type="button"
|
||||
on:click={() => exportHandler('json')}
|
||||
>
|
||||
<Download className="size-3.5" />
|
||||
{$i18n.t('Export as JSON')}
|
||||
</button>
|
||||
|
||||
<button
|
||||
class="select-none flex w-full gap-2 items-center h-[1.6875rem] px-2 text-[0.8125rem] font-normal cursor-pointer hover:bg-base-50/40 dark:hover:bg-base-800/40 rounded-xl"
|
||||
class="flex h-[1.6875rem] w-full cursor-pointer select-none items-center gap-2 rounded-xl bg-transparent px-2 text-[0.8125rem] hover:text-base-900 dark:hover:text-base-100"
|
||||
type="button"
|
||||
on:click={() => exportHandler('csv')}
|
||||
>
|
||||
<Download className="size-3.5" />
|
||||
{$i18n.t('Export as CSV')}
|
||||
</button>
|
||||
</DropdownMenu>
|
||||
@@ -303,26 +335,29 @@
|
||||
</Dropdown>
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{#if items === null || total === null}
|
||||
<div class="flex min-h-20 items-center justify-center">
|
||||
<Spinner className="size-5" />
|
||||
</div>
|
||||
{:else}
|
||||
<div class="scrollbar-hidden relative whitespace-nowrap overflow-x-auto max-w-full">
|
||||
{#if (items ?? []).length === 0}
|
||||
<div class="flex w-full flex-col items-center justify-center py-16 pb-24">
|
||||
<div class="max-w-sm text-center text-base-900 dark:text-base-100">
|
||||
<div tabindex="-1" data-focus-fallback class="mb-1.5 text-sm">
|
||||
{$i18n.t('No feedback found')}
|
||||
</div>
|
||||
<div class="text-center text-xs leading-5 text-base-500">
|
||||
{$i18n.t('Try adjusting your search or filter to find what you are looking for.')}
|
||||
</div>
|
||||
<div
|
||||
class="flex min-h-20 items-center justify-center px-4 text-center text-xs text-base-500 dark:text-base-400"
|
||||
>
|
||||
<div tabindex="-1" data-focus-fallback>
|
||||
{$i18n.t('No feedback found')}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
<table
|
||||
class="w-full text-sm text-left text-base-500 dark:text-base-400 table-auto max-w-full px-2"
|
||||
class="w-full text-xs text-left text-base-500 dark:text-base-400 table-auto max-w-full"
|
||||
>
|
||||
<thead class="text-xs text-base-800 uppercase bg-transparent dark:text-base-200">
|
||||
<tr class=" border-b-[1.5px] border-base-50 dark:border-base-850/30">
|
||||
<thead class="text-xs text-base-500 dark:text-base-400">
|
||||
<tr>
|
||||
<th
|
||||
scope="col"
|
||||
class="font-normal select-none w-3"
|
||||
@@ -334,7 +369,7 @@
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full cursor-pointer gap-1.5 items-center justify-end px-2.5 py-2 uppercase"
|
||||
class="flex w-full cursor-pointer gap-1 items-center justify-end px-1.5 py-0.5"
|
||||
on:click={() => setSortKey('username')}
|
||||
>
|
||||
{$i18n.t('User')}
|
||||
@@ -365,7 +400,7 @@
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full cursor-pointer gap-1.5 items-center px-2.5 py-2 uppercase"
|
||||
class="flex w-full cursor-pointer gap-1 items-center px-1.5 py-0.5"
|
||||
on:click={() => setSortKey('model_id')}
|
||||
>
|
||||
{$i18n.t('Models')}
|
||||
@@ -396,7 +431,7 @@
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full cursor-pointer gap-1.5 items-center justify-end px-2.5 py-2 uppercase"
|
||||
class="flex w-full cursor-pointer gap-1 items-center justify-end px-1.5 py-0.5"
|
||||
on:click={() => setSortKey('rating')}
|
||||
>
|
||||
{$i18n.t('Result')}
|
||||
@@ -427,7 +462,7 @@
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full cursor-pointer gap-1.5 items-center justify-end px-2.5 py-2 uppercase"
|
||||
class="flex w-full cursor-pointer gap-1 items-center justify-end px-1.5 py-0.5"
|
||||
on:click={() => setSortKey('updated_at')}
|
||||
>
|
||||
{$i18n.t('Updated At')}
|
||||
@@ -447,10 +482,7 @@
|
||||
</button>
|
||||
</th>
|
||||
|
||||
<th
|
||||
scope="col"
|
||||
class="px-2.5 py-2 font-normal text-right cursor-pointer select-none w-0"
|
||||
>
|
||||
<th scope="col" class="font-normal select-none w-0">
|
||||
<span class="sr-only">{$i18n.t('Actions')}</span>
|
||||
</th>
|
||||
</tr>
|
||||
@@ -458,10 +490,10 @@
|
||||
<tbody class="">
|
||||
{#each items as feedback (feedback.id)}
|
||||
<tr
|
||||
class="dark:border-base-850 text-xs cursor-pointer hover:bg-base-50 dark:hover:bg-base-850/50 transition rounded-xl"
|
||||
class="cursor-pointer [&>td]:transition-colors hover:[&>td]:bg-base-1000/[0.035] dark:hover:[&>td]:bg-base-0/[0.045] [&>td:first-child]:rounded-l-lg [&>td:last-child]:rounded-r-lg"
|
||||
on:click={() => openFeedbackModal(feedback)}
|
||||
>
|
||||
<td class=" py-0.5 text-right font-normal">
|
||||
<td class="px-1.5 py-1">
|
||||
<div class="flex justify-center">
|
||||
<Tooltip content={feedback?.user?.name}>
|
||||
<div class="shrink-0">
|
||||
@@ -475,7 +507,7 @@
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class=" py-1 pl-3 w-full max-w-0">
|
||||
<td class="px-1.5 py-1 w-full max-w-0">
|
||||
<div class="flex flex-col items-start gap-0.5 h-full">
|
||||
<div class="flex flex-col h-full max-w-full">
|
||||
{#if feedback.data?.sibling_model_ids}
|
||||
@@ -486,7 +518,7 @@
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="cursor-pointer text-left font-normal text-base-600 dark:text-base-400 flex-1 truncate"
|
||||
class="cursor-pointer text-left text-base-800 dark:text-base-200 flex-1 truncate"
|
||||
on:click={() => openFeedbackModal(feedback)}
|
||||
>
|
||||
{feedback.data?.model_id}
|
||||
@@ -497,7 +529,7 @@
|
||||
content={feedback.data.sibling_model_ids.join(', ')}
|
||||
className="flex min-w-0"
|
||||
>
|
||||
<div class=" text-[0.65rem] text-base-600 dark:text-base-400 truncate">
|
||||
<div class="text-[0.6875rem] text-base-500 dark:text-base-400 truncate">
|
||||
{#if feedback.data.sibling_model_ids.length > 2}
|
||||
<!-- {$i18n.t('and {{COUNT}} more')} -->
|
||||
{feedback.data.sibling_model_ids.slice(0, 2).join(', ')}, {$i18n.t(
|
||||
@@ -517,7 +549,7 @@
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="cursor-pointer text-left text-sm font-normal text-base-600 dark:text-base-400 flex-1 py-1.5 truncate"
|
||||
class="cursor-pointer text-left text-base-800 dark:text-base-200 flex-1 truncate"
|
||||
on:click={() => openFeedbackModal(feedback)}
|
||||
>
|
||||
{feedback.data?.model_id}
|
||||
@@ -529,7 +561,7 @@
|
||||
</td>
|
||||
|
||||
{#if feedback?.data?.rating}
|
||||
<td class="px-3 py-1 text-right font-normal text-base-900 dark:text-base-0 w-max">
|
||||
<td class="px-1.5 py-1 text-right w-max">
|
||||
<div class=" flex justify-end">
|
||||
{#if feedback?.data?.rating.toString() === '1'}
|
||||
<Badge type="info" content={$i18n.t('Won')} />
|
||||
@@ -542,24 +574,24 @@
|
||||
</td>
|
||||
{/if}
|
||||
|
||||
<td class=" px-3 py-1 text-right font-normal">
|
||||
<td class="px-1.5 py-1 text-right">
|
||||
{dayjs(feedback.updated_at * 1000)
|
||||
.locale($i18n.language)
|
||||
.fromNow()}
|
||||
</td>
|
||||
|
||||
<td class=" px-3 py-1 text-right font-normal" on:click={(e) => e.stopPropagation()}>
|
||||
<td class="px-1.5 py-1 text-right" on:click={(e) => e.stopPropagation()}>
|
||||
<FeedbackMenu
|
||||
on:delete={(e) => {
|
||||
withListFocus(listElement, feedback.id, deleteFeedbackHandler);
|
||||
}}
|
||||
>
|
||||
<button
|
||||
class="self-center w-fit text-sm p-1.5 dark:text-base-300 dark:hover:text-base-0 hover:bg-base-1000/5 dark:hover:bg-base-0/5 rounded-xl"
|
||||
class="flex rounded-lg p-1 text-base-400 transition-colors hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
||||
data-focus-row={feedback.id}
|
||||
aria-label={$i18n.t('More')}
|
||||
>
|
||||
<EllipsisHorizontal />
|
||||
<EllipsisHorizontal className="size-3.5" />
|
||||
</button>
|
||||
</FeedbackMenu>
|
||||
</td>
|
||||
@@ -573,5 +605,5 @@
|
||||
{#if total > 30}
|
||||
<Pagination bind:page count={total} perPage={30} />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</div>
|
||||
@@ -5,7 +5,7 @@
|
||||
import ModelModal from './LeaderboardModal.svelte';
|
||||
import Spinner from '$lib/components/common/Spinner.svelte';
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
import Search from '$lib/components/icons/Search.svelte';
|
||||
import FileNavIcon from '$lib/components/chat/FileNav/Icon.svelte';
|
||||
import XMark from '$lib/components/icons/XMark.svelte';
|
||||
import ChevronUp from '$lib/components/icons/ChevronUp.svelte';
|
||||
import ChevronDown from '$lib/components/icons/ChevronDown.svelte';
|
||||
@@ -122,40 +122,40 @@
|
||||
|
||||
<ModelModal bind:show={showModal} model={selectedModel} onClose={closeModal} />
|
||||
|
||||
<h2 class="mb-1 text-sm font-normal text-base-900 dark:text-base-0">
|
||||
<slot name="title" />
|
||||
</h2>
|
||||
|
||||
<div>
|
||||
<div class="sticky top-0 z-10 bg-base-0 dark:bg-base-900">
|
||||
<div class="flex h-8 flex-1 items-center w-full gap-2">
|
||||
<div class="flex min-w-0 flex-1 items-center">
|
||||
<div class="self-center ml-1 mr-3">
|
||||
<Search className="size-3.5" />
|
||||
</div>
|
||||
<div class="sticky top-0 z-10 pb-1 bg-base-0 dark:bg-base-900">
|
||||
<div class="flex h-8 items-center gap-1">
|
||||
<label
|
||||
class="flex h-full min-w-0 flex-1 items-center gap-2 px-1 text-base-400 dark:text-base-500"
|
||||
>
|
||||
<FileNavIcon name="search" size={14} class="shrink-0" />
|
||||
<input
|
||||
class="w-full text-sm pr-4 py-1 rounded-r-xl outline-hidden bg-transparent"
|
||||
class="min-w-0 flex-1 bg-transparent text-[0.8125rem] text-base-800 outline-hidden placeholder:text-base-400 dark:text-base-100 dark:placeholder:text-base-500"
|
||||
bind:value={query}
|
||||
aria-label={$i18n.t('Search')}
|
||||
placeholder={$i18n.t('Search')}
|
||||
/>
|
||||
|
||||
{#if query}
|
||||
<div class="self-center pl-1.5 translate-y-[0.5px] rounded-l-xl bg-transparent">
|
||||
<button
|
||||
class="py-0.5 rounded-full transition hover:text-base-900 dark:hover:text-base-100 text-base-500 dark:text-base-400 px-0"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
}}
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="flex size-4 shrink-0 items-center justify-center rounded-full hover:text-base-700 dark:hover:text-base-200"
|
||||
aria-label={$i18n.t('Clear search')}
|
||||
on:click={() => {
|
||||
query = '';
|
||||
}}
|
||||
>
|
||||
<XMark className="size-3" strokeWidth="2" />
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="scrollbar-hidden relative whitespace-nowrap overflow-x-auto max-w-full rounded-sm min-h-[6.25rem]"
|
||||
>
|
||||
<div class="scrollbar-hidden relative whitespace-nowrap overflow-x-auto max-w-full min-h-24">
|
||||
{#if loading}
|
||||
<div
|
||||
class="absolute inset-0 flex items-center justify-center z-10 bg-base-0/50 dark:bg-base-900/50"
|
||||
@@ -165,16 +165,20 @@
|
||||
{/if}
|
||||
|
||||
{#if !rankedModels.length && !loading}
|
||||
<div class="text-center text-xs text-base-500 py-1">{$i18n.t('No models found')}</div>
|
||||
<div
|
||||
class="flex min-h-20 items-center justify-center px-4 text-center text-xs text-base-500 dark:text-base-400"
|
||||
>
|
||||
{$i18n.t('No models found')}
|
||||
</div>
|
||||
{:else if rankedModels.length}
|
||||
<table
|
||||
class="w-full text-sm text-left text-base-500 dark:text-base-400 {loading
|
||||
class="w-full text-xs text-left text-base-500 dark:text-base-400 {loading
|
||||
? 'opacity-20'
|
||||
: ''}"
|
||||
>
|
||||
<thead class="text-xs text-base-800 uppercase bg-transparent dark:text-base-200">
|
||||
<tr class="border-b-[1.5px] border-base-50 dark:border-base-850/30">
|
||||
{#each [{ key: 'rating', label: 'RK', class: 'w-3' }, { key: 'name', label: $i18n.t('Model'), class: '' }, { key: 'rating', label: $i18n.t('Rating'), class: 'text-right w-fit' }, { key: 'won', label: $i18n.t('Won'), class: 'text-right w-5' }, { key: 'lost', label: $i18n.t('Lost'), class: 'text-right w-5' }] as col}
|
||||
<thead class="text-xs text-base-500 dark:text-base-400">
|
||||
<tr>
|
||||
{#each [{ key: 'rating', label: '#', class: 'w-3' }, { key: 'name', label: $i18n.t('Model'), class: '' }, { key: 'rating', label: $i18n.t('Rating'), class: 'text-right w-fit' }, { key: 'won', label: $i18n.t('Won'), class: 'text-right w-5' }, { key: 'lost', label: $i18n.t('Lost'), class: 'text-right w-5' }] as col}
|
||||
<th
|
||||
scope="col"
|
||||
class="font-normal select-none {col.class}"
|
||||
@@ -186,7 +190,7 @@
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full cursor-pointer gap-1.5 items-center px-2.5 py-2 uppercase {col.class.includes(
|
||||
class="flex w-full cursor-pointer gap-1 items-center px-1.5 py-0.5 {col.class.includes(
|
||||
'right'
|
||||
)
|
||||
? 'justify-end'
|
||||
@@ -209,13 +213,13 @@
|
||||
<tbody>
|
||||
{#each sortedModels as model, idx (model.id)}
|
||||
<tr
|
||||
class="text-xs group cursor-pointer hover:bg-base-50 dark:hover:bg-base-850/50 transition"
|
||||
class="group cursor-pointer [&>td]:transition-colors hover:[&>td]:bg-base-1000/[0.035] dark:hover:[&>td]:bg-base-0/[0.045] [&>td:first-child]:rounded-l-lg [&>td:last-child]:rounded-r-lg"
|
||||
on:click={() => openModal(model)}
|
||||
>
|
||||
<td class="px-3 py-1.5 font-normal text-base-900 dark:text-base-0">
|
||||
<td class="px-1.5 py-1 text-base-500 dark:text-base-400 tabular-nums">
|
||||
{model.rating !== '-' ? idx + 1 : '-'}
|
||||
</td>
|
||||
<td class="px-3 py-1.5 w-full max-w-0">
|
||||
<td class="px-1.5 py-1 w-full max-w-0">
|
||||
<div class="flex items-center gap-2">
|
||||
<img
|
||||
src="{WEBUI_API_BASE_URL}/models/model/profile/image?id={model.id}&v={model.info
|
||||
@@ -237,16 +241,18 @@
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
class="cursor-pointer font-normal text-left text-base-800 dark:text-base-200 truncate"
|
||||
class="cursor-pointer text-left text-base-800 dark:text-base-200 truncate"
|
||||
on:click={() => openModal(model)}>{model.name}</button
|
||||
>
|
||||
</Tooltip>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-3 py-1.5 text-right font-normal text-base-900 dark:text-base-0">
|
||||
<td class="px-1.5 py-1 text-right text-base-800 dark:text-base-200 tabular-nums">
|
||||
{model.rating}
|
||||
</td>
|
||||
<td class="px-3 py-1.5 text-right font-normal text-green-500 w-10">
|
||||
<td
|
||||
class="px-1.5 py-1 text-right text-green-600 dark:text-green-500 w-10 tabular-nums"
|
||||
>
|
||||
{#if model.stats.won === '-'}-{:else}
|
||||
<span class="hidden group-hover:inline"
|
||||
>{((Number(model.stats.won) / model.stats.count) * 100).toFixed(1)}%</span
|
||||
@@ -254,7 +260,7 @@
|
||||
<span class="group-hover:hidden">{model.stats.won}</span>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="px-3 py-1.5 text-right font-normal text-red-500 w-10">
|
||||
<td class="px-1.5 py-1 text-right text-red-600 dark:text-red-500 w-10 tabular-nums">
|
||||
{#if model.stats.lost === '-'}-{:else}
|
||||
<span class="hidden group-hover:inline"
|
||||
>{((Number(model.stats.lost) / model.stats.count) * 100).toFixed(1)}%</span
|
||||
|
||||
@@ -345,7 +345,7 @@
|
||||
/>
|
||||
|
||||
{#if loaded}
|
||||
<div class="px-2.5 w-full">
|
||||
<div class="w-full">
|
||||
<div class="flex flex-col gap-1 px-1 mt-0.5">
|
||||
<div class="flex justify-between items-center mb-1 w-full">
|
||||
<input
|
||||
|
||||
@@ -472,7 +472,7 @@ class Pipe:
|
||||
class="flex h-6 w-fit shrink-0 items-center gap-1 whitespace-nowrap rounded-md text-xs text-base-400 transition-colors duration-75 hover:text-base-700 dark:text-base-600 dark:hover:text-base-300"
|
||||
type="button"
|
||||
on:click={() => {
|
||||
goto('/admin/functions');
|
||||
goto('/settings/admin/functions');
|
||||
}}
|
||||
>
|
||||
<ChevronLeft className="size-3" strokeWidth="2" />
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
import StatsUpSquare from '$lib/components/icons/StatsUpSquare.svelte';
|
||||
import Terminal from '$lib/components/icons/Terminal.svelte';
|
||||
|
||||
import Users from '$lib/components/icons/Users.svelte';
|
||||
import UserGroup from '$lib/components/icons/UserGroup.svelte';
|
||||
import CodeBracket from '$lib/components/icons/CodeBracket.svelte';
|
||||
|
||||
export let id: string;
|
||||
export let className = 'size-3.5';
|
||||
export let strokeWidth = '2';
|
||||
@@ -28,6 +32,12 @@
|
||||
<Grid {className} {strokeWidth} />
|
||||
{:else if id === 'tasks'}
|
||||
<Sparkles {className} {strokeWidth} />
|
||||
{:else if id === 'users'}
|
||||
<Users {className} {strokeWidth} />
|
||||
{:else if id === 'groups'}
|
||||
<UserGroup {className} {strokeWidth} />
|
||||
{:else if id === 'functions'}
|
||||
<CodeBracket {className} {strokeWidth} />
|
||||
{:else if id === 'authentication'}
|
||||
<Lock {className} {strokeWidth} />
|
||||
{:else if id === 'connections'}
|
||||
|
||||
@@ -792,7 +792,7 @@
|
||||
{$i18n.t('settings.admin.interface.toolSearchEmbeddings.description', {
|
||||
model: toolSearchEmbeddingModel || $i18n.t('Not configured')
|
||||
})}
|
||||
<a class="underline" href="/admin/settings/documents">
|
||||
<a class="underline" href="/settings/admin/documents">
|
||||
{$i18n.t('settings.admin.interface.toolSearchEmbeddings.settings')}
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
<script>
|
||||
import { getContext, onMount } from 'svelte';
|
||||
|
||||
import { goto } from '$app/navigation';
|
||||
import { adminGroupCount, adminUserCount, config, user } from '$lib/stores';
|
||||
import { page } from '$app/stores';
|
||||
import { getGroups } from '$lib/apis/groups';
|
||||
import { getUsers } from '$lib/apis/users';
|
||||
import { formatNumber } from '$lib/utils';
|
||||
|
||||
import UserList from './Users/UserList.svelte';
|
||||
import Groups from './Users/Groups.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
let selectedTab;
|
||||
$: {
|
||||
const pathParts = $page.url.pathname.split('/');
|
||||
const tabFromPath = pathParts[pathParts.length - 1];
|
||||
selectedTab = ['overview', 'groups'].includes(tabFromPath) ? tabFromPath : 'overview';
|
||||
}
|
||||
|
||||
$: if (selectedTab) {
|
||||
// scroll to selectedTab
|
||||
scrollToTab(selectedTab);
|
||||
}
|
||||
|
||||
$: if (loaded && selectedTab) {
|
||||
loadCounts();
|
||||
}
|
||||
|
||||
const scrollToTab = (tabId) => {
|
||||
const tabElement = document.getElementById(tabId);
|
||||
if (tabElement) {
|
||||
tabElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'start' });
|
||||
}
|
||||
};
|
||||
|
||||
let loaded = false;
|
||||
$: usersSeatLimit = $config?.license_metadata?.seats ?? null;
|
||||
$: usersCountExceeded = usersSeatLimit !== null && ($adminUserCount ?? 0) > usersSeatLimit;
|
||||
$: formattedUserCount =
|
||||
$adminUserCount === null
|
||||
? null
|
||||
: usersSeatLimit !== null
|
||||
? `${formatNumber($adminUserCount)} of ${formatNumber(usersSeatLimit)}`
|
||||
: formatNumber($adminUserCount);
|
||||
$: formattedGroupCount = $adminGroupCount === null ? null : formatNumber($adminGroupCount);
|
||||
|
||||
const loadCounts = async () => {
|
||||
const [usersRes, groupsRes] = await Promise.all([
|
||||
getUsers(localStorage.token, undefined, 'created_at', 'asc', 1).catch(() => null),
|
||||
getGroups(localStorage.token).catch(() => null)
|
||||
]);
|
||||
|
||||
adminUserCount.set(usersRes?.total ?? null);
|
||||
adminGroupCount.set(Array.isArray(groupsRes) ? groupsRes.length : null);
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
if ($user?.role !== 'admin') {
|
||||
await goto('/');
|
||||
}
|
||||
|
||||
loaded = true;
|
||||
|
||||
const containerElement = document.getElementById('users-tabs-container');
|
||||
|
||||
if (containerElement) {
|
||||
containerElement.addEventListener('wheel', function (event) {
|
||||
if (event.deltaY !== 0) {
|
||||
// Adjust horizontal scroll position based on vertical scroll
|
||||
containerElement.scrollLeft += event.deltaY;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Scroll to the selected tab on mount
|
||||
scrollToTab(selectedTab);
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if loaded}
|
||||
<div class="flex flex-col lg:flex-row w-full h-full pb-2">
|
||||
<div
|
||||
id="users-tabs-container"
|
||||
class="tabs mx-2 px-2 sm:mx-2.5 lg:mx-0 lg:px-2.5 flex flex-row overflow-x-auto gap-2.5 max-w-full lg:gap-0 lg:flex-col lg:flex-none lg:w-50 dark:text-base-200 text-sm font-normal text-left scrollbar-none"
|
||||
>
|
||||
<a
|
||||
id="overview"
|
||||
href="/admin/users/overview"
|
||||
draggable="false"
|
||||
aria-current={selectedTab === 'overview' ? 'page' : null}
|
||||
class="px-0.5 py-1 min-w-fit rounded-lg lg:flex-none flex items-center gap-1.5 text-right transition select-none {selectedTab ===
|
||||
'overview'
|
||||
? ''
|
||||
: ' text-base-300 dark:text-base-600 hover:text-base-700 dark:hover:text-base-0'}"
|
||||
>
|
||||
<div class=" self-center">{$i18n.t('Overview')}</div>
|
||||
{#if formattedUserCount !== null}
|
||||
<div
|
||||
class="self-center text-sm {usersCountExceeded
|
||||
? `text-red-500 ${selectedTab === 'overview' ? '' : 'opacity-50'}`
|
||||
: 'opacity-60'}"
|
||||
>
|
||||
{formattedUserCount}
|
||||
</div>
|
||||
{/if}
|
||||
</a>
|
||||
|
||||
<a
|
||||
id="groups"
|
||||
href="/admin/users/groups"
|
||||
draggable="false"
|
||||
aria-current={selectedTab === 'groups' ? 'page' : null}
|
||||
class="px-0.5 py-1 min-w-fit rounded-lg lg:flex-none flex items-center gap-1.5 text-right transition select-none {selectedTab ===
|
||||
'groups'
|
||||
? ''
|
||||
: ' text-base-300 dark:text-base-600 hover:text-base-700 dark:hover:text-base-0'}"
|
||||
>
|
||||
<div class=" self-center">{$i18n.t('Groups')}</div>
|
||||
{#if formattedGroupCount !== null}
|
||||
<div class="self-center text-sm opacity-60">
|
||||
{formattedGroupCount}
|
||||
</div>
|
||||
{/if}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="flex-1 px-3.5 lg:pr-[1rem] lg:pl-0 overflow-y-scroll">
|
||||
{#if selectedTab === 'overview'}
|
||||
<UserList />
|
||||
{:else if selectedTab === 'groups'}
|
||||
<Groups />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -6,6 +6,9 @@
|
||||
import { withListFocus } from '$lib/utils/listFocus';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { onMount, getContext } from 'svelte';
|
||||
|
||||
// Opens this group's editor on load (settings address /settings/admin/groups/<id>).
|
||||
export let openGroupId = '';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import { adminGroupCount, user } from '$lib/stores';
|
||||
@@ -501,6 +504,7 @@
|
||||
<GroupItem
|
||||
{group}
|
||||
{groups}
|
||||
open={group.id === openGroupId}
|
||||
onDeleted={() => withListFocus(listElement, group.id, setGroups)}
|
||||
{setGroups}
|
||||
{updateGroup}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
export let groups = [];
|
||||
/** @type {() => Promise<void>} */
|
||||
export let onDeleted;
|
||||
export let open = false;
|
||||
export let draggable = false;
|
||||
/** @type {(event: DragEvent) => void} */
|
||||
export let onDragStart = () => {};
|
||||
@@ -64,7 +65,7 @@
|
||||
|
||||
onMount(() => {
|
||||
const groupId = $page.url.searchParams.get('id');
|
||||
if (groupId && groupId === group.id) {
|
||||
if (open || (groupId && groupId === group.id)) {
|
||||
showEdit = true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
{#each member.via_group_ids as id}
|
||||
<a
|
||||
class="block truncate rounded-sm transition hover:text-base-700 hover:underline dark:hover:text-base-200"
|
||||
href={`/admin/users/groups?id=${id}`}
|
||||
href={`/settings/admin/groups/${encodeURIComponent(id)}`}
|
||||
title={groups.find((group) => group.id === id)?.path || id}
|
||||
>
|
||||
{groups.find((group) => group.id === id)?.path || id}
|
||||
|
||||
@@ -188,9 +188,9 @@
|
||||
class="px-1.5 py-0.5 rounded-xl bg-base-100 dark:bg-base-850 text-xs"
|
||||
>
|
||||
<a
|
||||
href={'/admin/users/groups?id=' + userGroup.id}
|
||||
href={`/settings/admin/groups/${encodeURIComponent(userGroup.id)}`}
|
||||
on:click|preventDefault={() =>
|
||||
goto('/admin/users/groups?id=' + userGroup.id)}
|
||||
goto(`/settings/admin/groups/${encodeURIComponent(userGroup.id)}`)}
|
||||
>
|
||||
{userGroup.name}
|
||||
</a>
|
||||
|
||||
@@ -137,6 +137,8 @@
|
||||
'admin:tasks': $i18n.t('System'),
|
||||
'admin:interface': $i18n.t('System'),
|
||||
'admin:authentication': $i18n.t('System'),
|
||||
'admin:users': $i18n.t('System'),
|
||||
'admin:groups': $i18n.t('System'),
|
||||
'admin:analytics': $i18n.t('System'),
|
||||
'admin:db': $i18n.t('System'),
|
||||
'admin:connections': $i18n.t('AI'),
|
||||
@@ -147,6 +149,7 @@
|
||||
'admin:images': $i18n.t('Capabilities'),
|
||||
'admin:audio': $i18n.t('Capabilities'),
|
||||
'admin:integrations': $i18n.t('Capabilities'),
|
||||
'admin:functions': $i18n.t('Capabilities'),
|
||||
'admin:code-execution': $i18n.t('Capabilities'),
|
||||
'admin:pipelines': $i18n.t('Capabilities')
|
||||
};
|
||||
@@ -281,6 +284,18 @@
|
||||
title: $i18n.t('settings.admin.authentication.title'),
|
||||
searchPrefixes: ['settings.admin.authentication.']
|
||||
},
|
||||
{
|
||||
id: 'admin:users',
|
||||
titleKey: 'Users',
|
||||
title: $i18n.t('Users'),
|
||||
searchPrefixes: []
|
||||
},
|
||||
{
|
||||
id: 'admin:groups',
|
||||
titleKey: 'Groups',
|
||||
title: $i18n.t('Groups'),
|
||||
searchPrefixes: []
|
||||
},
|
||||
{
|
||||
id: 'admin:features',
|
||||
titleKey: 'settings.admin.features.title',
|
||||
@@ -433,6 +448,12 @@
|
||||
title: $i18n.t('settings.admin.audio.title'),
|
||||
searchPrefixes: ['settings.admin.audio.']
|
||||
},
|
||||
{
|
||||
id: 'admin:functions',
|
||||
titleKey: 'Functions',
|
||||
title: $i18n.t('Functions'),
|
||||
searchPrefixes: []
|
||||
},
|
||||
{
|
||||
id: 'admin:code-execution',
|
||||
titleKey: 'settings.admin.codeExecution.title',
|
||||
@@ -490,9 +511,7 @@
|
||||
|
||||
return (
|
||||
$user?.role === 'admin' ? [...personalSettings, ...administratorTabs] : personalSettings
|
||||
).filter(
|
||||
(tab) => tab.id !== 'admin:analytics' || ($config?.features?.enable_admin_analytics ?? true)
|
||||
);
|
||||
).filter((tab) => tab.id !== 'admin:functions' || !!$config?.features?.enable_functions);
|
||||
};
|
||||
|
||||
$: searchIndex = buildSettingsSearchIndex(availableSettings, english, $i18n, {
|
||||
@@ -600,7 +619,15 @@
|
||||
// Caps a page's scrolling content at the chat's width (58rem), keeping at least the usual side
|
||||
// padding. The vertical padding also sits inside the scroll area, so it scrolls with the content.
|
||||
// Data-heavy pages use the full width and sit right under the breadcrumb.
|
||||
const fullWidthTabs = ['archived_chats', 'usage', 'admin:analytics', 'admin:models'];
|
||||
const fullWidthTabs = [
|
||||
'archived_chats',
|
||||
'usage',
|
||||
'admin:analytics',
|
||||
'admin:models',
|
||||
'admin:users',
|
||||
'admin:groups',
|
||||
'admin:functions'
|
||||
];
|
||||
const chatWidthClass = [
|
||||
'[&>*>.overflow-y-auto]:pl-[max(1rem,calc((100%_-_58rem)/2))]! [&>*>.overflow-y-auto]:pr-[max(1rem,calc((100%_-_58rem)/2))]!',
|
||||
'md:[&>*>.overflow-y-auto]:pl-[max(1.25rem,calc((100%_-_58rem)/2))]! md:[&>*>.overflow-y-auto]:pr-[max(1.25rem,calc((100%_-_58rem)/2))]!',
|
||||
@@ -1095,9 +1122,33 @@
|
||||
{#await import('$lib/components/admin/Settings/Subagents.svelte') then { default: AdminSubagents }}
|
||||
<AdminSubagents bind:dirty />
|
||||
{/await}
|
||||
{:else if selectedTab === 'admin:users'}
|
||||
{#await import('$lib/components/admin/Users/UserList.svelte') then { default: AdminUsers }}
|
||||
<div class="flex h-full flex-col">
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
|
||||
<AdminUsers />
|
||||
</div>
|
||||
</div>
|
||||
{/await}
|
||||
{:else if selectedTab === 'admin:groups'}
|
||||
{#await import('$lib/components/admin/Users/Groups.svelte') then { default: AdminGroups }}
|
||||
<div class="flex h-full flex-col">
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
|
||||
<AdminGroups openGroupId={typeof tabState?.id === 'string' ? tabState.id : ''} />
|
||||
</div>
|
||||
</div>
|
||||
{/await}
|
||||
{:else if selectedTab === 'admin:functions'}
|
||||
{#await import('$lib/components/admin/Functions.svelte') then { default: AdminFunctions }}
|
||||
<div class="flex h-full flex-col">
|
||||
<div class="flex-1 min-h-0 overflow-y-auto scrollbar-hover pr-1.5">
|
||||
<AdminFunctions />
|
||||
</div>
|
||||
</div>
|
||||
{/await}
|
||||
{:else if selectedTab === 'admin:analytics'}
|
||||
{#await import('$lib/components/admin/Analytics.svelte') then { default: AdminAnalytics }}
|
||||
<AdminAnalytics />
|
||||
<AdminAnalytics openView={typeof tabState?.id === 'string' ? tabState.id : ''} />
|
||||
{/await}
|
||||
{:else if selectedTab === 'admin:integrations'}
|
||||
{#await import('$lib/components/admin/Settings/Integrations.svelte') then { default: AdminIntegrations }}
|
||||
|
||||
@@ -596,7 +596,7 @@
|
||||
{#if role === 'admin'}
|
||||
<a
|
||||
role="menuitem"
|
||||
href="/admin"
|
||||
href="/settings/admin/users"
|
||||
draggable="false"
|
||||
class="flex h-[1.6875rem] items-center gap-2 rounded-xl px-2 text-[0.8125rem] w-full hover:bg-base-50/60 dark:hover:bg-base-800/60 transition cursor-pointer select-none"
|
||||
on:click={async (e) => {
|
||||
@@ -605,7 +605,7 @@
|
||||
}
|
||||
e.preventDefault();
|
||||
show = false;
|
||||
goto('/admin');
|
||||
showSettings.set('admin:users');
|
||||
if ($mobile) {
|
||||
await tick();
|
||||
showSidebar.set(false);
|
||||
@@ -615,7 +615,7 @@
|
||||
<div class="self-center">
|
||||
<UserIcon className="size-3.5" strokeWidth="1.5" />
|
||||
</div>
|
||||
<div class=" self-center truncate">{$i18n.t('Admin Panel')}</div>
|
||||
<div class=" self-center truncate">{$i18n.t('User Management')}</div>
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
placeholder={$i18n.t('Search actions')}
|
||||
emptyLabel={$i18n.t('No actions found')}
|
||||
emptyHint={$i18n.t('Add actions in the Functions workspace.')}
|
||||
workspaceHref={$user?.role === 'admin' ? '/admin/functions' : ''}
|
||||
workspaceHref={$user?.role === 'admin' ? '/settings/admin/functions' : ''}
|
||||
variant="dropdown"
|
||||
on:select={(e) => {
|
||||
selectedActionIds = selectedActionIds.includes(e.detail.id)
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
placeholder={$i18n.t('Search filters')}
|
||||
emptyLabel={$i18n.t('No filters found')}
|
||||
emptyHint={$i18n.t('Add filters in the Functions workspace.')}
|
||||
workspaceHref={$user?.role === 'admin' ? '/admin/functions' : ''}
|
||||
workspaceHref={$user?.role === 'admin' ? '/settings/admin/functions' : ''}
|
||||
variant="dropdown"
|
||||
on:select={(e) => {
|
||||
selectedFilterIds = selectedFilterIds.includes(e.detail.id)
|
||||
|
||||
@@ -5285,6 +5285,7 @@
|
||||
"User group": "مجموعة المستخدمين",
|
||||
"User Groups": "مجموعات المستخدمين",
|
||||
"User location successfully retrieved.": "تم استرجاع موقع المستخدم بنجاح.",
|
||||
"User Management": "",
|
||||
"User menu": "قائمة المستخدم",
|
||||
"User messages": "رسائل المستخدم",
|
||||
"User not found.": "لم يتم العثور على المستخدم.",
|
||||
|
||||
@@ -5285,6 +5285,7 @@
|
||||
"User group": "مجموعة المستخدمين",
|
||||
"User Groups": "مجموعات المستخدمين",
|
||||
"User location successfully retrieved.": "تم استرجاع موقع المستخدم بنجاح.",
|
||||
"User Management": "",
|
||||
"User menu": "قائمة المستخدم",
|
||||
"User messages": "رسائل المستخدم",
|
||||
"User not found.": "لم يتم العثور على المستخدم.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "İstifadəçi qrupu",
|
||||
"User Groups": "İstifadəçi qrupları",
|
||||
"User location successfully retrieved.": "İstifadəçi yeri uğurla müəyyən edildi.",
|
||||
"User Management": "",
|
||||
"User menu": "İstifadəçi menyusu",
|
||||
"User messages": "İstifadəçi mesajları",
|
||||
"User not found.": "İstifadəçi tapılmadı.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Потребителска група",
|
||||
"User Groups": "Потребителски групи",
|
||||
"User location successfully retrieved.": "Местоположението на потребителя е успешно извлечено.",
|
||||
"User Management": "",
|
||||
"User menu": "Потребителско меню",
|
||||
"User messages": "Потребителски съобщения",
|
||||
"User not found.": "Потребителят не е намерен.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "ব্যবহারকারী গ্রুপ",
|
||||
"User Groups": "ব্যবহারকারী গ্রুপসমূহ",
|
||||
"User location successfully retrieved.": "ব্যবহারকারীর অবস্থান সফলভাবে পাওয়া গেছে।",
|
||||
"User Management": "",
|
||||
"User menu": "ব্যবহারকারীর মেনু",
|
||||
"User messages": "ব্যবহারকারীর মেসেজসমূহ",
|
||||
"User not found.": "ব্যবহারকারী পাওয়া যায়নি।",
|
||||
|
||||
@@ -5100,6 +5100,7 @@
|
||||
"User group": "བེད་སྤྱོད་མཁན་གྱི་ཚོགས་པ།",
|
||||
"User Groups": "བེད་སྤྱོད་མཁན་གྱི་ཚོགས་པ།",
|
||||
"User location successfully retrieved.": "བེད་སྤྱོད་མཁན་གནས་ཡུལ་ལེགས་པར་ལེན་ཚུར་སྒྲུབ་བྱས།",
|
||||
"User Management": "",
|
||||
"User menu": "བེད་སྤྱོད་མཁན་གྱི་འདེམས་ཐོ།",
|
||||
"User messages": "བེད་སྤྱོད་མཁན་གྱི་འཕྲིན་ཡིག",
|
||||
"User not found.": "བེད་སྤྱོད་མཁན་མ་རྙེད།",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Korisnička grupa",
|
||||
"User Groups": "Korisničke grupe",
|
||||
"User location successfully retrieved.": "Lokacija korisnika je uspješno dohvaćena.",
|
||||
"User Management": "",
|
||||
"User menu": "Korisnički meni",
|
||||
"User messages": "Korisničke poruke",
|
||||
"User not found.": "Korisnik nije pronađen.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Grup d'usuaris",
|
||||
"User Groups": "Grups d'usuari",
|
||||
"User location successfully retrieved.": "Ubicació de l'usuari obtinguda correctament",
|
||||
"User Management": "",
|
||||
"User menu": "Menú d'usuari",
|
||||
"User messages": "Missatges d'usuari",
|
||||
"User not found.": "No s'ha trobat l'usuari.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Grupo sa mga tiggamit",
|
||||
"User Groups": "Mga grupo sa tiggamit",
|
||||
"User location successfully retrieved.": "Malampusong nakuha ang lokasyon sa tiggamit.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu sa tiggamit",
|
||||
"User messages": "Mga mensahe sa tiggamit",
|
||||
"User not found.": "Wala makit-an ang tiggamit.",
|
||||
|
||||
@@ -5211,6 +5211,7 @@
|
||||
"User group": "Skupina uživatelů",
|
||||
"User Groups": "Skupiny uživatelů",
|
||||
"User location successfully retrieved.": "Poloha uživatele byla úspěšně získána.",
|
||||
"User Management": "",
|
||||
"User menu": "Uživatelská nabídka",
|
||||
"User messages": "Zprávy uživatelů",
|
||||
"User not found.": "Uživatel nebyl nalezen.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Brugergruppe",
|
||||
"User Groups": "Brugergrupper",
|
||||
"User location successfully retrieved.": "Brugerplacering hentet.",
|
||||
"User Management": "",
|
||||
"User menu": "Brugermenu",
|
||||
"User messages": "Brugerbeskeder",
|
||||
"User not found.": "Brugeren blev ikke fundet.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Benutzergruppe",
|
||||
"User Groups": "Benutzergruppen",
|
||||
"User location successfully retrieved.": "Benutzerstandort erfolgreich abgerufen.",
|
||||
"User Management": "",
|
||||
"User menu": "Benutzermenü",
|
||||
"User messages": "Benutzernachrichten",
|
||||
"User not found.": "Benutzer nicht gefunden.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Such user group",
|
||||
"User Groups": "Many User Groups",
|
||||
"User location successfully retrieved.": "User location successfully retrieved.",
|
||||
"User Management": "",
|
||||
"User menu": "Such user menu",
|
||||
"User messages": "Many user messages",
|
||||
"User not found.": "User not found.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Ομάδα χρηστών",
|
||||
"User Groups": "Ομάδες Χρηστών",
|
||||
"User location successfully retrieved.": "Η τοποθεσία του χρήστη ανακτήθηκε με επιτυχία.",
|
||||
"User Management": "",
|
||||
"User menu": "Μενού Χρήστη",
|
||||
"User messages": "Μηνύματα χρήστη",
|
||||
"User not found.": "Ο χρήστης δεν βρέθηκε.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "User group",
|
||||
"User Groups": "User Groups",
|
||||
"User location successfully retrieved.": "User location successfully retrieved.",
|
||||
"User Management": "",
|
||||
"User menu": "User menu",
|
||||
"User messages": "User messages",
|
||||
"User not found.": "User not found.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "",
|
||||
"User Groups": "",
|
||||
"User location successfully retrieved.": "",
|
||||
"User Management": "",
|
||||
"User menu": "",
|
||||
"User messages": "",
|
||||
"User not found.": "",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Grupo de usuarios",
|
||||
"User Groups": "Grupos de Usuarios",
|
||||
"User location successfully retrieved.": "Ubicación de usuario obtenida correctamente.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu de Usuario",
|
||||
"User messages": "Mensajes del usuario",
|
||||
"User not found.": "Usuario no encontrado.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Kasutajagrupp",
|
||||
"User Groups": "Kasutajagrupid",
|
||||
"User location successfully retrieved.": "Kasutaja asukoht edukalt hangitud.",
|
||||
"User Management": "",
|
||||
"User menu": "Kasutaja menüü",
|
||||
"User messages": "Kasutaja sõnumid",
|
||||
"User not found.": "Kasutajat ei leitud.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Erabiltzaile-taldea",
|
||||
"User Groups": "Erabiltzaile-taldeak",
|
||||
"User location successfully retrieved.": "Erabiltzailearen kokapena ongi berreskuratu da.",
|
||||
"User Management": "",
|
||||
"User menu": "Erabiltzailearen menua",
|
||||
"User messages": "Erabiltzailearen mezuak",
|
||||
"User not found.": "Ez da erabiltzailea aurkitu.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "گروه کاربری",
|
||||
"User Groups": "گروه\u200cهای کاربری",
|
||||
"User location successfully retrieved.": "موقعیت مکانی کاربر با موفقیت دریافت شد.",
|
||||
"User Management": "",
|
||||
"User menu": "منوی کاربر",
|
||||
"User messages": "پیام\u200cهای کاربر",
|
||||
"User not found.": "کاربر یافت نشد.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Käyttäjäryhmä",
|
||||
"User Groups": "Käyttäjäryhmät",
|
||||
"User location successfully retrieved.": "Käyttäjän sijainti haettu onnistuneesti.",
|
||||
"User Management": "",
|
||||
"User menu": "Käyttäjävalikko",
|
||||
"User messages": "Käyttäjän viestit",
|
||||
"User not found.": "Käyttäjää ei löytynyt.",
|
||||
|
||||
@@ -5140,6 +5140,7 @@
|
||||
"User group": "Grupo ng gumagamit",
|
||||
"User Groups": "Mga Grupo ng Gumagamit",
|
||||
"User location successfully retrieved.": "Matagumpay na nakuha ang lokasyon ng gumagamit.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu ng gumagamit",
|
||||
"User messages": "Mga mensahe ng gumagamit",
|
||||
"User not found.": "Hindi nahanap ang gumagamit.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Brúkarabólkur",
|
||||
"User Groups": "Brúkarabólkar",
|
||||
"User location successfully retrieved.": "Staðsetingin hjá brúkaranum varð funnin.",
|
||||
"User Management": "",
|
||||
"User menu": "Brúkaravalmynd",
|
||||
"User messages": "Brúkaraboð",
|
||||
"User not found.": "Brúkarin varð ikki funnin.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Groupe d'utilisateurs",
|
||||
"User Groups": "Groupes d'utilisateurs",
|
||||
"User location successfully retrieved.": "L'emplacement de l'utilisateur a été récupéré avec succès.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu utilisateur",
|
||||
"User messages": "Messages de l'utilisateur",
|
||||
"User not found.": "Utilisateur introuvable.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Groupe d'utilisateurs",
|
||||
"User Groups": "Groupes d'utilisateurs",
|
||||
"User location successfully retrieved.": "Emplacement de l'utilisateur récupéré avec succès.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu utilisateur",
|
||||
"User messages": "Messages utilisateur",
|
||||
"User not found.": "Utilisateur introuvable.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Grupo de usuarios",
|
||||
"User Groups": "Grupos de usuarios",
|
||||
"User location successfully retrieved.": "Localización do usuario recuperada con éxito.",
|
||||
"User Management": "",
|
||||
"User menu": "Menú de usuario",
|
||||
"User messages": "Mensaxes do usuario",
|
||||
"User not found.": "Non se atopou o usuario.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "קבוצת משתמשים",
|
||||
"User Groups": "קבוצות המשתמש",
|
||||
"User location successfully retrieved.": "מיקום המשתמש אוחזר בהצלחה.",
|
||||
"User Management": "",
|
||||
"User menu": "תפריט משתמש",
|
||||
"User messages": "הודעות המשתמש",
|
||||
"User not found.": "המשתמש לא נמצא.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "उपयोगकर्ता समूह",
|
||||
"User Groups": "उपयोगकर्ता समूह",
|
||||
"User location successfully retrieved.": "उपयोगकर्ता का स्थान सफलतापूर्वक प्राप्त हुआ.",
|
||||
"User Management": "",
|
||||
"User menu": "उपयोगकर्ता मेन्यू",
|
||||
"User messages": "उपयोगकर्ता संदेश",
|
||||
"User not found.": "उपयोगकर्ता नहीं मिला.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Korisnička grupa",
|
||||
"User Groups": "Korisničke grupe",
|
||||
"User location successfully retrieved.": "Lokacija korisnika je uspješno dohvaćena.",
|
||||
"User Management": "",
|
||||
"User menu": "Korisnički izbornik",
|
||||
"User messages": "Korisničke poruke",
|
||||
"User not found.": "Korisnik nije pronađen.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Felhasználói csoport",
|
||||
"User Groups": "Felhasználói csoportok",
|
||||
"User location successfully retrieved.": "Felhasználó helye sikeresen lekérve.",
|
||||
"User Management": "",
|
||||
"User menu": "Felhasználói menü",
|
||||
"User messages": "Felhasználói üzenetek",
|
||||
"User not found.": "A felhasználó nem található.",
|
||||
|
||||
@@ -5116,6 +5116,7 @@
|
||||
"User group": "Grup pengguna",
|
||||
"User Groups": "Grup Pengguna",
|
||||
"User location successfully retrieved.": "Lokasi pengguna berhasil diambil.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu pengguna",
|
||||
"User messages": "Pesan pengguna",
|
||||
"User not found.": "Pengguna tidak ditemukan.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Grúpa úsáideoirí",
|
||||
"User Groups": "Grúpaí Úsáideoirí",
|
||||
"User location successfully retrieved.": "Fuarthas suíomh an úsáideora go rathúil.",
|
||||
"User Management": "",
|
||||
"User menu": "Roghchlár úsáideora",
|
||||
"User messages": "Teachtaireachtaí úsáideora",
|
||||
"User not found.": "Níor aimsíodh an t-úsáideoir.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Gruppo di utenti",
|
||||
"User Groups": "Gruppi utente",
|
||||
"User location successfully retrieved.": "Posizione utente recuperata con successo.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu utente",
|
||||
"User messages": "Messaggi utente",
|
||||
"User not found.": "Utente non trovato.",
|
||||
|
||||
@@ -5116,6 +5116,7 @@
|
||||
"User group": "ユーザーグループ",
|
||||
"User Groups": "ユーザーグループ",
|
||||
"User location successfully retrieved.": "ユーザーの位置情報が正常に取得されました。",
|
||||
"User Management": "",
|
||||
"User menu": "ユーザーメニュー",
|
||||
"User messages": "ユーザーのメッセージ",
|
||||
"User not found.": "ユーザーが見つかりません。",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "მომხმარებლის ჯგუფი",
|
||||
"User Groups": "მომხმარებლის ჯგუფები",
|
||||
"User location successfully retrieved.": "მომხმარებლის მდებარეობა წარმატებით მიღებულია.",
|
||||
"User Management": "",
|
||||
"User menu": "მომხმარებლის მენიუ",
|
||||
"User messages": "მომხმარებლის შეტყობინებები",
|
||||
"User not found.": "მომხმარებელი აღმოჩენილი არაა.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Agraw n yiseqdacen",
|
||||
"User Groups": "Agraw n iseqdacen",
|
||||
"User location successfully retrieved.": "Adig n useqdac yettwaf akken iwata.",
|
||||
"User Management": "",
|
||||
"User menu": "Umuɣ n useqdac",
|
||||
"User messages": "Iznan n useqdac",
|
||||
"User not found.": "Ur yettwaf ara useqdac.",
|
||||
|
||||
@@ -5103,6 +5103,7 @@
|
||||
"User group": "사용자 그룹",
|
||||
"User Groups": "사용자 그룹",
|
||||
"User location successfully retrieved.": "성공적으로 사용자의 위치를 불러왔습니다",
|
||||
"User Management": "",
|
||||
"User menu": "사용자 메뉴",
|
||||
"User messages": "사용자 메시지 수",
|
||||
"User not found.": "사용자를 찾을 수 없습니다.",
|
||||
|
||||
@@ -5211,6 +5211,7 @@
|
||||
"User group": "Naudotojų grupė",
|
||||
"User Groups": "Naudotojų grupės",
|
||||
"User location successfully retrieved.": "Naudotojo vieta sėkmingai gauta.",
|
||||
"User Management": "",
|
||||
"User menu": "Naudotojo meniu",
|
||||
"User messages": "Naudotojo žinutės",
|
||||
"User not found.": "Naudotojas nerastas.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Lietotāju grupa",
|
||||
"User Groups": "Lietotāju grupas",
|
||||
"User location successfully retrieved.": "Lietotāja atrašanās vieta veiksmīgi iegūta.",
|
||||
"User Management": "",
|
||||
"User menu": "Lietotāja izvēlne",
|
||||
"User messages": "Lietotāja ziņojumi",
|
||||
"User not found.": "Lietotājs nav atrasts.",
|
||||
|
||||
@@ -5116,6 +5116,7 @@
|
||||
"User group": "Kumpulan pengguna",
|
||||
"User Groups": "Kumpulan Pengguna",
|
||||
"User location successfully retrieved.": "Lokasi pengguna berjaya diambil.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu Pengguna",
|
||||
"User messages": "Mesej pengguna",
|
||||
"User not found.": "Pengguna tidak dijumpai.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Brukergruppe",
|
||||
"User Groups": "Brukergrupper",
|
||||
"User location successfully retrieved.": "Brukerens lokasjon hentet",
|
||||
"User Management": "",
|
||||
"User menu": "Brukermeny",
|
||||
"User messages": "Brukermeldinger",
|
||||
"User not found.": "Finner ikke brukeren.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Gebruikersgroep",
|
||||
"User Groups": "Gebruikersgroepen",
|
||||
"User location successfully retrieved.": "Gebruikerslocatie succesvol opgehaald",
|
||||
"User Management": "",
|
||||
"User menu": "Gebruikersmenu",
|
||||
"User messages": "Gebruikersberichten",
|
||||
"User not found.": "Gebruiker niet gevonden.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "ਉਪਭੋਗਤਾ ਗਰੁੱਪ",
|
||||
"User Groups": "ਉਪਭੋਗਤਾ ਗਰੁੱਪ",
|
||||
"User location successfully retrieved.": "ਉਪਭੋਗਤਾ ਦਾ ਟਿਕਾਣਾ ਸਫਲਤਾਪੂਰਵਕ ਪ੍ਰਾਪਤ ਕੀਤਾ ਗਿਆ।",
|
||||
"User Management": "",
|
||||
"User menu": "ਉਪਭੋਗਤਾ ਮੀਨੂ",
|
||||
"User messages": "ਉਪਭੋਗਤਾ ਦੇ ਸੁਨੇਹੇ",
|
||||
"User not found.": "ਉਪਭੋਗਤਾ ਨਹੀਂ ਮਿਲਿਆ।",
|
||||
|
||||
@@ -5211,6 +5211,7 @@
|
||||
"User group": "Grupa użytkowników",
|
||||
"User Groups": "Grupy użytkowników",
|
||||
"User location successfully retrieved.": "Lokalizacja użytkownika pobrana pomyślnie.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu użytkownika",
|
||||
"User messages": "Wiadomości użytkownika",
|
||||
"User not found.": "Nie znaleziono użytkownika.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Grupo de usuários",
|
||||
"User Groups": "Grupos de usuários",
|
||||
"User location successfully retrieved.": "Localização do usuário recuperada com sucesso.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu do usuário",
|
||||
"User messages": "Mensagens do usuário",
|
||||
"User not found.": "Usuário não encontrado.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Grupo de utilizadores",
|
||||
"User Groups": "Grupos de Utilizadores",
|
||||
"User location successfully retrieved.": "Localização do utilizador recuperada com sucesso.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu do Utilizador",
|
||||
"User messages": "Mensagens do utilizador",
|
||||
"User not found.": "Utilizador não encontrado.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Grup de utilizatori",
|
||||
"User Groups": "Grupuri de utilizatori",
|
||||
"User location successfully retrieved.": "Localizarea utilizatorului a fost preluată cu succes.",
|
||||
"User Management": "",
|
||||
"User menu": "Meniul utilizatorului",
|
||||
"User messages": "Mesajele utilizatorului",
|
||||
"User not found.": "Utilizatorul nu a fost găsit.",
|
||||
|
||||
@@ -5211,6 +5211,7 @@
|
||||
"User group": "Группа пользователей",
|
||||
"User Groups": "Группы пользователей",
|
||||
"User location successfully retrieved.": "Местоположение пользователя успешно получено.",
|
||||
"User Management": "",
|
||||
"User menu": "Меню пользователя",
|
||||
"User messages": "Сообщения пользователя",
|
||||
"User not found.": "Пользователь не найден.",
|
||||
|
||||
@@ -5211,6 +5211,7 @@
|
||||
"User group": "Skupina používateľov",
|
||||
"User Groups": "Skupiny používateľov",
|
||||
"User location successfully retrieved.": "Umiestnenie používateľa bolo úspešne získané.",
|
||||
"User Management": "",
|
||||
"User menu": "Ponuka používateľa",
|
||||
"User messages": "Správy používateľa",
|
||||
"User not found.": "Používateľ sa nenašiel.",
|
||||
|
||||
@@ -5211,6 +5211,7 @@
|
||||
"User group": "Skupina uporabnikov",
|
||||
"User Groups": "Skupine uporabnikov",
|
||||
"User location successfully retrieved.": "Lokacija uporabnika je uspešno pridobljena.",
|
||||
"User Management": "",
|
||||
"User menu": "User menu",
|
||||
"User messages": "Uporabniška sporočila",
|
||||
"User not found.": "Uporabnika ni mogoče najti.",
|
||||
|
||||
@@ -5174,6 +5174,7 @@
|
||||
"User group": "Група корисника",
|
||||
"User Groups": "Корисничке групе",
|
||||
"User location successfully retrieved.": "Корисничка локација успешно добављена.",
|
||||
"User Management": "",
|
||||
"User menu": "Кориснички мени",
|
||||
"User messages": "Корисничке поруке",
|
||||
"User not found.": "Корисник није пронађен.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Användargrupp",
|
||||
"User Groups": "Användargrupper",
|
||||
"User location successfully retrieved.": "Användarens plats har hämtats",
|
||||
"User Management": "",
|
||||
"User menu": "Användarmenyn",
|
||||
"User messages": "Användarmeddelanden",
|
||||
"User not found.": "Användaren hittades inte.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "பயனர் குழு",
|
||||
"User Groups": "பயனர் குழுக்கள்",
|
||||
"User location successfully retrieved.": "பயனர் இருப்பிடம் வெற்றிகரமாக மீட்டெடுக்கப்பட்டது.",
|
||||
"User Management": "",
|
||||
"User menu": "பயனர் மெனு",
|
||||
"User messages": "பயனர் செய்திகள்",
|
||||
"User not found.": "பயனர் கிடைக்கவில்லை.",
|
||||
|
||||
@@ -5100,6 +5100,7 @@
|
||||
"User group": "กลุ่มผู้ใช้",
|
||||
"User Groups": "กลุ่มผู้ใช้",
|
||||
"User location successfully retrieved.": "ดึงตำแหน่งที่ตั้งของผู้ใช้สำเร็จแล้ว",
|
||||
"User Management": "",
|
||||
"User menu": "เมนูผู้ใช้",
|
||||
"User messages": "ข้อความของผู้ใช้",
|
||||
"User not found.": "ไม่พบผู้ใช้",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Ulanyjy topary",
|
||||
"User Groups": "Ulanyjy Toparlary",
|
||||
"User location successfully retrieved.": "Ulanyjynyň ýerleşýän ýeri üstünlikli alyndy.",
|
||||
"User Management": "",
|
||||
"User menu": "Ulanyjy menýusy",
|
||||
"User messages": "Ulanyjynyň habarlary",
|
||||
"User not found.": "Ulanyjy tapylmady.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Kullanıcı grubu",
|
||||
"User Groups": "Kullanıcı Grupları",
|
||||
"User location successfully retrieved.": "Kullanıcı konumu başarıyla alındı.",
|
||||
"User Management": "",
|
||||
"User menu": "Kullanıcı menüsü",
|
||||
"User messages": "Kullanıcı mesajları",
|
||||
"User not found.": "Kullanıcı bulunamadı.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "ئىشلەتكۈچى گۇرۇپپىسى",
|
||||
"User Groups": "ئىشلەتكۈچى گۇرۇپپىلىرى",
|
||||
"User location successfully retrieved.": "ئىشلەتكۈچى ئورنى مۇۋەپپەقىيەتلىك ئېلىندى.",
|
||||
"User Management": "",
|
||||
"User menu": "ئىشلەتكۈچى مېنيۇسى",
|
||||
"User messages": "ئىشلەتكۈچى ئۇچۇرلىرى",
|
||||
"User not found.": "ئىشلەتكۈچى تېپىلمىدى.",
|
||||
|
||||
@@ -5211,6 +5211,7 @@
|
||||
"User group": "Група користувачів",
|
||||
"User Groups": "Групи користувачів",
|
||||
"User location successfully retrieved.": "Місцезнаходження користувача успішно знайдено.",
|
||||
"User Management": "",
|
||||
"User menu": "Меню користувача",
|
||||
"User messages": "Повідомлення користувача",
|
||||
"User not found.": "Користувача не знайдено.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "صارف کا گروپ",
|
||||
"User Groups": "صارف کے گروپس",
|
||||
"User location successfully retrieved.": "صارف کا مقام کامیابی سے حاصل کیا گیا",
|
||||
"User Management": "",
|
||||
"User menu": "صارف مینو",
|
||||
"User messages": "صارف کے پیغامات",
|
||||
"User not found.": "صارف نہیں ملا۔",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Фойдаланувчилар гуруҳи",
|
||||
"User Groups": "Фойдаланувчи гуруҳлари",
|
||||
"User location successfully retrieved.": "Фойдаланувчи жойлашуви муваффақиятли олинди.",
|
||||
"User Management": "",
|
||||
"User menu": "Фойдаланувчи менюси",
|
||||
"User messages": "Фойдаланувчи хабарлари",
|
||||
"User not found.": "Фойдаланувчи топилмади.",
|
||||
|
||||
@@ -5137,6 +5137,7 @@
|
||||
"User group": "Foydalanuvchilar guruhi",
|
||||
"User Groups": "Foydalanuvchi guruhlari",
|
||||
"User location successfully retrieved.": "Foydalanuvchi joylashuvi muvaffaqiyatli olindi.",
|
||||
"User Management": "",
|
||||
"User menu": "Foydalanuvchi menyusi",
|
||||
"User messages": "Foydalanuvchi xabarlari",
|
||||
"User not found.": "Foydalanuvchi topilmadi.",
|
||||
|
||||
@@ -5100,6 +5100,7 @@
|
||||
"User group": "Nhóm người dùng",
|
||||
"User Groups": "Nhóm người dùng",
|
||||
"User location successfully retrieved.": "Đã truy xuất thành công vị trí của người dùng.",
|
||||
"User Management": "",
|
||||
"User menu": "Menu người dùng",
|
||||
"User messages": "Tin nhắn của người dùng",
|
||||
"User not found.": "Không tìm thấy người dùng.",
|
||||
|
||||
@@ -5113,6 +5113,7 @@
|
||||
"User group": "用户组",
|
||||
"User Groups": "用户组",
|
||||
"User location successfully retrieved.": "成功检索到用户位置",
|
||||
"User Management": "",
|
||||
"User menu": "用户菜单",
|
||||
"User messages": "用户消息",
|
||||
"User not found.": "未找到用户。",
|
||||
|
||||
@@ -5100,6 +5100,7 @@
|
||||
"User group": "使用者群組",
|
||||
"User Groups": "使用者群組",
|
||||
"User location successfully retrieved.": "成功取得使用者位置。",
|
||||
"User Management": "",
|
||||
"User menu": "使用者選單",
|
||||
"User messages": "使用者訊息",
|
||||
"User not found.": "找不到使用者。",
|
||||
|
||||
@@ -12,6 +12,9 @@ const SETTINGS_SLUGS: Record<string, string> = {
|
||||
about: 'about',
|
||||
'admin:general': 'admin/general',
|
||||
'admin:authentication': 'admin/authentication',
|
||||
'admin:users': 'admin/users',
|
||||
'admin:groups': 'admin/groups',
|
||||
'admin:functions': 'admin/functions',
|
||||
'admin:features': 'admin/features',
|
||||
'admin:tasks': 'admin/tasks',
|
||||
'admin:interface': 'admin/interface',
|
||||
@@ -41,15 +44,18 @@ const SETTINGS_ALIASES: Record<string, string> = {
|
||||
export const settingsPath = (tab: string) =>
|
||||
`/settings/${SETTINGS_SLUGS[tab] ?? SETTINGS_SLUGS.general}`;
|
||||
|
||||
/** The tab (and model, for /settings/admin/models/<id>) a settings address points at. */
|
||||
export const parseSettingsPath = (pathname: string): { tab: string; modelId?: string } | null => {
|
||||
/** The tab an address points at, and the model, group or Analytics view it opens. */
|
||||
export const parseSettingsPath = (pathname: string): { tab: string; itemId?: string } | null => {
|
||||
const match = pathname.match(/^\/settings(?:\/(.*?))?\/?$/);
|
||||
if (!match) return null;
|
||||
const rest = match[1] ?? '';
|
||||
if (!rest) return { tab: 'general' };
|
||||
|
||||
const model = rest.match(/^admin\/models\/(.+)$/);
|
||||
if (model) return { tab: 'admin:models', modelId: decodeURIComponent(model[1]) };
|
||||
// Evaluations now live in Analytics, which opens on the leaderboard from these addresses.
|
||||
if (rest === 'admin/evaluations') return { tab: 'admin:analytics', itemId: 'leaderboard' };
|
||||
|
||||
const item = rest.match(/^admin\/(models|groups)\/(.+)$/);
|
||||
if (item) return { tab: `admin:${item[1]}`, itemId: decodeURIComponent(item[2]) };
|
||||
|
||||
const tab =
|
||||
Object.keys(SETTINGS_SLUGS).find((id) => SETTINGS_SLUGS[id] === rest) ??
|
||||
|
||||
@@ -208,13 +208,13 @@
|
||||
requestedSettings.startsWith('admin:') && $user?.role !== 'admin'
|
||||
? 'general'
|
||||
: requestedSettings;
|
||||
const modelId = $page.url.searchParams.get('model');
|
||||
const itemId = $page.url.searchParams.get('item');
|
||||
|
||||
// Strip the params before opening: opening adds the settings address to history, and
|
||||
// this replace would otherwise overwrite it.
|
||||
const params = new URLSearchParams($page.url.searchParams);
|
||||
params.delete('settings');
|
||||
params.delete('model');
|
||||
params.delete('item');
|
||||
const query = params.toString();
|
||||
await goto(`${$page.url.pathname}${query ? `?${query}` : ''}${$page.url.hash}`, {
|
||||
replaceState: true,
|
||||
@@ -222,7 +222,7 @@
|
||||
keepFocus: true
|
||||
});
|
||||
|
||||
showSettings.set(tab === 'admin:models' && modelId ? { tab, state: { id: modelId } } : tab);
|
||||
showSettings.set(itemId ? { tab, state: { id: itemId } } : tab);
|
||||
};
|
||||
|
||||
// Settings has its own address. Opening it adds one history entry, switching tabs replaces
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { onMount, getContext } from 'svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
|
||||
import { WEBUI_NAME, config, mobile, showSettings, showSidebar, user } from '$lib/stores';
|
||||
import { WEBUI_NAME, config, mobile, showSidebar, user } from '$lib/stores';
|
||||
import { page } from '$app/stores';
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
|
||||
@@ -63,54 +63,6 @@
|
||||
</Tooltip>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<div class="flex w-full items-center">
|
||||
<div
|
||||
class="flex min-w-0 mr-1.5 items-center gap-0.5 md:gap-1 scrollbar-none overflow-x-auto w-fit text-center text-sm font-normal bg-transparent py-1 touch-auto pointer-events-auto"
|
||||
>
|
||||
<a
|
||||
draggable="false"
|
||||
aria-current={$page.url.pathname.includes('/admin/users') ? 'page' : null}
|
||||
class="min-w-fit px-1 text-sm {$page.url.pathname.includes('/admin/users')
|
||||
? ''
|
||||
: 'text-base-300 dark:text-base-600 hover:text-base-700 dark:hover:text-base-0'} transition select-none"
|
||||
href="/admin">{$i18n.t('Users')}</a
|
||||
>
|
||||
|
||||
<a
|
||||
draggable="false"
|
||||
aria-current={$page.url.pathname.includes('/admin/evaluations') ? 'page' : null}
|
||||
class="min-w-fit px-1 text-sm {$page.url.pathname.includes('/admin/evaluations')
|
||||
? ''
|
||||
: 'text-base-300 dark:text-base-600 hover:text-base-700 dark:hover:text-base-0'} transition select-none"
|
||||
href="/admin/evaluations">{$i18n.t('Evaluations')}</a
|
||||
>
|
||||
|
||||
{#if $config?.features?.enable_functions}
|
||||
<a
|
||||
draggable="false"
|
||||
aria-current={$page.url.pathname.includes('/admin/functions') ? 'page' : null}
|
||||
class="min-w-fit px-1 text-sm {$page.url.pathname.includes('/admin/functions')
|
||||
? ''
|
||||
: 'text-base-300 dark:text-base-600 hover:text-base-700 dark:hover:text-base-0'} transition select-none"
|
||||
href="/admin/functions">{$i18n.t('Functions')}</a
|
||||
>
|
||||
{/if}
|
||||
|
||||
<a
|
||||
draggable="false"
|
||||
aria-current={$page.url.pathname.includes('/admin/settings') ? 'page' : null}
|
||||
class="min-w-fit px-1 text-sm {$page.url.pathname.includes('/admin/settings')
|
||||
? ''
|
||||
: 'text-base-300 dark:text-base-600 hover:text-base-700 dark:hover:text-base-0'} transition select-none"
|
||||
href="/admin/settings"
|
||||
on:click={(event) => {
|
||||
event.preventDefault();
|
||||
showSettings.set('admin:general');
|
||||
}}>{$i18n.t('Settings')}</a
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
import { goto } from '$app/navigation';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// The admin pages moved into Settings.
|
||||
onMount(() => {
|
||||
goto('/admin/users', { replaceState: true });
|
||||
goto('/settings/admin/users', { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
@@ -1,8 +1,9 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
// The admin pages moved into Settings.
|
||||
onMount(() => {
|
||||
goto('/admin/evaluations/leaderboard', { replaceState: true });
|
||||
goto('/settings/admin/evaluations', { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
@@ -1,5 +1,9 @@
|
||||
<script>
|
||||
import Evaluations from '$lib/components/admin/Evaluations.svelte';
|
||||
</script>
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
<Evaluations />
|
||||
// The admin pages moved into Settings.
|
||||
onMount(() => {
|
||||
goto('/settings/admin/evaluations', { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
@@ -1,25 +1,9 @@
|
||||
<script>
|
||||
import { onMount } from 'svelte';
|
||||
import { config, functions } from '$lib/stores';
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
import { getFunctions } from '$lib/apis/functions';
|
||||
import Functions from '$lib/components/admin/Functions.svelte';
|
||||
|
||||
onMount(async () => {
|
||||
if (!$config?.features?.enable_functions) {
|
||||
await goto('/admin', { replaceState: true });
|
||||
return;
|
||||
}
|
||||
|
||||
await Promise.all([
|
||||
(async () => {
|
||||
functions.set(await getFunctions(localStorage.token));
|
||||
})()
|
||||
]);
|
||||
// The admin pages moved into Settings.
|
||||
onMount(() => {
|
||||
goto('/settings/admin/functions', { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
|
||||
{#if $functions !== null}
|
||||
<Functions />
|
||||
{/if}
|
||||
@@ -53,13 +53,13 @@
|
||||
functions.set(await getFunctions(localStorage.token));
|
||||
models.set(await getModels(localStorage.token, false, true));
|
||||
|
||||
await goto('/admin/functions');
|
||||
await goto('/settings/admin/functions');
|
||||
}
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
if (!$config?.features?.enable_functions) {
|
||||
goto('/admin', { replaceState: true });
|
||||
goto('/', { replaceState: true });
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
onMount(async () => {
|
||||
if (!$config?.features?.enable_functions) {
|
||||
goto('/admin', { replaceState: true });
|
||||
goto('/', { replaceState: true });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
if (id) {
|
||||
func = await getFunctionById(localStorage.token, id).catch((error) => {
|
||||
toast.error(`${error}`);
|
||||
goto('/admin/functions');
|
||||
goto('/settings/admin/functions');
|
||||
return null;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<script>
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
onMount(async () => {
|
||||
await goto('/admin/users/overview', { replaceState: true });
|
||||
// The admin pages moved into Settings.
|
||||
onMount(() => {
|
||||
goto('/settings/admin/users', { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
@@ -1,5 +1,16 @@
|
||||
<script>
|
||||
import Users from '$lib/components/admin/Users.svelte';
|
||||
</script>
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/stores';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
<Users />
|
||||
// The admin pages moved into Settings; /admin/users/groups?id=<id> opens that group.
|
||||
onMount(() => {
|
||||
const id = $page.url.searchParams.get('id');
|
||||
goto(
|
||||
$page.params.tab === 'groups'
|
||||
? `/settings/admin/groups${id ? `/${encodeURIComponent(id)}` : ''}`
|
||||
: '/settings/admin/users',
|
||||
{ replaceState: true }
|
||||
);
|
||||
});
|
||||
</script>
|
||||
@@ -9,7 +9,7 @@
|
||||
const request = parseSettingsPath($page.url.pathname) ?? { tab: 'general' };
|
||||
const params = new URLSearchParams($page.url.searchParams);
|
||||
params.set('settings', request.tab);
|
||||
if (request.modelId) params.set('model', request.modelId);
|
||||
if (request.itemId) params.set('item', request.itemId);
|
||||
goto(`/?${params.toString()}`, { replaceState: true });
|
||||
});
|
||||
</script>
|
||||
Reference in new issue
Block a user