Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

feat(web): isolate enterprise routes, admin pages and header slots in src/ee (#21696)

chanx637b2311c929
diff --git a/web/src/ee/layouts/components/header-enterprise.tsx b/web/src/ee/layouts/components/header-enterprise.tsx
new file mode 100644
index 0000000000..6a36f7cb05
--- /dev/null
+++ b/web/src/ee/layouts/components/header-enterprise.tsx
@@ -0,0 +1,17 @@
+/**
+ * Enterprise slots inside the app header. The open-source build renders
+ * nothing here; the enterprise build replaces this file with the real
+ * billing entries (upgrade badge, support link, current-plan badge).
+ */
+
+export function EnterpriseHeaderUpgradeBadge() {
+ return null;
+}
+
+export function EnterpriseHeaderTicketsLink() {
+ return null;
+}
+
+export function EnterpriseHeaderPlanBadge() {
+ return null;
+}
diff --git a/web/src/ee/pages/admin/layouts/navigation-private.tsx b/web/src/ee/pages/admin/layouts/navigation-private.tsx
new file mode 100644
index 0000000000..0b95a0c928
--- /dev/null
+++ b/web/src/ee/pages/admin/layouts/navigation-private.tsx
@@ -0,0 +1,22 @@
+import type { ReactNode } from 'react';
+
+export type AdminNavItem = {
+ path: string;
+ name: string;
+ icon: ReactNode;
+};
+
+export type AdminNavExtension = {
+ items: AdminNavItem[];
+ hiddenPaths: string[];
+};
+
+const emptyExtension: AdminNavExtension = { items: [], hiddenPaths: [] };
+
+/**
+ * Enterprise-only admin navigation. The open-source build adds no entries and
+ * hides none; the enterprise build replaces this file with the real entries.
+ */
+export function useEnterpriseAdminNav(): AdminNavExtension {
+ return emptyExtension;
+}
diff --git a/web/src/layouts/components/header.tsx b/web/src/layouts/components/header.tsx
index f2e9e0d5e1..0b8c18fded 100644
--- a/web/src/layouts/components/header.tsx
+++ b/web/src/layouts/components/header.tsx
@@ -7,6 +7,11 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
+import {
+ EnterpriseHeaderPlanBadge,
+ EnterpriseHeaderTicketsLink,
+ EnterpriseHeaderUpgradeBadge,
+} from '@/ee/layouts/components/header-enterprise';
import { useChangeLanguage } from '@/hooks/logic-hooks';
import {
useFetchUserInfo,
@@ -82,6 +87,7 @@ export function Header({
>
<img src={'/logo.svg'} alt="RAGFlow logo" className="size-10" />
</Link>
+ <EnterpriseHeaderUpgradeBadge />
</div>
</div>
@@ -169,6 +175,7 @@ export function Header({
</Button>
{hasNotification && <BellButton className="!size-8" />}
+ <EnterpriseHeaderTicketsLink />
</>
)}
@@ -188,6 +195,7 @@ export function Header({
isPerson
className="size-8"
/>
+ <EnterpriseHeaderPlanBadge />
</Link>
</div>
</header>
@@ -216,6 +224,7 @@ export function Header({
<Button variant="ghost" size="icon" className="size-8">
<LucideCircleHelp className="size-[1em]" />
</Button>
+ <EnterpriseHeaderTicketsLink />
<ThemeButton className="!size-8" />
{hasNotification && <BellButton className="!size-8" />}
<div className="relative ms-3 flex size-10 shrink-0 items-center justify-center">
@@ -225,6 +234,7 @@ export function Header({
isPerson
className="size-8"
/>
+ <EnterpriseHeaderPlanBadge />
</div>
</div>
</div>
diff --git a/web/src/pages/admin/layouts/navigation-layout.tsx b/web/src/pages/admin/layouts/navigation-layout.tsx
index 07dd800d25..61547baac4 100644
--- a/web/src/pages/admin/layouts/navigation-layout.tsx
+++ b/web/src/pages/admin/layouts/navigation-layout.tsx
@@ -14,6 +14,7 @@ import {
} from 'lucide-react';
import { Button } from '@/components/ui/button';
+import { useEnterpriseAdminNav } from '@/ee/pages/admin/layouts/navigation-private';
import { cn } from '@/lib/utils';
import { Routes } from '@/routes';
import { getSystemVersion, logout } from '@/services/admin-service';
@@ -34,6 +35,8 @@ const AdminNavigationLayout = () => {
queryFn: async () => (await getSystemVersion())?.data?.data?.version,
});
+ const enterpriseNav = useEnterpriseAdminNav();
+
const navItems = useMemo(
() => [
{
@@ -74,6 +77,16 @@ const AdminNavigationLayout = () => {
[t],
);
+ const visibleNavItems = useMemo(
+ () => [
+ ...navItems.filter(
+ ({ path }) => !enterpriseNav.hiddenPaths.includes(path),
+ ),
+ ...enterpriseNav.items,
+ ],
+ [navItems, enterpriseNav.items, enterpriseNav.hiddenPaths],
+ );
+
const logoutMutation = useMutation({
mutationKey: ['adminLogout'],
mutationFn: async () => {
@@ -98,7 +111,7 @@ const AdminNavigationLayout = () => {
<nav>
<ul className="space-y-4">
- {navItems.map((it) => (
+ {visibleNavItems.map((it) => (
<li key={it.path}>
<NavLink
to={it.path}