From a0f14838913d0079c7eaaa08510dd21758f0fdaa Mon Sep 17 00:00:00 2001 From: vorotamoroz Date: Thu, 5 Nov 2026 08:36:36 +0000 Subject: [PATCH] Route Journal recovery notices through the existing logger --- .../SettingDialogue/PaneMaintenance.ts | 21 +++++++++++-------- .../PaneMaintenance.unit.spec.ts | 18 ++++++++++------ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/modules/features/SettingDialogue/PaneMaintenance.ts b/src/modules/features/SettingDialogue/PaneMaintenance.ts index b2384dbf..d32ad38b 100644 --- a/src/modules/features/SettingDialogue/PaneMaintenance.ts +++ b/src/modules/features/SettingDialogue/PaneMaintenance.ts @@ -1,6 +1,5 @@ import { EVENT_REQUEST_PERFORM_GC_V3, eventHub } from "@/common/events.ts"; import { $msg } from "@/common/translation"; -import { Notice } from "@/deps.ts"; import { createCoreSettingsAfterFullReset, createEditingSettingsAfterFullReset, @@ -171,19 +170,21 @@ export function paneMaintenance( .onClick(async () => { const replicator = this.core.replicator; if (!isLiveSyncJournalReplicator(replicator)) { - new Notice( + Logger( $msg( "No stopped Journal is available. Retry replication to identify the stopped Journal." - ) + ), + LOG_LEVEL_NOTICE ); return; } const stoppedJournal: Readonly | undefined = replicator.getStoppedJournal(); if (!stoppedJournal) { - new Notice( + Logger( $msg( "No stopped Journal is available. Retry replication to identify the stopped Journal." - ) + ), + LOG_LEVEL_NOTICE ); return; } @@ -202,10 +203,11 @@ export function paneMaintenance( return; } if (this.core.replicator !== replicator) { - new Notice( + Logger( $msg( "The active replicator changed. Retry replication to identify the stopped Journal." - ) + ), + LOG_LEVEL_NOTICE ); return; } @@ -214,10 +216,11 @@ export function paneMaintenance( stoppedJournal ); if (!resumed) { - new Notice( + Logger( $msg( "Journal receipt did not complete after this action. Check the current failure before retrying." - ) + ), + LOG_LEVEL_NOTICE ); } }) diff --git a/src/modules/features/SettingDialogue/PaneMaintenance.unit.spec.ts b/src/modules/features/SettingDialogue/PaneMaintenance.unit.spec.ts index f96bbb62..3df3acb8 100644 --- a/src/modules/features/SettingDialogue/PaneMaintenance.unit.spec.ts +++ b/src/modules/features/SettingDialogue/PaneMaintenance.unit.spec.ts @@ -326,9 +326,11 @@ describe("paneMaintenance", () => { expect(getStoppedJournal).toHaveBeenCalledOnce(); expect(rendered.askYesNoDialog).not.toHaveBeenCalled(); expect(skipStoppedJournalAndResume).not.toHaveBeenCalled(); - expect(maintenanceHarness.notice).toHaveBeenCalledWith( - "No stopped Journal is available. Retry replication to identify the stopped Journal." + expect(maintenanceHarness.logger).toHaveBeenCalledWith( + "No stopped Journal is available. Retry replication to identify the stopped Journal.", + "notice" ); + expect(maintenanceHarness.notice).not.toHaveBeenCalled(); }); it("does not skip the stopped Journal when confirmation is cancelled", async () => { @@ -378,9 +380,11 @@ describe("paneMaintenance", () => { expect(active.skipStoppedJournalAndResume).not.toHaveBeenCalled(); expect(replacement.skipStoppedJournalAndResume).not.toHaveBeenCalled(); - expect(maintenanceHarness.notice).toHaveBeenCalledWith( - "The active replicator changed. Retry replication to identify the stopped Journal." + expect(maintenanceHarness.logger).toHaveBeenCalledWith( + "The active replicator changed. Retry replication to identify the stopped Journal.", + "notice" ); + expect(maintenanceHarness.notice).not.toHaveBeenCalled(); }); it("reports when receipt does not complete after skip and resume", async () => { @@ -391,8 +395,10 @@ describe("paneMaintenance", () => { await rendered.click(); expect(skipStoppedJournalAndResume).toHaveBeenCalledOnce(); - expect(maintenanceHarness.notice).toHaveBeenCalledWith( - "Journal receipt did not complete after this action. Check the current failure before retrying." + expect(maintenanceHarness.logger).toHaveBeenCalledWith( + "Journal receipt did not complete after this action. Check the current failure before retrying.", + "notice" ); + expect(maintenanceHarness.notice).not.toHaveBeenCalled(); }); });