diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cd4326..c0f07d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,22 @@ version + `kStudioVersion` in `lib/main.dart` stay in lockstep. ## Unreleased +### Added (multi-project, stages ① + ②) + +- **Workspace switcher.** The Audit and Approvals AppBars carry a + workspace control listing the hub's project registry (colour dot per + project, a shield for `protected`, an honesty tooltip). "All projects" + stays reachable — a filter, not a jail. The selection is persisted and + shared across pages; it re-scopes the audit list AND live stream + hub-side, scopes approvals (pending + history), and drives the sidebar + approval badge. Runs launched from the editor are stamped with the + active workspace — unless the flow file declares its own `project:`, + in which case the file wins (CLI semantics). +- **Editor project chip + file-wins guard.** A flow file's own + `project:` shows as a chip; on mismatch with the active workspace an + amber pill offers a one-click switch (the file still wins for the run). + Backed by editor package 0.22.0. + ### Fixed (usertest 2026-07-10 findings) - **Approval prompts localize.** An approval whose flow step gave no diff --git a/lib/pages/flows.dart b/lib/pages/flows.dart index 8cec918..d11bf13 100644 --- a/lib/pages/flows.dart +++ b/lib/pages/flows.dart @@ -16,6 +16,7 @@ import 'package:flutter/material.dart'; import '../data/error_presentation.dart'; import '../data/flow_run_driver.dart'; import '../data/hub.dart'; +import '../data/workspace.dart'; import '../l10n/app_localizations.dart'; class FlowsPage extends StatefulWidget { @@ -149,20 +150,30 @@ class _FlowsPageState extends State { final editorLocale = locale.languageCode == 'de' ? FlowEditorLocale.de : FlowEditorLocale.en; - return FutureBuilder>( - future: _capabilities, - builder: (context, snap) { - final caps = snap.data ?? const []; - return FlowEditorPage( - initialFlowName: widget.initialFlowName, - locale: editorLocale, - runDriver: _driver, - availableCapabilities: caps, - storeCapabilities: _storeCaps, - onInstallCapability: _onInstallCapability, - onAddModuleSource: _onAddModuleSource, - ); - }, + // Rebuild the editor's project chip when the workspace changes, + // so a mismatch banner appears/clears live. + return ListenableBuilder( + listenable: Workspace.instance, + builder: (context, _) => FutureBuilder>( + future: _capabilities, + builder: (context, snap) { + final caps = snap.data ?? const []; + return FlowEditorPage( + initialFlowName: widget.initialFlowName, + locale: editorLocale, + runDriver: _driver, + availableCapabilities: caps, + storeCapabilities: _storeCaps, + onInstallCapability: _onInstallCapability, + onAddModuleSource: _onAddModuleSource, + activeProject: Workspace.instance.activeSlug, + // The file wins for the run; accepting the switch only + // aligns the workspace view to the file's project. + onSwitchToFileProject: (slug) => + Workspace.instance.setActive(slug), + ); + }, + ), ); } } diff --git a/pubspec.lock b/pubspec.lock index 75544e9..3f89ee3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -46,7 +46,7 @@ packages: path: "../fai_chain_studio_flow_editor" relative: true source: path - version: "0.21.2" + version: "0.22.0" characters: dependency: transitive description: