From 85d7f1c6edf33db9b2d63e1a44ff3c915bc3bf3e Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 14 Nov 2024 03:16:26 -0800 Subject: [PATCH] refac --- src/lib/components/admin/Users/Groups.svelte | 60 +++++++-- .../admin/Users/Groups/AddGroupModal.svelte | 46 +++---- .../admin/Users/Groups/EditGroupModal.svelte | 115 +++++++++++++++--- .../admin/Users/Groups/GroupItem.svelte | 2 +- .../admin/Users/Groups/Users.svelte | 26 ++-- 5 files changed, 189 insertions(+), 60 deletions(-) diff --git a/src/lib/components/admin/Users/Groups.svelte b/src/lib/components/admin/Users/Groups.svelte index 2f3c13aab..099517b50 100644 --- a/src/lib/components/admin/Users/Groups.svelte +++ b/src/lib/components/admin/Users/Groups.svelte @@ -7,7 +7,7 @@ import { onMount, getContext } from 'svelte'; import { goto } from '$app/navigation'; - import { WEBUI_NAME, config, user, showSidebar } from '$lib/stores'; + import { WEBUI_NAME, config, user, showSidebar, knowledge } from '$lib/stores'; import { WEBUI_BASE_URL } from '$lib/constants'; import Tooltip from '$lib/components/common/Tooltip.svelte'; @@ -54,15 +54,51 @@ groups = [ { id: '1', - name: 'Admins', - description: 'Admins have full access to all features and settings.', - data: { - permissions: { - admin: true + name: 'Group A', + description: 'Group A description', + permissions: { + model: { + enable_filter: false, // boolean + ids: [], // array of strings + default_id: null // null or string + }, + workspace: { + models: false, // boolean + knowledge: false, // boolean + prompts: false // boolean + }, + chat: { + delete: true, // boolean + edit: true, // boolean + temporary: true // boolean } }, - user_ids: [1, 2, 3], - admin_ids: [1] + user_ids: ['1', '2', '3'], // array of strings + admin_ids: ['1'] // array of strings + }, + { + id: '2', + name: 'Moderators', + description: 'Moderators description', + permissions: { + model: { + enable_filter: false, // boolean + ids: [], // array of strings + default_id: null // null or string + }, + workspace: { + models: false, // boolean + knowledge: false, // boolean + prompts: false // boolean + }, + chat: { + delete: true, // boolean + edit: true, // boolean + temporary: true // boolean + } + }, + user_ids: ['1', '5', '6'], // array of strings + admin_ids: ['1'] // array of strings } ]; } @@ -153,15 +189,17 @@
-
+
{#each filteredGroups as group} - +
+ +
{/each} {/if} -
+
diff --git a/src/lib/components/admin/Users/Groups/AddGroupModal.svelte b/src/lib/components/admin/Users/Groups/AddGroupModal.svelte index 63b55f2fa..b2c202bf2 100644 --- a/src/lib/components/admin/Users/Groups/AddGroupModal.svelte +++ b/src/lib/components/admin/Users/Groups/AddGroupModal.svelte @@ -72,33 +72,35 @@ submitHandler(); }} > -
-
-
{$i18n.t('Name')}
+
+
+
+
{$i18n.t('Name')}
-
- +
+ +
-
-
-
{$i18n.t('Description')}
+
+
{$i18n.t('Description')}
-
-