Open History to see the last commit
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 { useNowMinute } from "../../hooks/useNowMinute";
19import { Button } from "../ui/button";
20import { toastManager } from "../ui/toast";
21
22import { Input } from "../ui/input";
23import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select";
24import { Switch } from "../ui/switch";
25import {
26 NumberField,
27 NumberFieldDecrement,
28 NumberFieldGroup,
29 NumberFieldIncrement,
30 NumberFieldInput,
31} from "../ui/number-field";
32import {
33 SettingResetButton,
34 SettingsPageContainer,
35 SettingsRow,
36 SettingsSection,
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 );
105}
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 );
168}
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
176function lastRunSummary(
177 entries: readonly { readonly label: string; readonly counts: string }[],
178 machineCount: number,
179) {
180 const first = entries[0];
181 if (!first) return "";
182 if (machineCount <= 1) return first.counts;
183 if (entries.length === machineCount && entries.every((entry) => entry.counts === first.counts)) {
184 return `${first.counts} on every machine`;
185 }
186 return entries.map((entry) => `${entry.label}: ${entry.counts}`).join(" · ");
187}
188
189function CleanupResults({
190 report,
191 environmentLabel,
192}: {
193 report: StorageCleanupReport;
194 environmentLabel: string;
195}) {
196 return (
197 <>
198 {report.entries.map((entry, index) => {
199 const name =
200 entry.kind === "worktree"
201 ? ((entry.threadId === null
202 ? entry.path
203 : entry.path?.split(/[\\/]/).findLast(Boolean)) ?? "Worktrees")
204 : entry.kind === "logs"
205 ? "Rotated logs"
206 : "Browser artifacts";
207 return (
208 <SettingsRow
209 key={`${entry.path ?? entry.kind}:${entry.threadId ?? index}`}
210 title={<span className="wrap-anywhere select-text">{name}</span>}
211 description={
212 <span className="block space-y-2 wrap-anywhere select-text">
213 <span className={`block ${entry.outcome === "failed" ? "text-destructive" : ""}`}>
214 {entry.reason}
215 </span>
216 <span className="grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 border-l border-border/60 pl-3">
217 <span>Machine</span>
218 <span className="text-foreground/80">{environmentLabel}</span>
219 {entry.projectPath && (
220 <>
221 <span>Project</span>
222 <code className="text-foreground/80">{entry.projectPath}</code>
223 </>
224 )}
225 {entry.path && (
226 <>
227 <span>Folder</span>
228 <code className="text-foreground/80">{entry.path}</code>
229 </>
230 )}
231 {entry.threadTitle && (
232 <>
233 <span>Thread</span>
234 <span>{entry.threadTitle}</span>
235 </>
236 )}
237 </span>
238 </span>
239 }
240 control={
241 (entry.outcome === "removed" ||
242 (entry.outcome === "kept" && entry.bytes !== null)) && (
243 <span className="text-xs text-muted-foreground">
244 {[
245 entry.kind !== "worktree" && entry.files !== null
246 ? `${entry.files.toLocaleString()} ${entry.files === 1 ? "file" : "files"}`
247 : null,
248 entry.bytes !== null ? formatBytes(entry.bytes) : null,
249 ]
250 .filter(Boolean)
251 .join(" · ")}
252 </span>
253 )
254 }
255 />
256 );
257 })}
258 {report.omittedCount > 0 && (
259 <p className="px-3 py-2.5 text-xs text-muted-foreground sm:px-4">
260 {environmentLabel}: {report.omittedCount.toLocaleString()} more results.
261 </p>
262 )}
263 {report.entries.length === 0 && report.omittedCount === 0 && (
264 <p className="px-3 py-2.5 text-xs text-muted-foreground sm:px-4">
265 {environmentLabel}: Nothing needed cleanup.
266 </p>
267 )}
268 </>
269 );
270}
271
272const storageCleanupReportsAtom = environmentAtomList(
273 "web-storage-cleanup-reports",
274 (environmentId) => serverEnvironment.storageCleanupReport({ environmentId, input: {} }),
275);
276const storageCleanupPermissionsAtom = environmentAtomList(
277 "web-storage-cleanup-permissions",
278 serverEnvironment.runStorageCleanup.permissionAtom,
279);
280
281function CleanupSection() {
282 const nowMinute = useNowMinute();
283 const nowMs = Date.parse(`${nowMinute}:00.000Z`);
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, nowMs)}. ${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 );
423}
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 <DatabaseStorageNotice
496 environments={connectedEnvironments.filter(
497 (environment) =>
498 environment.serverConfig?.environment.capabilities.databaseStorage === true,
499 )}
500 />
501 )}
502 <SettingsSection id="storage-worktrees" title="Worktrees">
503 {!isProjectScope && <WorktreesDirectoryRow />}
504 {isProjectScope && (
505 <SettingsRow
506 title="Automatic worktree cleanup"
507 description={
508 mode === "off"
509 ? "Keep this project's worktrees until you delete them manually."
510 : mode === "custom"
511 ? "Use these rules for this project."
512 : "Use each machine's worktree cleanup settings."
513 }
514 serverScoped
515 settingKeys={["worktreeCleanup"]}
516 mixed={mixedModes}
517 control={
518 <Select
519 value={mixedModes ? null : mode}
520 onValueChange={(next) => {
521 if (next === "inherit") clearSettings(["worktreeCleanup"]);
522 else if (next === "off") updateSettings({ worktreeCleanup: { mode: "off" } });
523 else if (next === "custom")
524 updateSettings({ worktreeCleanup: { mode: "custom", rules: {} } });
525 }}
526 >
527 <SelectTrigger size="sm" aria-label="Automatic worktree cleanup">
528 <SelectValue>
529 {mixedModes
530 ? "Mixed"
531 : mode === "inherit"
532 ? "Inherit"
533 : mode === "off"
534 ? "Off"
535 : "Custom"}
536 </SelectValue>
537 </SelectTrigger>
538 <SelectPopup align="end" alignItemWithTrigger={false}>
539 <SelectItem value="inherit">Inherit</SelectItem>
540 <SelectItem value="off">Off</SelectItem>
541 <SelectItem value="custom">Custom</SelectItem>
542 </SelectPopup>
543 </Select>
544 }
545 />
546 )}
547 {(!isProjectScope || (!mixedModes && mode === "custom")) && (
548 <>
549 <SettingsRow
550 title="Delete worktrees with deleted threads"
551 status={ruleStatus("worktreeOnDelete")}
552 description="Remove unused worktrees when active or archived threads are deleted. Worktrees with local changes are kept."
553 serverScoped={!isProjectScope}
554 control={
555 <Switch
556 aria-label="Delete worktrees with deleted threads"
557 checked={settings.worktreeOnDelete}
558 onCheckedChange={(worktreeOnDelete) => updateWorktree({ worktreeOnDelete })}
559 />
560 }
561 />
562 <SettingsRow
563 title="Delete inactive worktrees"
564 status={ruleStatus("worktreeAfterDays")}
565 description="Remove worktrees after their threads have been inactive for this many days. Branches and thread history are kept."
566 serverScoped={!isProjectScope}
567 control={
568 <RetentionControl
569 label="Delete inactive worktrees"
570 value={settings.worktreeAfterDays}
571 onChange={(worktreeAfterDays) => updateWorktree({ worktreeAfterDays })}
572 />
573 }
574 />
575 {connectedEnvironments.length > 0 &&
576 connectedEnvironments.every(
577 (environment) =>
578 environment.serverConfig?.environment.capabilities.settledWorktreeCleanup ===
579 true,
580 ) && (
581 <SettingsRow
582 title="Delete settled worktrees"
583 status={[
584 ruleStatus("worktreeSettledAfterDays"),
585 environments.length > connectedEnvironments.length
586 ? "Offline machines will not get this setting"
587 : undefined,
588 ]
589 .filter(Boolean)
590 .join(". ")}
591 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."
592 serverScoped={!isProjectScope}
593 control={
594 <RetentionControl
595 label="Delete settled worktrees"
596 value={settings.worktreeSettledAfterDays}
597 minimum={0}
598 onChange={(worktreeSettledAfterDays) =>
599 updateWorktree({ worktreeSettledAfterDays })
600 }
601 />
602 }
603 />
604 )}
605 <SettingsRow
606 title="Delete merged worktrees"
607 status={ruleStatus("worktreeOnMerge")}
608 description="Remove worktrees whose pull request is merged and whose commits are included in the default branch."
609 serverScoped={!isProjectScope}
610 control={
611 <Switch
612 aria-label="Delete merged worktrees"
613 checked={settings.worktreeOnMerge}
614 onCheckedChange={(worktreeOnMerge) => updateWorktree({ worktreeOnMerge })}
615 />
616 }
617 />
618 <SettingsRow
619 title="Delete unchanged worktrees"
620 status={ruleStatus("worktreeUnchanged")}
621 description="Remove worktrees with no commits beyond the default branch."
622 serverScoped={!isProjectScope}
623 control={
624 <Switch
625 aria-label="Delete unchanged worktrees"
626 checked={settings.worktreeUnchanged}
627 onCheckedChange={(worktreeUnchanged) => updateWorktree({ worktreeUnchanged })}
628 />
629 }
630 />
631 {connectedEnvironments.every(
632 (environment) =>
633 environment.serverConfig?.environment.capabilities.storageCleanupRun === true,
634 ) && (
635 <SettingsRow
636 {...searchableSetting("storage-worktree-keep-when")}
637 status={ruleStatus("worktreeKeepWhen")}
638 description={
639 settings.worktreeKeepWhen === "any-local-files"
640 ? "Includes ignored files, except node_modules."
641 : settings.worktreeKeepWhen === "tracked-changes"
642 ? "Deletes untracked and ignored files, including .env."
643 : "Keeps edits and untracked files. Deletes ignored files, including .env."
644 }
645 serverScoped={!isProjectScope}
646 control={
647 <Select
648 value={ruleStatus("worktreeKeepWhen") ? null : settings.worktreeKeepWhen}
649 onValueChange={(next) => {
650 if (
651 next === "any-local-files" ||
652 next === "uncommitted-changes" ||
653 next === "tracked-changes"
654 )
655 updateWorktree({ worktreeKeepWhen: next });
656 }}
657 >
658 <SelectTrigger size="sm" aria-label="Keep worktrees with local changes">
659 <SelectValue>
660 {ruleStatus("worktreeKeepWhen")
661 ? "Mixed"
662 : KEEP_WHEN_LABELS[settings.worktreeKeepWhen]}
663 </SelectValue>
664 </SelectTrigger>
665 <SelectPopup align="end" alignItemWithTrigger={false}>
666 <SelectItem value="any-local-files">Any local files</SelectItem>
667 <SelectItem value="uncommitted-changes">Uncommitted changes</SelectItem>
668 <SelectItem value="tracked-changes">Edited tracked files</SelectItem>
669 </SelectPopup>
670 </Select>
671 }
672 />
673 )}
674 </>
675 )}
676 </SettingsSection>
677
678 {!isProjectScope && (
679 <SettingsSection id="storage-artifacts" title="Artifacts and logs">
680 <SettingsRow
681 title="Delete old browser artifacts"
682 status={ruleStatus("browserArtifactsAfterDays")}
683 description="Delete saved browser captures after this many days. Older capture links will no longer open."
684 serverScoped
685 control={
686 <RetentionControl
687 label="Delete old browser artifacts"
688 value={settings.browserArtifactsAfterDays}
689 onChange={(browserArtifactsAfterDays) => update({ browserArtifactsAfterDays })}
690 />
691 }
692 />
693 <SettingsRow
694 title="Delete old rotated logs"
695 status={ruleStatus("logsAfterDays")}
696 description="Delete inactive rotated log files after this many days. Current logs are kept."
697 serverScoped
698 control={
699 <RetentionControl
700 label="Delete old rotated logs"
701 value={settings.logsAfterDays}
702 onChange={(logsAfterDays) => update({ logsAfterDays })}
703 />
704 }
705 />
706 </SettingsSection>
707 )}
708 {!isProjectScope && <CleanupSection />}
709 </SettingsPageContainer>
710 );
711}