Skip to content

Commit a3460c6

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Remove references to audit_logs_enabled from dashboard (#42141)
Prefer audit_log_retention_days, with -1 meaning infinity. GitOrigin-RevId: b3004f70c3eba89f75162539750d5316689add12
1 parent f2fa98b commit a3460c6

File tree

8 files changed

+15
-13
lines changed

8 files changed

+15
-13
lines changed

npm-packages/dashboard-common/src/features/history/components/HistoryView.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ function History() {
4242
const team = useCurrentTeam();
4343
const { startDate, endDate, setDate } = useDateFilters(router);
4444
const entitlements = useTeamEntitlements(team?.id);
45-
const auditLogsEnabled = entitlements?.auditLogsEnabled;
45+
const auditLogsEnabled =
46+
entitlements && entitlements.auditLogRetentionDays !== 0;
4647

4748
// Current day
4849
const maxEndDate = endOfToday();
@@ -91,7 +92,7 @@ function History() {
9192
<LocalDevCallout
9293
className="mt-6 flex-col"
9394
tipText="Tip: Run this to enable the deployment history locally:"
94-
command={`cargo run --bin big-brain-tool -- --dev grant-entitlement --team-entitlement audit_logs_enabled --team-id ${team?.id} --reason "local" true --for-real`}
95+
command={`cargo run --bin big-brain-tool -- --dev grant-entitlement --team-entitlement audit_log_retention_days --team-id ${team?.id} --reason "local" 90 --for-real`}
9596
/>
9697
</Sheet>
9798
</div>

npm-packages/dashboard-common/src/lib/deploymentContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export type DeploymentInfo = (
6262
): { id: number; name?: string | null; email?: string }[] | undefined;
6363
useTeamEntitlements(teamId?: number):
6464
| {
65-
auditLogsEnabled?: boolean;
65+
auditLogRetentionDays?: number;
6666
logStreamingEnabled?: boolean;
6767
streamingExportEnabled?: boolean;
6868
}

npm-packages/dashboard-common/src/lib/mockDeploymentInfo.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ export const mockDeploymentInfo: DeploymentInfo = {
1414
slug: "team",
1515
}),
1616
useTeamMembers: () => [],
17-
useTeamEntitlements: () => ({
18-
auditLogsEnabled: true,
19-
}),
17+
useTeamEntitlements: () => ({}),
2018
useCurrentUsageBanner: () => null,
2119
useCurrentProject: () => ({
2220
id: 0,

npm-packages/dashboard-self-hosted/src/pages/_app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const deploymentInfo: Omit<DeploymentInfo, "deploymentUrl" | "adminKey"> = {
173173
}),
174174
useTeamMembers: () => [],
175175
useTeamEntitlements: () => ({
176-
auditLogsEnabled: true,
176+
auditLogRetentionDays: -1,
177177
logStreamingEnabled: true,
178178
streamingExportEnabled: true,
179179
}),

npm-packages/dashboard/src/layouts/DeploymentDashboardLayout.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ function CurrentDeploymentDashboardLayoutWhenLoggedIn({
4343
const isLoading = deployments === undefined;
4444

4545
const entitlements = useTeamEntitlements(project?.teamId);
46-
const auditLogsEnabled = entitlements?.auditLogsEnabled;
46+
const auditLogsEnabled =
47+
entitlements && entitlements.auditLogRetentionDays !== 0;
4748

4849
useEffect(() => {
4950
if (

npm-packages/dashboard/src/layouts/TeamSettingsLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function TeamSettingsLayout({
3030
const selectedTeam = useCurrentTeam();
3131

3232
const entitlements = useTeamEntitlements(selectedTeam?.id);
33-
const auditLogsEnabled = entitlements?.auditLogsEnabled;
33+
const auditLogsEnabled = entitlements?.auditLogRetentionDays !== 0;
3434

3535
const { singleSignOn } = useLaunchDarkly();
3636

npm-packages/dashboard/src/pages/t/[team]/settings/audit-log.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ export { getServerSideProps } from "lib/ssr";
1010

1111
function AuditLogPage() {
1212
const team = useCurrentTeam();
13-
const auditLogsEnabled = useTeamEntitlements(team?.id)?.auditLogsEnabled;
13+
const auditLogRetentionDays = useTeamEntitlements(
14+
team?.id,
15+
)?.auditLogRetentionDays;
1416
const router = useRouter();
1517

16-
if (auditLogsEnabled === undefined) {
18+
if (auditLogRetentionDays === undefined) {
1719
return <Loading />;
1820
}
19-
if (!auditLogsEnabled) {
21+
if (auditLogRetentionDays === 0) {
2022
toast("info", "The audit log is only available on the Pro plan.", "upsell");
2123
void router.push(`/t/${router.query.team}/settings/billing`);
2224
return null;

npm-packages/dashboard/src/pages/t/[team]/settings/billing.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function Billing({ team }: { team: Team }) {
119119
/>
120120
<LocalDevCallout
121121
tipText="Tip: Run this to enable audit logs locally:"
122-
command={`cargo run --bin big-brain-tool -- --dev grant-entitlement --team-entitlement audit_logs_enabled --team-id ${team.id} --reason "local" true --for-real`}
122+
command={`cargo run --bin big-brain-tool -- --dev grant-entitlement --team-entitlement audit_log_retention_days --team-id ${team.id} --reason "local" 90 --for-real`}
123123
/>
124124
</div>
125125
</div>

0 commit comments

Comments
 (0)