From 566cd208498b2e63564db7780c82a7ee268939d4 Mon Sep 17 00:00:00 2001 From: Joel Date: Wed, 15 Oct 2025 11:37:12 +0800 Subject: [PATCH] feat: dataset config support readonly --- .../app/configuration/config/index.tsx | 2 +- .../dataset-config/card-item/item.tsx | 23 +++++++++++-------- .../configuration/dataset-config/index.tsx | 12 ++++++---- .../components/app/configuration/preview.tsx | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/web/app/components/app/configuration/config/index.tsx b/web/app/components/app/configuration/config/index.tsx index 3e8b5f1caa..adef93f541 100644 --- a/web/app/components/app/configuration/config/index.tsx +++ b/web/app/components/app/configuration/config/index.tsx @@ -79,7 +79,7 @@ const Config: FC = () => { {/* Dataset */} {/* Tools */} diff --git a/web/app/components/app/configuration/dataset-config/card-item/item.tsx b/web/app/components/app/configuration/dataset-config/card-item/item.tsx index b671d9c146..8d9155b0f0 100644 --- a/web/app/components/app/configuration/dataset-config/card-item/item.tsx +++ b/web/app/components/app/configuration/dataset-config/card-item/item.tsx @@ -29,6 +29,7 @@ const Item: FC = ({ config, onSave, onRemove, + readonly = false, editable = true, }) => { const media = useBreakpoints() @@ -68,7 +69,7 @@ const Item: FC = ({
{ - editable && { e.stopPropagation() setShowSettingsModal(true) @@ -77,14 +78,18 @@ const Item: FC = ({ } - onRemove(config.id)} - state={isDeleting ? ActionButtonState.Destructive : ActionButtonState.Default} - onMouseEnter={() => setIsDeleting(true)} - onMouseLeave={() => setIsDeleting(false)} - > - - + { + !readonly && ( + onRemove(config.id)} + state={isDeleting ? ActionButtonState.Destructive : ActionButtonState.Default} + onMouseEnter={() => setIsDeleting(true)} + onMouseLeave={() => setIsDeleting(false)} + > + + + ) + }
{ config.indexing_technique && { +type Props = { + readonly?: boolean +} +const DatasetConfig: FC = ({ readonly }) => { const { t } = useTranslation() const userProfile = useAppContextSelector(s => s.userProfile) const { @@ -254,10 +257,10 @@ const DatasetConfig: FC = () => { className='mt-2' title={t('appDebug.feature.dataSet.title')} headerRight={ -
+ !readonly && (
{!isAgent && } -
+
) } hasHeaderBottomBorder={!hasData} noBodySpacing @@ -271,7 +274,8 @@ const DatasetConfig: FC = () => { config={item} onRemove={onRemove} onSave={handleSave} - editable={item.editable} + editable={item.editable && !readonly} + readonly={readonly} /> ))} diff --git a/web/app/components/app/configuration/preview.tsx b/web/app/components/app/configuration/preview.tsx index eceb4972aa..7679ee13b6 100644 --- a/web/app/components/app/configuration/preview.tsx +++ b/web/app/components/app/configuration/preview.tsx @@ -305,7 +305,7 @@ const Configuration: FC = ({ return ( -
+