Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

StorageSettings.tsx

716 lines26.8 KB

1import type {
2 StorageCleanupReport,
3 StorageCleanupSettings,
4 WorktreeCleanupRules,
5} from "@t3tools/contracts";
6import { resolveWorktreeCleanup } from "@t3tools/shared/projectSettings";
7import { useRef, useState } from "react";
8import { useAtomValue } from "@effect/atom-react";
9import {
10 isAtomCommandInterrupted,
11 squashAtomCommandFailure,
12} from "@t3tools/client-runtime/state/runtime";
13import { formatBytes } from "../../lib/formatBytes";
14import { environmentAtomList, environmentIdsKey } from "../../state/environmentAtomList";
15import { serverEnvironment } from "../../state/server";
16import { useAtomCommand } from "../../state/use-atom-command";
17import { formatRelativeTimeLabel } from "../../timestampFormat";
18import { Button } from "../ui/button";
19import { toastManager } from "../ui/toast";
20​
21import { Input } from "../ui/input";
22import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select";
23import { Switch } from "../ui/switch";
24import {
25 NumberField,
26 NumberFieldDecrement,
27 NumberFieldGroup,
28 NumberFieldIncrement,
29 NumberFieldInput,
30} from "../ui/number-field";
31import {
32 SettingResetButton,
33 SettingsPageContainer,
34 SettingsRow,
35 SettingsSection,
36 useRelativeTimeTick,
37} from "./settingsLayout";
38import { DatabaseStorageNotice } from "./DatabaseStorageNotice";
39import { SettingsScopeNotice } from "./SettingsScopeNotice";
40import { FoldedSettingsSection } from "./FoldedSettingsSection";
41import { SettingsGroup } from "./SettingsGroup";
42import type { ScopedSettingsTarget } from "./scopedSettings";
43import { useSettingsScope } from "./SettingsScopeContext";
44import { searchableSetting } from "./settingsSearch";
45import {
46 useClearScopedSettings,
47 useScopedSettings,
48 useScopedSettingsMixed,
49 useUpdateScopedSettings,
50} from "./useScopedSettings";
51import { settingsScopeEnvironmentLabel } from "./settingsScopeAxis";
52​
53function WorktreesDirectoryRow() {
54 const { connectedEnvironments, targets } = useSettingsScope();
55 const settings = useScopedSettings();
56 const updateSettings = useUpdateScopedSettings();
57 const mixed = useScopedSettingsMixed(["worktreesDirectory"]);
58 const edited = useRef(false);
59 if (
60 connectedEnvironments.some(
61 (environment) =>
62 environment.serverConfig?.environment.capabilities.worktreesDirectory !== true,
63 )
64 )
65 return null;
66 const scopeKey = targets.map((target) => target.environmentId).join(",");
67​
68 return (
69 <SettingsRow
70 {...searchableSetting("storage-worktrees-location")}
71 description={
72 "Folder where new worktrees are created, on any drive, such as D:\\worktrees or ~/worktrees. Existing worktrees stay where they are. Leave empty to use the T3 home folder."
73 }
74 serverScoped
75 settingKeys={["worktreesDirectory"]}
76 resetAction={
77 mixed || settings.worktreesDirectory !== "" ? (
78 <SettingResetButton
79 label="worktree location"
80 onClick={() => updateSettings({ worktreesDirectory: "" })}
81 />
82 ) : null
83 }
84 control={
85 <Input
86 key={`${scopeKey}:${mixed}:${settings.worktreesDirectory}`}
87 aria-label="Worktree location"
88 autoCapitalize="none"
89 spellCheck={false}
90 placeholder={mixed ? "Mixed" : "Default"}
91 defaultValue={mixed ? "" : settings.worktreesDirectory}
92 onChange={() => {
93 edited.current = true;
94 }}
95 onBlur={(event) => {
96 const value = event.target.value.trim();
97 if (edited.current && (mixed || value !== settings.worktreesDirectory))
98 updateSettings({ worktreesDirectory: value });
99 edited.current = false;
100 }}
101 />
102 }
103 />
104 );
106​
107function RetentionControl({
108 label,
109 value,
110 onChange,
111 minimum = 1,
112}: {
113 label: string;
114 value: number | null;
115 onChange: (value: number | null) => void;
116 minimum?: number;
117}) {
118 const [draft, setDraft] = useState(value);
119 const [savedValue, setSavedValue] = useState(value);
120 if (savedValue !== value) {
121 setSavedValue(value);
122 setDraft(value);
123 }
124​
125 return (
126 <div className="flex items-center gap-3">
127 {value !== null ? (
128 <NumberField
129 value={draft}
130 min={minimum}
131 max={3650}
132 step={1}
133 size="sm"
134 className="w-auto"
135 onValueChange={setDraft}
136 onValueCommitted={(next) => {
137 if (next === null) setDraft(value);
138 else {
139 const days = Math.min(3650, Math.max(minimum, Math.round(next)));
140 setDraft(days);
141 onChange(days);
142 }
143 }}
144 >
145 <NumberFieldGroup>
146 <NumberFieldDecrement aria-label={`Decrease ${label}`} />
147 <NumberFieldInput
148 aria-label={`${label} in days`}
149 size={new Intl.NumberFormat().format(draft ?? value).length}
150 className="field-sizing-content w-auto min-w-[1ch] grow-0 text-right"
151 />
152 <span aria-hidden="true" className="self-center pr-2 text-xs">
153 days
154 </span>
155 <NumberFieldIncrement aria-label={`Increase ${label}`} />
156 </NumberFieldGroup>
157 </NumberField>
158 ) : (
159 <span className="text-xs text-muted-foreground">Off</span>
160 )}
161 <Switch
162 aria-label={label}
163 checked={value !== null}
164 onCheckedChange={(enabled) => onChange(enabled ? 8 : null)}
165 />
166 </div>
167 );
169​
170const KEEP_WHEN_LABELS = {
171 "any-local-files": "Any local files",
172 "uncommitted-changes": "Uncommitted changes",
173 "tracked-changes": "Edited tracked files",
174} as const;
175​
176/** One line for the last-run fold; identical results across machines collapse into one. */
177function lastRunSummary(
178 entries: readonly { readonly label: string; readonly counts: string }[],
179 machineCount: number,
180) {
181 const first = entries[0];
182 if (!first) return "";
183 if (machineCount <= 1) return first.counts;
184 if (entries.length === machineCount && entries.every((entry) => entry.counts === first.counts)) {
185 return `${first.counts} on every machine`;
186 }
187 return entries.map((entry) => `${entry.label}: ${entry.counts}`).join(" · ");
189​
190function CleanupResults({
191 report,
192 environmentLabel,
193}: {
194 report: StorageCleanupReport;
195 environmentLabel: string;
196}) {
197 return (
198 <>
199 {report.entries.map((entry, index) => {
200 const name =
201 entry.kind === "worktree"
202 ? ((entry.threadId === null
203 ? entry.path
204 : entry.path?.split(/[\\/]/).findLast(Boolean)) ?? "Worktrees")
205 : entry.kind === "logs"
206 ? "Rotated logs"
207 : "Browser artifacts";
208 return (
209 <SettingsRow
210 key={`${entry.path ?? entry.kind}:${entry.threadId ?? index}`}
211 title={<span className="wrap-anywhere select-text">{name}</span>}
212 description={
213 <span className="block space-y-2 wrap-anywhere select-text">
214 <span className={`block ${entry.outcome === "failed" ? "text-destructive" : ""}`}>
215 {entry.reason}
216 </span>
217 <span className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 border-l border-border/60 pl-3">
218 <span>Machine</span>
219 <span className="text-foreground/80">{environmentLabel}</span>
220 {entry.projectPath && (
221 <>
222 <span>Project</span>
223 <code className="text-foreground/80">{entry.projectPath}</code>
224 </>
225 )}
226 {entry.path && (
227 <>
228 <span>Folder</span>
229 <code className="text-foreground/80">{entry.path}</code>
230 </>
231 )}
232 {entry.threadTitle && (
233 <>
234 <span>Thread</span>
235 <span>{entry.threadTitle}</span>
236 </>
237 )}
238 </span>
239 </span>
240 }
241 control={
242 (entry.outcome === "removed" ||
243 (entry.outcome === "kept" && entry.bytes !== null)) && (
244 <span className="text-xs text-muted-foreground">
245 {[
246 entry.kind !== "worktree" && entry.files !== null
247 ? `${entry.files.toLocaleString()} ${entry.files === 1 ? "file" : "files"}`
248 : null,
249 entry.bytes !== null ? formatBytes(entry.bytes) : null,
250 ]
251 .filter(Boolean)
252 .join(" · ")}
253 </span>
254 )
255 }
256 />
257 );
258 })}
259 {report.omittedCount > 0 && (
260 <p className="px-3 py-2.5 text-xs text-muted-foreground sm:px-4">
261 {environmentLabel}: {report.omittedCount.toLocaleString()} more results.
262 </p>
263 )}
264 {report.entries.length === 0 && report.omittedCount === 0 && (
265 <p className="px-3 py-2.5 text-xs text-muted-foreground sm:px-4">
266 {environmentLabel}: Nothing needed cleanup.
267 </p>
268 )}
269 </>
270 );
272​
273const storageCleanupReportsAtom = environmentAtomList(
274 "web-storage-cleanup-reports",
275 (environmentId) => serverEnvironment.storageCleanupReport({ environmentId, input: {} }),
276);
277const storageCleanupPermissionsAtom = environmentAtomList(
278 "web-storage-cleanup-permissions",
279 serverEnvironment.runStorageCleanup.permissionAtom,
280);
281​
282function CleanupSection() {
283 useRelativeTimeTick(60_000);
284 const { connectedEnvironments } = useSettingsScope();
285 const [pending, setPending] = useState(false);
286 const run = useAtomCommand(serverEnvironment.runStorageCleanup);
287 const supported = connectedEnvironments.filter(
288 (environment) => environment.serverConfig?.environment.capabilities.storageCleanupRun === true,
289 );
290 const supportedIds = supported.map(({ environmentId }) => environmentId);
291 const reports = useAtomValue(storageCleanupReportsAtom(environmentIdsKey(supportedIds)));
292 const permissions = useAtomValue(storageCleanupPermissionsAtom(environmentIdsKey(supportedIds)));
293 const state = supportedIds.map((environmentId, index) => {
294 const query = reports[index]!;
295 return {
296 environmentId,
297 allowed: permissions[index]!,
298 report: query._tag === "Success" ? query.value : null,
299 loading: query.waiting,
300 failed: query._tag === "Failure",
301 };
302 });
303 const hasRules = supported.some((environment) => {
304 const settings = environment.serverConfig?.settings;
305 if (!settings) return false;
306 const enabled = (rules: WorktreeCleanupRules) =>
307 rules.worktreeAfterDays !== null ||
308 rules.worktreeSettledAfterDays !== null ||
309 rules.worktreeOnMerge ||
310 rules.worktreeOnDelete ||
311 rules.worktreeUnchanged;
312 return (
313 settings.storageCleanup.browserArtifactsAfterDays !== null ||
314 settings.storageCleanup.logsAfterDays !== null ||
315 enabled(resolveWorktreeCleanup(settings, null)) ||
316 Object.values(settings.projectSettingsOverrides).some(
317 (override) =>
318 override.worktreeCleanup?.mode === "custom" && enabled(override.worktreeCleanup.rules),
319 )
320 );
321 });
322 if (supported.length === 0) return null;
323 const summaries = supported.map((environment) => {
324 const query = state.find((entry) => entry.environmentId === environment.environmentId);
325 const report = query?.report ?? null;
326 return {
327 environment,
328 report,
329 label: settingsScopeEnvironmentLabel(environment, connectedEnvironments),
330 counts: report
331 ? `${report.counts.removed} removed, ${report.counts.kept} kept${report.counts.failed > 0 ? `, ${report.counts.failed} failed` : ""}`
332 : "",
333 description: report
334 ? `Last run ${formatRelativeTimeLabel(report.finishedAt)}. ${formatBytes(report.bytesFreed)} recovered.${report.counts.failed > 0 ? ` ${report.counts.failed} ${report.counts.failed === 1 ? "item" : "items"} couldn't be removed.` : ""}`
335 : query?.failed
336 ? "Could not load the last run."
337 : query?.loading
338 ? "Loading last run…"
339 : "Cleanup hasn't run yet.",
340 };
341 });
342 const deleteNow = async () => {
343 if (pending) return;
344 setPending(true);
345 await Promise.all(
346 supported
347 .filter((environment) =>
348 state.some((entry) => entry.environmentId === environment.environmentId && entry.allowed),
349 )
350 .map(async (environment) => {
351 const result = await run({ environmentId: environment.environmentId, input: {} });
352 if (result._tag === "Success") {
353 const failures = result.value.entries.filter((entry) => entry.outcome === "failed");
354 if (failures.length > 0)
355 toastManager.add({
356 type: "error",
357 title: `Cleanup failed on ${environment.label}`,
358 description: failures[0]!.reason,
359 });
360 } else if (!isAtomCommandInterrupted(result)) {
361 toastManager.add({
362 type: "error",
363 title: `Could not run cleanup on ${environment.label}`,
364 description: String(squashAtomCommandFailure(result)),
365 });
366 }
367 }),
368 ).finally(() => setPending(false));
369 };
370 return (
371 <SettingsSection id="storage-cleanup" title="Cleanup" variant="plain">
372 <SettingsGroup>
373 <SettingsRow
374 {...searchableSetting("storage-delete-now")}
375 description={
376 <span>
377 {!hasRules
378 ? "Turn on a cleanup rule to use this."
379 : summaries.map(({ environment, label, description }) => (
380 <span key={environment.environmentId} className="block">
381 {supported.length > 1 ? `${label}: ` : ""}
382 {description}
383 </span>
384 ))}
385 </span>
386 }
387 control={
388 <Button
389 variant="outline"
390 size="sm"
391 disabled={pending || !hasRules || !state.some((entry) => entry.allowed)}
392 onClick={() => void deleteNow()}
393 >
394 {pending ? "Deleting…" : "Delete now"}
395 </Button>
396 }
397 />
398 </SettingsGroup>
399 {summaries.some(({ report }) => report !== null) && (
400 <FoldedSettingsSection
401 id="storage-cleanup-last-run"
402 title="Last run"
403 headerPlacement="inside"
404 summary={lastRunSummary(
405 summaries.filter(({ report }) => report !== null),
406 connectedEnvironments.length,
407 )}
408 >
409 {summaries.map(
410 ({ environment, label, report }) =>
411 report && (
412 <CleanupResults
413 key={environment.environmentId}
414 report={report}
415 environmentLabel={label}
416 />
417 ),
418 )}
419 </FoldedSettingsSection>
420 )}
421 </SettingsSection>
422 );
424​
425export function StorageSettingsPanel() {
426 const { scope, environments, connectedEnvironments, targets, target } = useSettingsScope();
427 const scopedSettings = useScopedSettings();
428 const isProjectScope = scope.kind === "project" || scope.kind === "checkout";
429 const settings = {
430 ...scopedSettings.storageCleanup,
431 ...resolveWorktreeCleanup(scopedSettings, null),
432 };
433 const projectMode = (entry: ScopedSettingsTarget | null) =>
434 entry?.sources.worktreeCleanup === "project"
435 ? (entry.settings.worktreeCleanup?.mode ?? "inherit")
436 : "inherit";
437 const mode = projectMode(target);
438 const mixedModes = targets.some((entry) => projectMode(entry) !== mode);
439 const updateSettings = useUpdateScopedSettings();
440 const clearSettings = useClearScopedSettings();
441 const ruleStatus = (key: keyof StorageCleanupSettings) =>
442 targets.some(
443 (target) =>
444 ({ ...target.settings.storageCleanup, ...resolveWorktreeCleanup(target.settings, null) })[
445 key
446 ] !== settings[key],
447 )
448 ? "Mixed across selected machines"
449 : undefined;
450 const update = (patch: Partial<StorageCleanupSettings>) =>
451 updateSettings({ storageCleanup: patch });
452 const updateWorktree = (patch: Partial<WorktreeCleanupRules>) =>
453 isProjectScope
454 ? updateSettings({ worktreeCleanup: { mode: "custom", rules: patch } })
455 : update(patch);
456​
457 if (
458 isProjectScope &&
459 connectedEnvironments.some(
460 (environment) =>
461 environment.serverConfig?.environment.capabilities.projectWorktreeCleanup !== true,
462 )
463 ) {
464 return (
465 <SettingsScopeNotice target="all">
466 Update the selected machines to configure project worktree cleanup.
467 </SettingsScopeNotice>
468 );
469 }
470​
471 if (
472 connectedEnvironments.some(
473 (environment) => environment.serverConfig?.environment.capabilities.storageCleanup !== true,
474 )
475 ) {
476 return (
477 <SettingsScopeNotice
478 target="environment"
479 eligibleEnvironmentIds={connectedEnvironments
480 .filter(
481 (environment) =>
482 environment.serverConfig?.environment.capabilities.storageCleanup === true,
483 )
484 .map((environment) => environment.environmentId)}
485 >
486 Update the selected environments to use storage cleanup, or choose a machine that supports
487 it.
488 </SettingsScopeNotice>
489 );
490 }
491​
492 return (
493 <SettingsPageContainer>
494 {!isProjectScope &&
495 connectedEnvironments
496 .filter(
497 (environment) =>
498 environment.serverConfig?.environment.capabilities.databaseStorage === true,
499 )
500 .map((environment) => (
501 <DatabaseStorageNotice
502 key={environment.environmentId}
503 environmentId={environment.environmentId}
504 label={environment.label}
505 />
506 ))}
507 <SettingsSection id="storage-worktrees" title="Worktrees">
508 {!isProjectScope && <WorktreesDirectoryRow />}
509 {isProjectScope && (
510 <SettingsRow
511 title="Automatic worktree cleanup"
512 description={
513 mode === "off"
514 ? "Keep this project's worktrees until you delete them manually."
515 : mode === "custom"
516 ? "Use these rules for this project."
517 : "Use each machine's worktree cleanup settings."
518 }
519 serverScoped
520 settingKeys={["worktreeCleanup"]}
521 mixed={mixedModes}
522 control={
523 <Select
524 value={mixedModes ? null : mode}
525 onValueChange={(next) => {
526 if (next === "inherit") clearSettings(["worktreeCleanup"]);
527 else if (next === "off") updateSettings({ worktreeCleanup: { mode: "off" } });
528 else if (next === "custom")
529 updateSettings({ worktreeCleanup: { mode: "custom", rules: {} } });
530 }}
531 >
532 <SelectTrigger size="sm" aria-label="Automatic worktree cleanup">
533 <SelectValue>
534 {mixedModes
535 ? "Mixed"
536 : mode === "inherit"
537 ? "Inherit"
538 : mode === "off"
539 ? "Off"
540 : "Custom"}
541 </SelectValue>
542 </SelectTrigger>
543 <SelectPopup align="end" alignItemWithTrigger={false}>
544 <SelectItem value="inherit">Inherit</SelectItem>
545 <SelectItem value="off">Off</SelectItem>
546 <SelectItem value="custom">Custom</SelectItem>
547 </SelectPopup>
548 </Select>
549 }
550 />
551 )}
552 {(!isProjectScope || (!mixedModes && mode === "custom")) && (
553 <>
554 <SettingsRow
555 title="Delete worktrees with deleted threads"
556 status={ruleStatus("worktreeOnDelete")}
557 description="Remove unused worktrees when active or archived threads are deleted. Worktrees with local changes are kept."
558 serverScoped={!isProjectScope}
559 control={
560 <Switch
561 aria-label="Delete worktrees with deleted threads"
562 checked={settings.worktreeOnDelete}
563 onCheckedChange={(worktreeOnDelete) => updateWorktree({ worktreeOnDelete })}
564 />
565 }
566 />
567 <SettingsRow
568 title="Delete inactive worktrees"
569 status={ruleStatus("worktreeAfterDays")}
570 description="Remove worktrees after their threads have been inactive for this many days. Branches and thread history are kept."
571 serverScoped={!isProjectScope}
572 control={
573 <RetentionControl
574 label="Delete inactive worktrees"
575 value={settings.worktreeAfterDays}
576 onChange={(worktreeAfterDays) => updateWorktree({ worktreeAfterDays })}
577 />
578 }
579 />
580 {connectedEnvironments.length > 0 &&
581 connectedEnvironments.every(
582 (environment) =>
583 environment.serverConfig?.environment.capabilities.settledWorktreeCleanup ===
584 true,
585 ) && (
586 <SettingsRow
587 title="Delete settled worktrees"
588 status={[
589 ruleStatus("worktreeSettledAfterDays"),
590 environments.length > connectedEnvironments.length
591 ? "Offline machines will not get this setting"
592 : undefined,
593 ]
594 .filter(Boolean)
595 .join(". ")}
596 description="Remove worktrees this many days after their thread settles. Set 0 days to remove them at the next cleanup. Branches and thread history are kept."
597 serverScoped={!isProjectScope}
598 control={
599 <RetentionControl
600 label="Delete settled worktrees"
601 value={settings.worktreeSettledAfterDays}
602 minimum={0}
603 onChange={(worktreeSettledAfterDays) =>
604 updateWorktree({ worktreeSettledAfterDays })
605 }
606 />
607 }
608 />
609 )}
610 <SettingsRow
611 title="Delete merged worktrees"
612 status={ruleStatus("worktreeOnMerge")}
613 description="Remove worktrees whose pull request is merged and whose commits are included in the default branch."
614 serverScoped={!isProjectScope}
615 control={
616 <Switch
617 aria-label="Delete merged worktrees"
618 checked={settings.worktreeOnMerge}
619 onCheckedChange={(worktreeOnMerge) => updateWorktree({ worktreeOnMerge })}
620 />
621 }
622 />
623 <SettingsRow
624 title="Delete unchanged worktrees"
625 status={ruleStatus("worktreeUnchanged")}
626 description="Remove worktrees with no commits beyond the default branch."
627 serverScoped={!isProjectScope}
628 control={
629 <Switch
630 aria-label="Delete unchanged worktrees"
631 checked={settings.worktreeUnchanged}
632 onCheckedChange={(worktreeUnchanged) => updateWorktree({ worktreeUnchanged })}
633 />
634 }
635 />
636 {connectedEnvironments.every(
637 (environment) =>
638 environment.serverConfig?.environment.capabilities.storageCleanupRun === true,
639 ) && (
640 <SettingsRow
641 {...searchableSetting("storage-worktree-keep-when")}
642 status={ruleStatus("worktreeKeepWhen")}
643 description={
644 settings.worktreeKeepWhen === "any-local-files"
645 ? "Includes ignored files, except node_modules."
646 : settings.worktreeKeepWhen === "tracked-changes"
647 ? "Deletes untracked and ignored files, including .env."
648 : "Keeps edits and untracked files. Deletes ignored files, including .env."
649 }
650 serverScoped={!isProjectScope}
651 control={
652 <Select
653 value={ruleStatus("worktreeKeepWhen") ? null : settings.worktreeKeepWhen}
654 onValueChange={(next) => {
655 if (
656 next === "any-local-files" ||
657 next === "uncommitted-changes" ||
658 next === "tracked-changes"
659 )
660 updateWorktree({ worktreeKeepWhen: next });
661 }}
662 >
663 <SelectTrigger size="sm" aria-label="Keep worktrees with local changes">
664 <SelectValue>
665 {ruleStatus("worktreeKeepWhen")
666 ? "Mixed"
667 : KEEP_WHEN_LABELS[settings.worktreeKeepWhen]}
668 </SelectValue>
669 </SelectTrigger>
670 <SelectPopup align="end" alignItemWithTrigger={false}>
671 <SelectItem value="any-local-files">Any local files</SelectItem>
672 <SelectItem value="uncommitted-changes">Uncommitted changes</SelectItem>
673 <SelectItem value="tracked-changes">Edited tracked files</SelectItem>
674 </SelectPopup>
675 </Select>
676 }
677 />
678 )}
679 </>
680 )}
681 </SettingsSection>
682​
683 {!isProjectScope && (
684 <SettingsSection id="storage-artifacts" title="Artifacts and logs">
685 <SettingsRow
686 title="Delete old browser artifacts"
687 status={ruleStatus("browserArtifactsAfterDays")}
688 description="Delete saved browser captures after this many days. Older capture links will no longer open."
689 serverScoped
690 control={
691 <RetentionControl
692 label="Delete old browser artifacts"
693 value={settings.browserArtifactsAfterDays}
694 onChange={(browserArtifactsAfterDays) => update({ browserArtifactsAfterDays })}
695 />
696 }
697 />
698 <SettingsRow
699 title="Delete old rotated logs"
700 status={ruleStatus("logsAfterDays")}
701 description="Delete inactive rotated log files after this many days. Current logs are kept."
702 serverScoped
703 control={
704 <RetentionControl
705 label="Delete old rotated logs"
706 value={settings.logsAfterDays}
707 onChange={(logsAfterDays) => update({ logsAfterDays })}
708 />
709 }
710 />
711 </SettingsSection>
712 )}
713 {!isProjectScope && <CleanupSection />}
714 </SettingsPageContainer>
715 );