feat(studio): inline flow editor — YAML highlighting + Run (v0.50.0)
Some checks failed
Security / Security check (push) Failing after 1s
Some checks failed
Security / Security check (push) Failing after 1s
New top-level destination "Editor" (Cmd+5) ships as Studio's
fifth surface. The editor reads + writes flow YAML directly
under ~/.fai/data/flows/ via dart:io — the hub picks up the
changes on the next listFlows / runSavedFlow call.
Layout: two-pane shell. Left (240 px) is the file list; right
flexes to the code pane and an optional results column when
Run produces output. Top toolbar exposes:
* filename + dirty-mark
* New flow (scaffolds from a debug.echo template)
* Save (writes the active file to disk)
* Run (saves first if dirty, calls
HubService.runSavedFlow, surfaces typed FlowOutputs in
a side panel)
* Refresh
YAML highlighting via flutter_code_editor + the highlight
package's yaml language. Lightweight style map mapping the
five token classes that actually appear in flow YAML
(attr / string / number / comment / subst for the
${{ ... }} template syntax) to FaiTheme colors — keeps the
editor visually consistent with the rest of Studio.
New-flow naming uses a FilteringTextInputFormatter that
restricts the name to [a-z0-9_-]. A "name already exists"
SnackBar surfaces the conflict instead of silently
overwriting.
Bilingual strings shipped (en.arb + de.arb) for every
operator-facing string: toolbar buttons, dialogs, empty
states, file-exists error, run-output header.
New deps:
* flutter_code_editor ^0.3.5
* highlight (transitive — pinned as direct so the
yaml-language import has its declared dependency).
Smoke-test (test/flow_editor_test.dart) pumps the page and
asserts the empty-state + toolbar render without throwing
on hosts that don't have ~/.fai/data/flows yet. The full
file-list + open-on-tap flow needs a writable HOME override
which dart:io's read-only Platform.environment doesn't allow
inside a test isolate — that path lives in the integration
suite as a follow-up.
Version bumps:
* pubspec.yaml: 0.49.1 → 0.50.0
* main.dart kStudioVersion: 0.42.0 → 0.50.0 (had drifted
behind pubspec; brought back into sync as part of this
bump)
Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
parent
570c38b238
commit
bb793e64a9
15 changed files with 1291 additions and 5 deletions
41
test/flow_editor_test.dart
Normal file
41
test/flow_editor_test.dart
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// Widget smoke-test for the FlowEditorPage.
|
||||
//
|
||||
// Platform.environment is read-only from inside the test
|
||||
// isolate, so we can't redirect HOME to a temp directory.
|
||||
// Instead this test pumps the page and verifies that the
|
||||
// widget tree builds without throwing — exercising the
|
||||
// missing-directory empty-state path on hosts without
|
||||
// ~/.fai/data/flows.
|
||||
|
||||
import 'package:fai_studio/l10n/app_localizations.dart';
|
||||
import 'package:fai_studio/pages/flow_editor.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
Widget wrap() {
|
||||
return MaterialApp(
|
||||
locale: const Locale('en'),
|
||||
supportedLocales: const [Locale('en'), Locale('de')],
|
||||
localizationsDelegates: const [
|
||||
AppLocalizations.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
home: const FlowEditorPage(),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('builds without throwing + shows expected toolbar buttons',
|
||||
(tester) async {
|
||||
await tester.pumpWidget(wrap());
|
||||
await tester.pump(const Duration(milliseconds: 100));
|
||||
expect(find.text('New flow'), findsOneWidget);
|
||||
expect(find.text('Save'), findsOneWidget);
|
||||
expect(find.text('Run'), findsOneWidget);
|
||||
// Without an open file, the empty-state title shows.
|
||||
expect(find.text('No flow open'), findsAtLeastNWidgets(1));
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue