feat(migrations): Rename indexes and update global integration settings fields for improved clarity and functionality
feat(admin): Add API monitoring, debug console, and system health templates for enhanced admin interface docs: Add AI system cleanup summary and audit report detailing architecture, token management, and recommendations docs: Introduce credits and tokens system guide outlining configuration, data flow, and monitoring strategies
This commit is contained in:
@@ -6,7 +6,6 @@ import { ThemeToggleButton } from "../components/common/ThemeToggleButton";
|
||||
import NotificationDropdown from "../components/header/NotificationDropdown";
|
||||
import UserDropdown from "../components/header/UserDropdown";
|
||||
import { HeaderMetrics } from "../components/header/HeaderMetrics";
|
||||
import ResourceDebugToggle from "../components/debug/ResourceDebugToggle";
|
||||
|
||||
const AppHeader: React.FC = () => {
|
||||
const [isApplicationMenuOpen, setApplicationMenuOpen] = useState(false);
|
||||
@@ -163,8 +162,6 @@ const AppHeader: React.FC = () => {
|
||||
<HeaderMetrics />
|
||||
{/* <!-- Dark Mode Toggler --> */}
|
||||
<ThemeToggleButton />
|
||||
{/* <!-- Resource Debug Toggle (Admin only) --> */}
|
||||
<ResourceDebugToggle />
|
||||
{/* <!-- Notification Menu Area --> */}
|
||||
<NotificationDropdown />
|
||||
{/* <!-- Notification Menu Area --> */}
|
||||
|
||||
@@ -10,7 +10,6 @@ import { useBillingStore } from "../store/billingStore";
|
||||
import { useHeaderMetrics } from "../context/HeaderMetricsContext";
|
||||
import { useErrorHandler } from "../hooks/useErrorHandler";
|
||||
import { trackLoading } from "../components/common/LoadingStateMonitor";
|
||||
import ResourceDebugOverlay from "../components/debug/ResourceDebugOverlay";
|
||||
import PendingPaymentBanner from "../components/billing/PendingPaymentBanner";
|
||||
|
||||
const LayoutContent: React.FC = () => {
|
||||
@@ -22,7 +21,6 @@ const LayoutContent: React.FC = () => {
|
||||
const { addError } = useErrorHandler('AppLayout');
|
||||
const hasLoadedSite = useRef(false);
|
||||
const isLoadingSite = useRef(false);
|
||||
const [debugEnabled, setDebugEnabled] = useState(false);
|
||||
const lastUserRefresh = useRef<number>(0);
|
||||
|
||||
// Initialize site store on mount - only once, but only if authenticated
|
||||
@@ -145,22 +143,6 @@ const LayoutContent: React.FC = () => {
|
||||
}]);
|
||||
}, [balance, isAuthenticated, setMetrics]);
|
||||
|
||||
// Listen for debug toggle changes
|
||||
useEffect(() => {
|
||||
const saved = localStorage.getItem('debug_resource_tracking_enabled');
|
||||
setDebugEnabled(saved === 'true');
|
||||
|
||||
const handleToggle = (e: Event) => {
|
||||
const customEvent = e as CustomEvent;
|
||||
setDebugEnabled(customEvent.detail);
|
||||
};
|
||||
|
||||
window.addEventListener('debug-resource-tracking-toggle', handleToggle);
|
||||
return () => {
|
||||
window.removeEventListener('debug-resource-tracking-toggle', handleToggle);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="min-h-screen xl:flex">
|
||||
<div>
|
||||
@@ -178,8 +160,6 @@ const LayoutContent: React.FC = () => {
|
||||
<div className="p-4 pb-20 md:p-6 md:pb-24">
|
||||
<Outlet />
|
||||
</div>
|
||||
{/* Resource Debug Overlay - Only visible when enabled by admin */}
|
||||
<ResourceDebugOverlay enabled={debugEnabled} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
FileIcon,
|
||||
UserIcon,
|
||||
UserCircleIcon,
|
||||
BoxCubeIcon,
|
||||
} from "../icons";
|
||||
import { useSidebar } from "../context/SidebarContext";
|
||||
import SidebarWidget from "./SidebarWidget";
|
||||
@@ -29,6 +30,7 @@ type NavItem = {
|
||||
icon: React.ReactNode;
|
||||
path?: string;
|
||||
subItems?: { name: string; path: string; pro?: boolean; new?: boolean }[];
|
||||
adminOnly?: boolean;
|
||||
};
|
||||
|
||||
type MenuSection = {
|
||||
@@ -42,9 +44,6 @@ const AppSidebar: React.FC = () => {
|
||||
const { user, isAuthenticated } = useAuthStore();
|
||||
const { moduleEnableSettings, isModuleEnabled: checkModuleEnabled, loadModuleEnableSettings, loading: settingsLoading } = useSettingsStore();
|
||||
|
||||
// Show admin menu only for aws-admin account users
|
||||
const isAwsAdminAccount = Boolean(user?.account?.slug === 'aws-admin');
|
||||
|
||||
// Helper to check if module is enabled - memoized to prevent infinite loops
|
||||
const moduleEnabled = useCallback((moduleName: string): boolean => {
|
||||
if (!moduleEnableSettings) return true; // Default to enabled if not loaded
|
||||
@@ -224,6 +223,30 @@ const AppSidebar: React.FC = () => {
|
||||
path: "/settings/integration",
|
||||
adminOnly: true,
|
||||
},
|
||||
// Global Settings - Admin only, dropdown with global config pages
|
||||
{
|
||||
icon: <BoxCubeIcon />,
|
||||
name: "Global Settings",
|
||||
adminOnly: true,
|
||||
subItems: [
|
||||
{
|
||||
name: "Platform API Keys",
|
||||
path: "/admin/system/globalintegrationsettings/",
|
||||
},
|
||||
{
|
||||
name: "Global Prompts",
|
||||
path: "/admin/system/globalaiprompt/",
|
||||
},
|
||||
{
|
||||
name: "Global Author Profiles",
|
||||
path: "/admin/system/globalauthorprofile/",
|
||||
},
|
||||
{
|
||||
name: "Global Strategies",
|
||||
path: "/admin/system/globalstrategy/",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
icon: <PageIcon />,
|
||||
name: "Publishing",
|
||||
@@ -249,32 +272,10 @@ const AppSidebar: React.FC = () => {
|
||||
];
|
||||
}, [moduleEnabled]);
|
||||
|
||||
// Admin section - only shown for aws-admin account users
|
||||
const adminSection: MenuSection = useMemo(() => ({
|
||||
label: "ADMIN",
|
||||
items: [
|
||||
{
|
||||
icon: <GridIcon />,
|
||||
name: "System Dashboard",
|
||||
path: "/admin/dashboard",
|
||||
},
|
||||
],
|
||||
}), []);
|
||||
|
||||
// Combine all sections, including admin if user is in aws-admin account
|
||||
// Combine all sections
|
||||
const allSections = useMemo(() => {
|
||||
const baseSections = menuSections.map(section => {
|
||||
// Filter adminOnly items for non-system users
|
||||
const filteredItems = section.items.filter((item: any) => {
|
||||
if ((item as any).adminOnly && !isAwsAdminAccount) return false;
|
||||
return true;
|
||||
});
|
||||
return { ...section, items: filteredItems };
|
||||
});
|
||||
return isAwsAdminAccount
|
||||
? [...baseSections, adminSection]
|
||||
: baseSections;
|
||||
}, [isAwsAdminAccount, menuSections, adminSection]);
|
||||
return menuSections;
|
||||
}, [menuSections]);
|
||||
|
||||
useEffect(() => {
|
||||
const currentPath = location.pathname;
|
||||
@@ -355,7 +356,15 @@ const AppSidebar: React.FC = () => {
|
||||
|
||||
const renderMenuItems = (items: NavItem[], sectionIndex: number) => (
|
||||
<ul className="flex flex-col gap-2">
|
||||
{items.map((nav, itemIndex) => (
|
||||
{items
|
||||
.filter((nav) => {
|
||||
// Filter out admin-only items for non-admin users
|
||||
if (nav.adminOnly && user?.role !== 'admin' && !user?.is_staff) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
})
|
||||
.map((nav, itemIndex) => (
|
||||
<li key={nav.name}>
|
||||
{nav.subItems ? (
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user