545291e04a
- Run rows show a failed run's reason (else its diagnostic's first line, full text in a tooltip) or a short result preview; the Summary leads with "Why it failed". - Run again for succeeded/canceled/interrupted runs opens the New run form pre-filled (prompt, workspace, report format) at the latest version with the original offered. - Run detail and stage tabs show their names; touch shows captions on the Runs header and artifact viewer actions (desktop keeps tooltips). - ErrorNotice maps not connected / server too old / permission / timeout to what to do, raw detail behind Details (Schedules, create chat, Runs, Pipelines banners). - Settings has no Back arrow; Schedules keeps the rail on wide windows; phone Settings leads with Connection and Notifications and has a Jump to topic menu. - Walkthrough: Open Connection (skipped when connected), labelled Copy. - Pluralised counts; no duplicate status/rail names for screen readers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
163 lines
5.5 KiB
Dart
163 lines
5.5 KiB
Dart
import 'dart:math' as math;
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../../../ui/adaptive/glass_bar.dart';
|
|
import '../../../ui/navigation/chevron_pager.dart';
|
|
import '../actions/artifact_file_actions.dart';
|
|
import '../actions/artifact_file_bridge.dart';
|
|
import '../domain/artifact_url.dart';
|
|
import '../domain/gallery_navigation.dart';
|
|
import 'artifact_viewer_fetch.dart';
|
|
|
|
const artifactPreviousKey = ValueKey<String>('artifact-previous');
|
|
const artifactNextKey = ValueKey<String>('artifact-next');
|
|
const artifactFullscreenKey = ValueKey<String>('artifact-fullscreen');
|
|
|
|
/// The viewer's bottom controls: file transfer, Open, Copy link, Full screen
|
|
/// and the pager, in one glass bar above the bottom safe area.
|
|
///
|
|
/// The inline viewer and the full-screen view draw this same bar; in full
|
|
/// screen the Full screen control reads Exit full screen and leaves it.
|
|
class ArtifactViewerBar extends StatelessWidget {
|
|
const ArtifactViewerBar({
|
|
super.key,
|
|
required this.page,
|
|
required this.resolved,
|
|
required this.index,
|
|
required this.count,
|
|
required this.fetch,
|
|
required this.fileBridge,
|
|
this.downloadResolved,
|
|
required this.onOpen,
|
|
required this.onCopy,
|
|
required this.onPrevious,
|
|
required this.onNext,
|
|
this.fullscreen = false,
|
|
this.onFullscreen,
|
|
this.onSendToChat,
|
|
});
|
|
|
|
final PagedArtifact page;
|
|
final ResolvedArtifactUrl? resolved;
|
|
final int index;
|
|
final int count;
|
|
final ArtifactFetch fetch;
|
|
final ArtifactFileBridge fileBridge;
|
|
final ResolvedArtifactUrl? downloadResolved;
|
|
final VoidCallback onOpen;
|
|
final VoidCallback onCopy;
|
|
final VoidCallback onPrevious;
|
|
final VoidCallback onNext;
|
|
|
|
/// Whether this bar is the full-screen view's.
|
|
final bool fullscreen;
|
|
|
|
/// Enters (inline) or leaves (in full screen) the full-screen view; absent,
|
|
/// the control is not drawn.
|
|
final VoidCallback? onFullscreen;
|
|
final VoidCallback? onSendToChat;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final actions = _actions(resolved, onFullscreen);
|
|
final pagerMin = count > 1 ? 2 * GlassBarMetrics.controlExtent() : 0.0;
|
|
final pager = ChevronPager(
|
|
index: index,
|
|
count: count,
|
|
previousLabel: 'Previous artifact',
|
|
nextLabel: 'Next artifact',
|
|
previousKey: artifactPreviousKey,
|
|
nextKey: artifactNextKey,
|
|
onPrevious: pagedIndex(index, -1, count) != index ? onPrevious : null,
|
|
onNext: pagedIndex(index, 1, count) != index ? onNext : null,
|
|
);
|
|
return SafeArea(
|
|
// The SafeArea already lifts the bar by the inherited bottom inset (a
|
|
// shell bar below the pane); adding that clearance again floated the
|
|
// bar far above it.
|
|
top: false,
|
|
minimum: const EdgeInsets.all(8),
|
|
// Without a pager the bar is as wide as its actions, so its last
|
|
// control keeps the same gap from the bar's end as the first.
|
|
child: Align(
|
|
alignment: AlignmentDirectional.centerStart,
|
|
heightFactor: 1,
|
|
child: GlassControlBar(
|
|
child: LayoutBuilder(
|
|
builder: (context, constraints) => Row(
|
|
key: const Key('artifact-viewer-actions'),
|
|
mainAxisSize: count > 1 ? MainAxisSize.max : MainAxisSize.min,
|
|
children: [
|
|
// On a narrow window or at large text the actions scroll
|
|
// sideways, so the chevrons beside them stay whole.
|
|
ConstrainedBox(
|
|
constraints: BoxConstraints(
|
|
maxWidth: math.max(0, constraints.maxWidth - pagerMin),
|
|
),
|
|
child: SingleChildScrollView(
|
|
scrollDirection: Axis.horizontal,
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: actions,
|
|
),
|
|
),
|
|
),
|
|
if (count > 1) Expanded(child: pager),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
List<Widget> _actions(ResolvedArtifactUrl? resolved, VoidCallback? toggle) =>
|
|
[
|
|
if (resolved != null && !resolved.external)
|
|
ArtifactFileActions(
|
|
key: ValueKey<String>(
|
|
'viewer-files-${page.group.stageKey}\u0000'
|
|
'${page.group.visit}\u0000${page.artifact.url}',
|
|
),
|
|
artifact: page.artifact,
|
|
resolved: downloadResolved ?? resolved,
|
|
fetch: fetch,
|
|
bridge: fileBridge,
|
|
compact: true,
|
|
),
|
|
if (resolved != null) ...[
|
|
ArtifactIconAction(
|
|
key: const Key('artifact-open'),
|
|
label: 'Open in browser',
|
|
caption: 'Open',
|
|
icon: Icons.open_in_new,
|
|
onPressed: onOpen,
|
|
),
|
|
ArtifactIconAction(
|
|
key: const Key('artifact-copy-link'),
|
|
label: 'Copy link',
|
|
caption: 'Link',
|
|
icon: Icons.link,
|
|
onPressed: onCopy,
|
|
),
|
|
],
|
|
if (toggle != null)
|
|
ArtifactIconAction(
|
|
key: artifactFullscreenKey,
|
|
label: fullscreen ? 'Exit full screen' : 'Full screen',
|
|
caption: fullscreen ? 'Exit' : 'Expand',
|
|
icon: fullscreen ? Icons.fullscreen_exit : Icons.fullscreen,
|
|
onPressed: toggle,
|
|
),
|
|
if (onSendToChat != null)
|
|
ArtifactIconAction(
|
|
key: const Key('artifact-send-to-chat'),
|
|
label: 'Send to chat…',
|
|
caption: 'To chat',
|
|
icon: Icons.chat_outlined,
|
|
onPressed: onSendToChat!,
|
|
),
|
|
];
|
|
}
|