feat(workspace): one global switcher anchor in the shell sidebar

The switcher used to be embedded per page (Flows/Runs/Audit/
Approvals) — invisible on the other five pages and sitting in a
different corner depending on the page (persona review 2026-08-27,
consensus finding). It now lives ONCE in the sidebar, above the
destinations: active project/area always visible, opens the same
menu everywhere, Cmd+P from anywhere. The shell listens to the
workspace, so the sidebar endpoint label can no longer lag a
sealed switch until the next health tick.

Also in this rebuild:

* Stopped sealed areas ask before starting ("Start area X?") —
  a context switch must never boot a hub daemon as a click
  side-effect; running areas keep switching with one click.
* The switcher tooltip told a wrong scope ("filters this view") —
  it now says the choice applies everywhere and stamps new runs.
* The aggregated sealed row explains itself in place (names can
  reveal client identities) and links to the Settings toggle
  (Settings dialog gained an initialCategory jump).
* The active entry carries a checkmark in the menu.
* The Cmd+K palette knows projects and areas, ranked by recent
  use; sealed names honour the privacy setting — while hidden,
  the palette offers the guarded picker instead of the names.
* The runs empty state names the active project filter as the
  cause ("No runs in project X" + show-all action) instead of
  claiming the feature is off.

Tests updated to the anchor and made hermetic (scriptable
projects on the fake hub, sealed-area fake); new coverage for the
checkmark, the why-line, and the start confirmation.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-08-28 00:00:06 +02:00
parent afe782e826
commit 64c2a77dc9
16 changed files with 988 additions and 324 deletions

View file

@ -26,13 +26,21 @@ import 'hub_auth_policy_panel.dart';
import 'theme_picker_grid.dart';
class ChainSettingsDialog extends StatefulWidget {
const ChainSettingsDialog({super.key});
/// Category name to open on (e.g. 'security'); null = the first
/// category. Lets in-place explainers (the sealed-aggregate
/// why-line) jump straight to the toggle they talk about.
final String? initialCategory;
const ChainSettingsDialog({super.key, this.initialCategory});
/// Convenience launcher used from the sidebar gear icon.
static Future<bool> show(BuildContext context) async {
static Future<bool> show(
BuildContext context, {
String? initialCategory,
}) async {
final ok = await showDialog<bool>(
context: context,
builder: (_) => const ChainSettingsDialog(),
builder: (_) => ChainSettingsDialog(initialCategory: initialCategory),
);
return ok ?? false;
}
@ -88,6 +96,9 @@ class _FaiSettingsDialogState extends State<ChainSettingsDialog> {
@override
void initState() {
super.initState();
for (final c in _Category.values) {
if (c.name == widget.initialCategory) _category = c;
}
final ep = HubService.instance.currentEndpoint;
_host = TextEditingController(text: ep.host);
_port = TextEditingController(text: ep.port.toString());