From 1c4233c7ea52409ea8c1c006a706de3347a0eb98 Mon Sep 17 00:00:00 2001
From: ValueOn AG
Date: Tue, 21 Apr 2026 08:57:49 +0200
Subject: [PATCH] udb fix
---
src/components/UnifiedDataBar/SourcesTab.tsx | 81 ++------------------
src/pages/views/workspace/WorkspaceInput.tsx | 59 ++++++++------
2 files changed, 41 insertions(+), 99 deletions(-)
diff --git a/src/components/UnifiedDataBar/SourcesTab.tsx b/src/components/UnifiedDataBar/SourcesTab.tsx
index 7806988..66aaf1f 100644
--- a/src/components/UnifiedDataBar/SourcesTab.tsx
+++ b/src/components/UnifiedDataBar/SourcesTab.tsx
@@ -606,17 +606,6 @@ const SourcesTab: React.FC = ({ context, onSourcesChanged, onSe
}
}, [instanceId, _fetchDataSources, onSourcesChanged]);
- /* ── Remove DataSource ── */
- const _removeDatasource = useCallback(async (dsId: string) => {
- try {
- await api.delete(`/api/workspace/${instanceId}/datasources/${dsId}`);
- _fetchDataSources();
- onSourcesChanged?.();
- } catch (err) {
- console.error('Failed to remove data source:', err);
- }
- }, [instanceId, _fetchDataSources, onSourcesChanged]);
-
/* ── Check if a path is already added ── */
const _isAdded = useCallback((connectionId: string, service: string | undefined, path: string | undefined): boolean => {
const expectedSourceType = service ? (_SERVICE_TO_SOURCE_TYPE[service] || service) : undefined;
@@ -841,17 +830,6 @@ const SourcesTab: React.FC = ({ context, onSourcesChanged, onSe
}
}, [instanceId, _fetchFeatureDataSources, onSourcesChanged]);
- /* ── Feature: Remove FeatureDataSource ── */
- const _removeFeatureDataSource = useCallback(async (fdsId: string) => {
- try {
- await api.delete(`/api/workspace/${instanceId}/feature-datasources/${fdsId}`);
- _fetchFeatureDataSources();
- onSourcesChanged?.();
- } catch (err) {
- console.error('Failed to remove feature data source:', err);
- }
- }, [instanceId, _fetchFeatureDataSources, onSourcesChanged]);
-
/* ── Feature: check if table already added (no record filter) ── */
const _isFeatureTableAdded = useCallback((featureInstanceId: string, tableName: string): boolean => {
return featureDataSources.some(fds =>
@@ -1021,7 +999,6 @@ const SourcesTab: React.FC = ({ context, onSourcesChanged, onSe
dataSources={dataSources}
onCycleScope={_cyclePersonalScope}
onToggleNeutralize={_togglePersonalNeutralize}
- onRemoveDs={_removeDatasource}
onSendToChat={_sendNodeToChat}
scopeCycleTitle={_scopeCycleTitle}
selectedKeys={selectedKeys}
@@ -1081,7 +1058,6 @@ const SourcesTab: React.FC = ({ context, onSourcesChanged, onSe
onCycleScope={_cycleFeatureScope}
onToggleNeutralize={_toggleFeatureNeutralize}
onToggleNeutralizeField={_toggleNeutralizeField}
- onRemoveFds={_removeFeatureDataSource}
featureTree={featureTree}
/>
))}
@@ -1110,7 +1086,6 @@ interface _TreeNodeViewProps {
dataSources: UdbDataSource[];
onCycleScope: (ds: UdbDataSource) => void;
onToggleNeutralize: (ds: UdbDataSource) => void;
- onRemoveDs: (dsId: string) => void;
onSendToChat?: (params: { connectionId: string; sourceType: string; path: string; label: string; displayPath?: string }) => void;
scopeCycleTitle: (scope: string) => string;
selectedKeys: Set;
@@ -1121,7 +1096,7 @@ interface _TreeNodeViewProps {
const _TreeNodeView: React.FC<_TreeNodeViewProps> = ({
node, depth, onToggle, onEnsureDs, isAdded, addingPath,
- dataSources, onCycleScope, onToggleNeutralize, onRemoveDs, onSendToChat, scopeCycleTitle,
+ dataSources, onCycleScope, onToggleNeutralize, onSendToChat, scopeCycleTitle,
selectedKeys, onSelect, inheritedScope, inheritedNeutralize,
}) => {
const { t } = useLanguage();
@@ -1216,19 +1191,11 @@ const _TreeNodeView: React.FC<_TreeNodeViewProps> = ({
{node.label}
- {/* Dynamic action: Remove (only when DS exists) — placed LEFT of the
- * stable trio so the trio always anchors at the right edge. */}
- {ds && (
-
- )}
-
- {/* ── Stable trio: chat | scope | neutralize (always in this order) ── */}
+ {/* ── Stable trio: chat | scope | neutralize (always in this order).
+ * No "remove from workspace" button here by design: the UDB row only
+ * exposes the catalog state. Detach from the *current chat* happens
+ * via the chip "x" in WorkspaceInput; that chip is the single source
+ * of truth for chat-scoped attachment lifecycle. */}