feat(app): section titles read as dividers; one Rendered/Raw switch per definition; schedule rows with labelled facts and a status pill
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../../ui/text/markdown_source_view.dart';
|
||||
import '../../chat/ui/transcript/chat_markdown_view.dart';
|
||||
import '../../../core/api_gateway.dart';
|
||||
import '../../../ui/adaptive/host.dart';
|
||||
import '../domain/graph_protocol.dart';
|
||||
@@ -32,7 +33,7 @@ const String rawStageDefinitionTitle = 'Raw stage definition';
|
||||
/// fetched and no run visit is read, so the pane cannot imply that the stage
|
||||
/// executed. Unknown stage declarations get an explicit missing state; every
|
||||
/// declared stage also keeps its exact JSON below the structured fields.
|
||||
class StageDefinitionView extends StatelessWidget {
|
||||
class StageDefinitionView extends StatefulWidget {
|
||||
const StageDefinitionView({
|
||||
super.key,
|
||||
required this.graph,
|
||||
@@ -48,11 +49,21 @@ class StageDefinitionView extends StatelessWidget {
|
||||
final String pipelineName;
|
||||
final int version;
|
||||
|
||||
@override
|
||||
State<StageDefinitionView> createState() => _StageDefinitionViewState();
|
||||
}
|
||||
|
||||
class _StageDefinitionViewState extends State<StageDefinitionView> {
|
||||
// One switch for every authored text block; raw is the exact text.
|
||||
bool _raw = true;
|
||||
|
||||
String get _identity =>
|
||||
'${pipelineName.isEmpty ? 'Pipeline' : pipelineName} \u00b7 v$version';
|
||||
'${widget.pipelineName.isEmpty ? 'Pipeline' : widget.pipelineName} \u00b7 v${widget.version}';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final graph = widget.graph;
|
||||
final stageKey = widget.stageKey;
|
||||
final style = _StageDefinitionStyle.of(context);
|
||||
final stage = stageDefinitionFor(graph, stageKey);
|
||||
final terminal = isTerminalTarget(stageKey);
|
||||
@@ -67,6 +78,13 @@ class StageDefinitionView extends StatelessWidget {
|
||||
children: [
|
||||
Text(_identity, style: style.muted),
|
||||
const SizedBox(height: 16),
|
||||
if (fields.any((field) => field.block)) ...[
|
||||
MarkdownModeSwitch(
|
||||
raw: _raw,
|
||||
onChanged: (raw) => setState(() => _raw = raw),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
if (stage == null && !terminal)
|
||||
Text(unknownStageDefinition, style: style.value)
|
||||
else ...[
|
||||
@@ -75,7 +93,7 @@ class StageDefinitionView extends StatelessWidget {
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
for (final field in fields)
|
||||
_StageDefinitionFieldView(field: field, style: style),
|
||||
_StageDefinitionFieldView(field: field, style: style, raw: _raw),
|
||||
if (terminal && fields.isEmpty)
|
||||
Text(noStageDefinitionDetails, style: style.muted),
|
||||
if (stage != null) ...[
|
||||
@@ -140,10 +158,15 @@ Future<void> openStageDefinition(
|
||||
/// One labelled field: a compact row for scalars, a selectable block when the
|
||||
/// value is multi-line authored text.
|
||||
class _StageDefinitionFieldView extends StatelessWidget {
|
||||
const _StageDefinitionFieldView({required this.field, required this.style});
|
||||
const _StageDefinitionFieldView({
|
||||
required this.field,
|
||||
required this.style,
|
||||
required this.raw,
|
||||
});
|
||||
|
||||
final StageDefinitionField field;
|
||||
final _StageDefinitionStyle style;
|
||||
final bool raw;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -155,14 +178,10 @@ class _StageDefinitionFieldView extends StatelessWidget {
|
||||
Text(field.label, style: style.label),
|
||||
const SizedBox(height: 4),
|
||||
// An authored text block (a prompt) is markdown: rendered or raw.
|
||||
if (field.block)
|
||||
MarkdownSourceView(
|
||||
text: field.value,
|
||||
raw: _SelectableDefinitionText(
|
||||
value: field.value,
|
||||
style: style.value,
|
||||
),
|
||||
)
|
||||
if (field.block && raw)
|
||||
_SelectableDefinitionText(value: field.value, style: style.value)
|
||||
else if (field.block)
|
||||
ChatMarkdownView(text: field.value)
|
||||
else
|
||||
Text(field.value, style: style.value),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user