aido-onyx/branding/smb/smb-ui.patch
Naeem Dosh 01be9421df Upgrade to Onyx v4.8.2; drop dead badge fix; refresh connector docs
- Pin upstream to v4.8.2 (better official translations). Branding overlay
  re-verified: logos, favicon, Onyx->AIDO codemod (incl. the official
  next-intl catalogs, now 9 locales with Arabic), notification-hide, and
  de/en language limiting all apply clean and type-check.
- Re-sync smb-ui.patch onto v4.8.2 and remove the "Initial Indexing"
  badge hunk: connectors now ingest as the File source, which reports
  status correctly on its own, so the hunk was dead. The patch is now two
  files (chat citation + licensed Search), keyed on metadata.smb_source.
- Refresh the SMB connector docs to the current design: File-source
  ingestion (chat-searchable), the full extension set, the per-source
  index document and per-connector group access, and the UI overlay that
  copies the full path. Fix stale ingestion_api / v4.5.2 references and a
  trailing-whitespace nit in the connector payload.

DHI is a no-op on v4.8.2 (Dockerfile defaults to public node images).
2026-09-30 17:44:57 +05:00

78 lines
3.3 KiB
Diff

diff --git a/web/src/ee/sections/SearchCard.tsx b/web/src/ee/sections/SearchCard.tsx
index 71b5255d..9b76cbe5 100644
--- a/web/src/ee/sections/SearchCard.tsx
+++ b/web/src/ee/sections/SearchCard.tsx
@@ -10,6 +10,7 @@ import { ValidSources } from "@/lib/types";
import { MinimalOnyxDocument } from "@/lib/search/interfaces";
import { Section } from "@/layouts/general-layouts";
import { Interactive } from "@opal/core";
+import { toast } from "@opal/layouts";
import Truncated from "@/refresh-components/texts/Truncated";
import { timeAgo } from "@opal/time";
import { useMemo } from "react";
@@ -39,6 +40,27 @@ export default function SearchCard({
document.is_internet || document.source_type === ValidSources.Web;
function handleClick() {
+ // AIDO: documents synced from SMB/network shares have no browsable link and
+ // no stored file to preview — the preview pane would just fail. Copy the
+ // logical path to the clipboard so the user can open the file directly on the
+ // share. Mirrors openDocument() used by the chat view.
+ if (document.metadata?.smb_source) {
+ // The full network path is in metadata.logical_path (the search result does
+ // not always carry `link`); semantic_identifier is only the file name.
+ const logicalPath = document.metadata?.logical_path;
+ const path =
+ (typeof logicalPath === "string" ? logicalPath : undefined) ||
+ document.link?.replace(/^file:\/\//, "") ||
+ document.semantic_identifier ||
+ document.document_id;
+ if (path) {
+ void navigator.clipboard
+ ?.writeText(path)
+ .then(() => toast.success(path))
+ .catch(() => undefined);
+ }
+ return;
+ }
if (document.link) {
window.open(document.link, "_blank", "noopener,noreferrer");
return;
diff --git a/web/src/lib/search/utils.ts b/web/src/lib/search/utils.ts
index ce7eab36..ebddf26b 100644
--- a/web/src/lib/search/utils.ts
+++ b/web/src/lib/search/utils.ts
@@ -1,5 +1,6 @@
import { ValidSources } from "@/lib/types";
import { MinimalOnyxDocument, OnyxDocument } from "@/lib/search/interfaces";
+import { toast } from "@opal/layouts";
// If we have a link, open it in a new tab (including if it's a file)
// If above fails and we have a file, update the presenting document
@@ -7,6 +8,26 @@ export const openDocument = (
document: OnyxDocument,
updatePresentingDocument?: (document: MinimalOnyxDocument) => void
) => {
+ // AIDO: documents synced from SMB/network shares have no browsable link and no
+ // stored file to preview — a normal preview click would just fail. Instead,
+ // surface the logical path by copying it to the clipboard so the user can open
+ // the file directly on the share.
+ if (document.metadata?.smb_source) {
+ // The full network path is in metadata.logical_path (the citation object
+ // does not always carry `link`); semantic_identifier is only the file name.
+ const path =
+ document.metadata?.logical_path ||
+ document.link?.replace(/^file:\/\//, "") ||
+ document.semantic_identifier ||
+ document.document_id;
+ if (path) {
+ void navigator.clipboard
+ ?.writeText(path)
+ .then(() => toast.success(path))
+ .catch(() => undefined);
+ }
+ return;
+ }
if (document.link) {
window.open(document.link, "_blank");
} else if (