diff --git a/front/components/data_source_view/DataSourceViewSelector.tsx b/front/components/data_source_view/DataSourceViewSelector.tsx index d19c7c5d2768..dc4deee3a4a9 100644 --- a/front/components/data_source_view/DataSourceViewSelector.tsx +++ b/front/components/data_source_view/DataSourceViewSelector.tsx @@ -157,6 +157,10 @@ export function DataSourceViewsSelector({ const folders = filteredDSVs.filter((dsv) => isFolder(dsv.dataSource)); const websites = filteredDSVs.filter((dsv) => isWebsite(dsv.dataSource)); + const displayManagedDsv = + managedDsv.length > 0 && + (useCase === "assistantBuilder" || useCase === "trackerBuilder"); + const defaultSpace = useMemo(() => { const firstKey = Object.keys(selectionConfigurations)[0] ?? null; return firstKey @@ -206,7 +210,7 @@ export function DataSourceViewsSelector({ } else { return ( - {managedDsv.length > 0 && useCase === "assistantBuilder" && ( + {displayManagedDsv && ( -
+
@@ -339,7 +339,7 @@ export const TrackerBuilder = ({
-
+
@@ -395,7 +395,7 @@ export const TrackerBuilder = ({
-
+
@@ -433,7 +433,21 @@ export const TrackerBuilder = ({ />
-
+
+
+ + {Object.keys(tracker.maintainedDataSources).length === 0 ? ( +
+ No documents selected. +
+ ) : ( + + )} +
+
@@ -449,7 +463,21 @@ export const TrackerBuilder = ({ />
-
+
+
+ + {Object.keys(tracker.watchedDataSources).length === 0 ? ( +
+ No documents selected. +
+ ) : ( + + )} +
+
diff --git a/front/components/trackers/TrackerDataSourceSelectedTree.tsx b/front/components/trackers/TrackerDataSourceSelectedTree.tsx new file mode 100644 index 000000000000..f4ebb9d3829a --- /dev/null +++ b/front/components/trackers/TrackerDataSourceSelectedTree.tsx @@ -0,0 +1,149 @@ +import { + BracesIcon, + classNames, + ExternalLinkIcon, + FolderIcon, + IconButton, + Tree, +} from "@dust-tt/sparkle"; +import type { + DataSourceViewSelectionConfigurations, + DataSourceViewType, + LightWorkspaceType, +} from "@dust-tt/types"; +import { useState } from "react"; + +import DataSourceViewDocumentModal from "@app/components/DataSourceViewDocumentModal"; +import { DataSourceViewPermissionTree } from "@app/components/DataSourceViewPermissionTree"; +import { getConnectorProviderLogoWithFallback } from "@app/lib/connector_providers"; +import { orderDatasourceViewSelectionConfigurationByImportance } from "@app/lib/connectors"; +import { getVisualForContentNode } from "@app/lib/content_nodes"; +import { + canBeExpanded, + getDisplayNameForDataSource, +} from "@app/lib/data_sources"; + +export const TrackerDataSourceSelectedTree = ({ + owner, + dataSourceConfigurations, +}: { + owner: LightWorkspaceType; + dataSourceConfigurations: DataSourceViewSelectionConfigurations; +}) => { + const [documentToDisplay, setDocumentToDisplay] = useState( + null + ); + const [dataSourceViewToDisplay, setDataSourceViewToDisplay] = + useState(null); + return ( + <> + setDocumentToDisplay(null)} + /> + + {orderDatasourceViewSelectionConfigurationByImportance( + Object.values(dataSourceConfigurations) + ).map((dsConfig) => { + const LogoComponent = getConnectorProviderLogoWithFallback( + dsConfig.dataSourceView.dataSource.connectorProvider, + FolderIcon + ); + + return ( + + {dsConfig.isSelectAll && ( + { + setDataSourceViewToDisplay(dsConfig.dataSourceView); + setDocumentToDisplay(documentId); + }} + viewType={"documents"} + /> + )} + {dsConfig.selectedResources.map((node) => { + return ( + + { + if (node.sourceUrl) { + window.open(node.sourceUrl, "_blank"); + } + }} + className={classNames( + node.sourceUrl + ? "" + : "pointer-events-none opacity-0" + )} + disabled={!node.sourceUrl} + variant="outline" + /> + { + if (node.dustDocumentId) { + setDataSourceViewToDisplay( + dsConfig.dataSourceView + ); + setDocumentToDisplay(node.dustDocumentId); + } + }} + className={classNames( + node.dustDocumentId + ? "" + : "pointer-events-none opacity-0" + )} + disabled={!node.dustDocumentId} + variant="ghost" + /> +
+ } + > + { + setDataSourceViewToDisplay(dsConfig.dataSourceView); + setDocumentToDisplay(documentId); + }} + viewType={"documents"} + /> + + ); + })} + + ); + })} + + + ); +};