Show a warning if the logs are disabled to reduce confusion

This commit is contained in:
Owen
2026-08-19 16:16:05 -04:00
parent ef051c2f8c
commit 114592add8
13 changed files with 143 additions and 16 deletions
@@ -19,6 +19,8 @@ import { getPrivateResourceSettingsHref } from "@app/lib/launcherResourceAdminHr
import axios from "axios";
import { useStoredPageSize } from "@app/hooks/useStoredPageSize";
import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert";
import LogRetentionWarning from "@app/components/LogRetentionWarning";
import { useOrgContext } from "@app/hooks/useOrgContext";
import { usePaidStatus } from "@app/hooks/usePaidStatus";
import { tierMatrix } from "@server/lib/billing/tierMatrix";
import { logQueries } from "@app/lib/queries";
@@ -32,6 +34,7 @@ export default function GeneralPage() {
const t = useTranslations();
const { orgId } = useParams();
const { org } = useOrgContext();
const { isPaidUser } = usePaidStatus();
const [isExporting, startTransition] = useTransition();
@@ -529,6 +532,13 @@ export default function GeneralPage() {
<PaidFeaturesAlert tiers={tierMatrix.accessLogs} />
{org.org.settingsLogRetentionDaysAccess === 0 && (
<LogRetentionWarning
orgId={orgId as string}
logTypeLabel={t("accessLogs")}
/>
)}
<LogDataTable
columns={columns}
data={rows}
@@ -3,8 +3,10 @@ import { ColumnFilterButton } from "@app/components/ColumnFilterButton";
import { DateTimeValue } from "@app/components/DateTimePicker";
import { LogDataTable } from "@app/components/LogDataTable";
import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert";
import LogRetentionWarning from "@app/components/LogRetentionWarning";
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
import { useEnvContext } from "@app/hooks/useEnvContext";
import { useOrgContext } from "@app/hooks/useOrgContext";
import { usePaidStatus } from "@app/hooks/usePaidStatus";
import { useStoredPageSize } from "@app/hooks/useStoredPageSize";
import { toast } from "@app/hooks/useToast";
@@ -29,6 +31,7 @@ export default function GeneralPage() {
const { orgId } = useParams();
const searchParams = useSearchParams();
const { org } = useOrgContext();
const { isPaidUser } = usePaidStatus();
const [isExporting, startTransition] = useTransition();
@@ -359,6 +362,13 @@ export default function GeneralPage() {
<PaidFeaturesAlert tiers={tierMatrix.actionLogs} />
{org.org.settingsLogRetentionDaysAction === 0 && (
<LogRetentionWarning
orgId={orgId as string}
logTypeLabel={t("actionLogs")}
/>
)}
<LogDataTable
columns={columns}
data={rows}
+11
View File
@@ -3,9 +3,11 @@ import { ColumnFilterButton } from "@app/components/ColumnFilterButton";
import { DateTimeValue } from "@app/components/DateTimePicker";
import { LogDataTable } from "@app/components/LogDataTable";
import { AiSessionChatView } from "@app/components/AiSessionChatView";
import LogRetentionWarning from "@app/components/LogRetentionWarning";
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
import { Button } from "@app/components/ui/button";
import { useEnvContext } from "@app/hooks/useEnvContext";
import { useOrgContext } from "@app/hooks/useOrgContext";
import { toast } from "@app/hooks/useToast";
import { createApiClient } from "@app/lib/api";
import { useTranslations } from "next-intl";
@@ -41,6 +43,8 @@ export default function AiSessionLogsPage() {
const { orgId } = useParams();
const searchParams = useSearchParams();
const { org } = useOrgContext();
const [isExporting, startTransition] = useTransition();
const [currentPage, setCurrentPage] = useState<number>(0);
@@ -641,6 +645,13 @@ export default function AiSessionLogsPage() {
description={t("aiSessionLogsDescription")}
/>
{org.org.settingsLogRetentionDaysAISessions === 0 && (
<LogRetentionWarning
orgId={orgId as string}
logTypeLabel={t("aiSessionLogs")}
/>
)}
<LogDataTable
columns={columns}
data={rows}
@@ -4,8 +4,10 @@ import { ColumnFilterButton } from "@app/components/ColumnFilterButton";
import { DateTimeValue } from "@app/components/DateTimePicker";
import { LogDataTable } from "@app/components/LogDataTable";
import { PaidFeaturesAlert } from "@app/components/PaidFeaturesAlert";
import LogRetentionWarning from "@app/components/LogRetentionWarning";
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
import { useEnvContext } from "@app/hooks/useEnvContext";
import { useOrgContext } from "@app/hooks/useOrgContext";
import { usePaidStatus } from "@app/hooks/usePaidStatus";
import { useStoredPageSize } from "@app/hooks/useStoredPageSize";
import { toast } from "@app/hooks/useToast";
@@ -47,6 +49,7 @@ export default function ConnectionLogsPage() {
const { orgId } = useParams();
const searchParams = useSearchParams();
const { org } = useOrgContext();
const { isPaidUser } = usePaidStatus();
const [isExporting, startTransition] = useTransition();
@@ -582,6 +585,13 @@ export default function ConnectionLogsPage() {
<PaidFeaturesAlert tiers={tierMatrix.connectionLogs} />
{org.org.settingsLogRetentionDaysConnection === 0 && (
<LogRetentionWarning
orgId={orgId as string}
logTypeLabel={t("connectionLogs")}
/>
)}
<LogDataTable
columns={columns}
data={rows}
+13 -1
View File
@@ -1,6 +1,8 @@
import { verifySession } from "@app/lib/auth/verifySession";
import { redirect } from "next/navigation";
import { cache } from "react";
import OrgProvider from "@app/providers/OrgProvider";
import { getCachedOrg } from "@app/lib/api/getCachedOrg";
type GeneralSettingsProps = {
children: React.ReactNode;
@@ -11,6 +13,8 @@ export default async function GeneralSettingsPage({
children,
params
}: GeneralSettingsProps) {
const { orgId } = await params;
const getUser = cache(verifySession);
const user = await getUser();
@@ -18,5 +22,13 @@ export default async function GeneralSettingsPage({
redirect(`/`);
}
return children;
let org = null;
try {
const res = await getCachedOrg(orgId);
org = res.data.data;
} catch {
redirect(`/${orgId}`);
}
return <OrgProvider org={org}>{children}</OrgProvider>;
}
@@ -2,9 +2,11 @@
import { ColumnFilter } from "@app/components/ColumnFilter";
import { DateTimeValue } from "@app/components/DateTimePicker";
import { LogDataTable } from "@app/components/LogDataTable";
import LogRetentionWarning from "@app/components/LogRetentionWarning";
import SettingsSectionTitle from "@app/components/SettingsSectionTitle";
import { Button } from "@app/components/ui/button";
import { useEnvContext } from "@app/hooks/useEnvContext";
import { useOrgContext } from "@app/hooks/useOrgContext";
import { toast } from "@app/hooks/useToast";
import { createApiClient } from "@app/lib/api";
import { useTranslations } from "next-intl";
@@ -29,6 +31,8 @@ export default function GeneralPage() {
const { orgId } = useParams();
const searchParams = useSearchParams();
const { org } = useOrgContext();
const [isExporting, startTransition] = useTransition();
const [currentPage, setCurrentPage] = useState<number>(0);
@@ -714,6 +718,13 @@ export default function GeneralPage() {
description={t("requestLogsDescription")}
/>
{org.org.settingsLogRetentionDaysRequest === 0 && (
<LogRetentionWarning
orgId={orgId as string}
logTypeLabel={t("requestLogs")}
/>
)}
<LogDataTable
columns={columns}
data={rows}
+40
View File
@@ -0,0 +1,40 @@
"use client";
import ActionBanner from "@app/components/ActionBanner";
import { Button } from "@app/components/ui/button";
import { ArrowRight, ShieldAlert } from "lucide-react";
import { useTranslations } from "next-intl";
import Link from "next/link";
type LogRetentionWarningProps = {
orgId: string;
logTypeLabel: string;
};
export function LogRetentionWarning({
orgId,
logTypeLabel
}: LogRetentionWarningProps) {
const t = useTranslations();
return (
<ActionBanner
variant="warning"
title={t("logRetentionDisabledWarningTitle")}
titleIcon={<ShieldAlert className="w-5 h-5" />}
description={t("logRetentionDisabledWarningDescription", {
logType: logTypeLabel
})}
actions={
<Link href={`/${orgId}/settings/general/security`}>
<Button variant="outline" className="gap-2">
{t("logRetentionDisabledWarningButton")}
<ArrowRight className="size-4" />
</Button>
</Link>
}
/>
);
}
export default LogRetentionWarning;