feat(studio): hub maintenance panel with reset action (v0.45.0)
Some checks are pending
Security / Security check (push) Waiting to run

UI parity with the platform CLI: `fai reset` (v0.10.93) is now
reachable from Settings. The panel shows the reset blurb plus
two checkboxes mirroring the CLI flags (Keep modules / Keep
audit log + saved flows), then a destructive-styled "Reset hub
state" button. Click goes through a confirm dialog before
SystemActions.faiReset is invoked.

After the CLI returns, Studio bounces its gRPC channel against
the same endpoint (the daemon restarts on the same channel +
port, so no Settings change needed) and reloads every panel:
channel status, system AI, MCP clients, n8n endpoints, registry
token. Output (success or failure) is shown in a copyable error
box so any unexpected stderr lands somewhere the operator can
paste from.

Sits at the bottom of the dialog under "HUB MAINTENANCE",
separated from the everyday config so a destructive button
doesn't crowd the day-to-day controls.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-05-09 18:52:19 +02:00
parent 9944a7ac8a
commit 3db7db7330
8 changed files with 358 additions and 1 deletions

View file

@ -125,6 +125,25 @@ class SystemActions {
return _runFai(['daemon', 'disable', '--channel', channel]);
}
/// Run `fai reset --yes`. Wipes operator state with the same
/// safety net as the CLI: stops every daemon (including off-
/// channel orphans), atomically backs `~/.fai/` up, recreates
/// it with `bin/`, `channels/`, `config.yaml`, `current-channel`,
/// and `registry-token` preserved. The daemon restarts on the
/// active channel before the call returns.
///
/// Studio's gRPC channel goes down for ~1s while the daemon
/// restarts caller should follow up with a reconnect.
static Future<({bool ok, String stdout, String stderr})> faiReset({
bool keepModules = false,
bool keepData = false,
}) async {
final args = <String>['reset', '--yes'];
if (keepModules) args.add('--keep-modules');
if (keepData) args.add('--keep-data');
return _runFai(args);
}
static Future<({bool ok, String stdout, String stderr})> _runFai(
List<String> args,
) async {