feat(ui): PowerUse-Einstellungen nach Settings -> Ausfuehrung verschieben

Schalter, Zeitfenster und Handoff-Prozent lagen im Usage-Monitor und mussten
in SettingsModalViewModel nur load->save durchgeschleift werden, damit ein
Settings-Speichern sie nicht zurueckwirft. Jetzt gehoeren sie dem General-Tab,
der Monitor ist wieder nur Anzeige + Threshold-Drag, und "Jetzt aktualisieren"
sitzt als Icon in der Titelleiste (neuer ModalShell.HeaderActions-Slot).
This commit is contained in:
mika kuns
2026-09-07 08:17:37 +02:00
parent c7392e085f
commit 7c7c33d677
21 changed files with 179 additions and 213 deletions
@@ -131,6 +131,38 @@ public class SettingsModalViewModelTests : IDisposable
Assert.Equal(77, worker.Saved.UsageGateSevenDayPct);
}
[Fact]
public async Task PowerUse_survives_a_load_edit_save_round_trip()
{
// PowerUse moved off the usage monitor onto this tab, so Settings is now its only writer.
// A binding that doesn't reach General silently resets the switch to the record default.
var worker = new FakeWorker
{
AppToReturn = DtoWith(80, 90) with
{
PowerUseEnabled = true,
PowerUseWindowStart = "18:00",
PowerUseWindowEnd = "06:00",
PowerUseHandoffPct = 88,
},
};
var vm = MakeVm(worker);
await vm.LoadAsync();
Assert.True(vm.General.PowerUseEnabled);
Assert.Equal("18:00", vm.General.PowerUseWindowStart);
Assert.Equal(88, vm.General.PowerUseHandoffPct);
// A typo in the window is normalized to null on save, not stored as a fake window.
vm.General.PowerUseWindowEnd = "not a time";
await vm.SaveCommand.ExecuteAsync(null);
Assert.True(worker.Saved!.PowerUseEnabled);
Assert.Equal("18:00", worker.Saved.PowerUseWindowStart);
Assert.Null(worker.Saved.PowerUseWindowEnd);
Assert.Equal(88, worker.Saved.PowerUseHandoffPct);
}
[Fact]
public async Task HasLinkedRepo_false_when_no_list_has_a_working_dir()
{