Files
pipelines/app/lib/features/settings/settings_sections.dart
T
alan a6db4ba20e App: run tabs under the header on wide layouts, stable Artifacts tab, spelled-out pipeline status, shared list selection, code block header and edge fades
- Run detail: on a wide window (>= 840, pane >= 600) the tabs are Material
  segments under the run header; phones keep the floating bottom bar.
  Artifacts is always a tab, badged with its count and disabled with 0 (its
  tooltip says why), so Changes never moves.
- Pipelines list: 'Failed · last run 19 Oct' beside the status dot; facts on
  the next line; compact rows keep 'Failed · 19 Oct'.
- Settings: Disconnect is outlined beside a tonal Reconnect.
- Lists: one selection style (tonal fill plus one leading accent bar) for
  runs, pipelines and chats; chat's border, fill and pointer removed.
- Transcript: overflowing blocks fade at the edge with a chevron instead of
  a 'Scroll horizontally' line (semantics hint kept); code blocks get a
  header strip with language and Copy; lighter light-mode code fill.
- Runs list: rows under a day heading show only the time of day.
- Artifact search reveal re-centres once the lazy list's extent settles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-03 00:55:50 +00:00

176 lines
6.1 KiB
Dart

import 'dart:async';
import 'package:flutter/material.dart';
import 'settings_controller.dart';
import 'settings_controls.dart';
import 'settings_copy.dart';
import 'settings_group.dart';
import 'settings_keys.dart';
import 'settings_layout.dart';
import 'settings_status_row.dart';
import 'settings_trust_warning.dart';
export 'settings_status_row.dart';
/// Connection controls for a single endpoint: the editable URL with Connect /
/// Disconnect, the connection's status row and the trusted-network warning as
/// the group's footer. Every action goes through the shared client the
/// controller was given; nothing here opens a second connection.
class SettingsConnectionSection extends StatelessWidget {
const SettingsConnectionSection({
super.key,
required this.controller,
required this.serverUrlField,
});
final SettingsController controller;
final TextEditingController serverUrlField;
@override
Widget build(BuildContext context) {
final errors = <String>[
if (controller.endpointSaveError.isNotEmpty) controller.endpointSaveError,
if (controller.actionError.isNotEmpty) controller.actionError,
];
return SettingsGroup(
title: 'Connection',
footer: settingsConnectionFooter(controller),
children: <Widget>[
SettingsGroupItem(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
SettingsTextField(
controller: serverUrlField,
key: SettingsKeys.serverUrl,
label: 'Server URL',
placeholder: serverUrlPlaceholder,
helper: serverUrlHelper,
error: controller.urlError,
onChanged: controller.updateServerUrl,
maxLines: 2,
),
const SizedBox(height: settingsTitleGap),
SettingsActions(
primaryLabel: controller.primaryActionLabel,
secondaryLabel: controller.secondaryActionLabel,
// Disconnect is outlined beside a tonal Reconnect.
primaryOutlined: controller.connectionActive,
primaryKey: controller.connectionActive
? SettingsKeys.disconnect
: SettingsKeys.connect,
secondaryKey: controller.connectionActive
? SettingsKeys.connect
: SettingsKeys.reconnect,
onPrimary: () => unawaited(
controller.connectionActive
? controller.disconnect()
: controller.connect(),
),
onSecondary: () => unawaited(
controller.connectionActive
? controller.connect()
: controller.reconnect(),
),
),
for (final error in errors) ...<Widget>[
const SizedBox(height: settingsFieldGap),
Text(error, style: settingsTextStyle(context, error: true)),
],
],
),
),
SettingsStatusRow(controller: controller),
],
);
}
}
/// The Connection group's footer: the trust warning, then a protocol
/// mismatch when the server reports one.
Widget settingsConnectionFooter(SettingsController controller) => Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
const SettingsTrustWarning(),
if (controller.protocolWarning case final warning?)
Builder(
// A live region announces a mismatch the operator did not ask to
// reveal.
builder: (context) => Padding(
padding: const EdgeInsets.only(top: settingsTitleGap),
child: Semantics(
liveRegion: true,
child: Text(
warning,
style: TextStyle(color: settingsErrorColor(context)),
),
),
),
),
],
);
/// Workspace controls. The path is resolved by the execution server, and the
/// helper says so explicitly; an empty saved value is named "(none)". Save is
/// a tonal button while it is unavailable.
class SettingsWorkspaceSection extends StatelessWidget {
const SettingsWorkspaceSection({
super.key,
required this.controller,
required this.workspaceField,
});
final SettingsController controller;
final TextEditingController workspaceField;
@override
Widget build(BuildContext context) {
final saveError = controller.workspaceSaveError;
final canSave = canSaveWorkspace(controller.workspaceDraft);
final save = canSave ? () => unawaited(controller.saveWorkspace()) : null;
return SettingsGroup(
title: 'Workspace',
children: <Widget>[
SettingsGroupItem(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
SettingsTextField(
controller: workspaceField,
key: SettingsKeys.workspace,
label: 'Workspace path (on the server)',
placeholder: workspacePlaceholder,
helper: workspaceHelper,
error: controller.workspaceError,
onChanged: controller.updateWorkspace,
),
const SizedBox(height: settingsTitleGap),
Wrap(
spacing: settingsControlGap,
runSpacing: settingsFieldGap,
crossAxisAlignment: WrapCrossAlignment.center,
children: <Widget>[
FilledButton.tonal(
key: SettingsKeys.saveWorkspace,
onPressed: save,
child: const Text('Save workspace'),
),
Text(
savedWorkspaceLine(controller.savedWorkspace),
style: settingsTextStyle(context, secondary: true),
),
],
),
if (saveError.isNotEmpty) ...<Widget>[
const SizedBox(height: settingsFieldGap),
Text(saveError, style: settingsTextStyle(context, error: true)),
],
],
),
),
],
);
}
}