Merge branch 'run/artifacts-collapsed' into integrate/bars-artifacts
This commit is contained in:
@@ -53,6 +53,7 @@ class ArtifactGalleryPage extends StatefulWidget {
|
|||||||
this.markdownBuilder = chatMarkdownText,
|
this.markdownBuilder = chatMarkdownText,
|
||||||
this.fileBridge = const ArtifactFileBridge(),
|
this.fileBridge = const ArtifactFileBridge(),
|
||||||
this.embedded = false,
|
this.embedded = false,
|
||||||
|
this.initiallyCollapsed = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
final List<JsonMap> steps;
|
final List<JsonMap> steps;
|
||||||
@@ -71,6 +72,10 @@ class ArtifactGalleryPage extends StatefulWidget {
|
|||||||
/// page bar, since the detail already names the run.
|
/// page bar, since the detail already names the run.
|
||||||
final bool embedded;
|
final bool embedded;
|
||||||
|
|
||||||
|
/// Run artifact views opt into collapsed groups; standalone gallery pages
|
||||||
|
/// preserve their established open layout.
|
||||||
|
final bool initiallyCollapsed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ArtifactGalleryPage> createState() => _ArtifactGalleryPageState();
|
State<ArtifactGalleryPage> createState() => _ArtifactGalleryPageState();
|
||||||
}
|
}
|
||||||
@@ -386,6 +391,7 @@ class _ArtifactGalleryPageState extends State<ArtifactGalleryPage> {
|
|||||||
onSelected: _select,
|
onSelected: _select,
|
||||||
configuredEndpoint: widget.configuredEndpoint,
|
configuredEndpoint: widget.configuredEndpoint,
|
||||||
fetch: widget.fetch,
|
fetch: widget.fetch,
|
||||||
|
initiallyCollapsed: widget.initiallyCollapsed,
|
||||||
);
|
);
|
||||||
if (widget.embedded) return body;
|
if (widget.embedded) return body;
|
||||||
if (usesCupertinoHost(context)) {
|
if (usesCupertinoHost(context)) {
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ class ArtifactVisitList extends StatefulWidget {
|
|||||||
this.onSelected,
|
this.onSelected,
|
||||||
this.configuredEndpoint = '',
|
this.configuredEndpoint = '',
|
||||||
this.fetch = fetchArtifact,
|
this.fetch = fetchArtifact,
|
||||||
|
this.initiallyCollapsed = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
final Widget? header;
|
final Widget? header;
|
||||||
@@ -54,6 +55,11 @@ class ArtifactVisitList extends StatefulWidget {
|
|||||||
final String configuredEndpoint;
|
final String configuredEndpoint;
|
||||||
final ArtifactFetch fetch;
|
final ArtifactFetch fetch;
|
||||||
|
|
||||||
|
/// Whether the artifact sections begin closed. Run artifact galleries use
|
||||||
|
/// the default; this remains configurable for composed hosts that explicitly
|
||||||
|
/// want to restore their own open state.
|
||||||
|
final bool initiallyCollapsed;
|
||||||
|
|
||||||
/// The layout last chosen, kept for the app's lifetime.
|
/// The layout last chosen, kept for the app's lifetime.
|
||||||
static ArtifactGalleryMode lastMode = ArtifactGalleryMode.grid;
|
static ArtifactGalleryMode lastMode = ArtifactGalleryMode.grid;
|
||||||
|
|
||||||
@@ -64,8 +70,24 @@ class ArtifactVisitList extends StatefulWidget {
|
|||||||
class _ArtifactVisitListState extends State<ArtifactVisitList> {
|
class _ArtifactVisitListState extends State<ArtifactVisitList> {
|
||||||
ArtifactGalleryMode _mode = ArtifactVisitList.lastMode;
|
ArtifactGalleryMode _mode = ArtifactVisitList.lastMode;
|
||||||
|
|
||||||
/// Sections the operator closed, by their key.
|
/// Sections the operator closed, by their key. Artifact groups start closed
|
||||||
final Set<String> _closed = {};
|
/// so a run with many visits does not open every file list at once.
|
||||||
|
late final Set<String> _closed;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
_closed = widget.initiallyCollapsed
|
||||||
|
? {
|
||||||
|
for (final group in widget.groups)
|
||||||
|
if (group.artifacts.isNotEmpty)
|
||||||
|
'${group.stageKey}\u0000${group.visit}\u0000artifacts',
|
||||||
|
for (final group in widget.groups)
|
||||||
|
if (group.documents.isNotEmpty)
|
||||||
|
'${group.stageKey}\u0000${group.visit}\u0000documents',
|
||||||
|
}
|
||||||
|
: <String>{};
|
||||||
|
}
|
||||||
|
|
||||||
void _toggle(String key) => setState(() {
|
void _toggle(String key) => setState(() {
|
||||||
if (!_closed.remove(key)) _closed.add(key);
|
if (!_closed.remove(key)) _closed.add(key);
|
||||||
|
|||||||
@@ -451,6 +451,7 @@ class _RunDetailTabsState extends State<RunDetailTabs> {
|
|||||||
steps: runDetailArtifactSteps(widget.run),
|
steps: runDetailArtifactSteps(widget.run),
|
||||||
executing: runDetailExecuting(widget.run),
|
executing: runDetailExecuting(widget.run),
|
||||||
configuredEndpoint: widget.configuredEndpoint,
|
configuredEndpoint: widget.configuredEndpoint,
|
||||||
|
initiallyCollapsed: true,
|
||||||
embedded: true,
|
embedded: true,
|
||||||
);
|
);
|
||||||
case RunDetailTab.changes:
|
case RunDetailTab.changes:
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class RunVisitArtifacts extends StatelessWidget {
|
|||||||
steps: runSteps.isEmpty ? <JsonMap>[step] : runSteps,
|
steps: runSteps.isEmpty ? <JsonMap>[step] : runSteps,
|
||||||
focusIndex: runSteps.isEmpty ? 0 : visitIndex,
|
focusIndex: runSteps.isEmpty ? 0 : visitIndex,
|
||||||
configuredEndpoint: configuredEndpoint,
|
configuredEndpoint: configuredEndpoint,
|
||||||
|
initiallyCollapsed: true,
|
||||||
embedded: true,
|
embedded: true,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ Widget artifactListHost({
|
|||||||
groups: groups,
|
groups: groups,
|
||||||
selectedIdentity: selectedIdentity,
|
selectedIdentity: selectedIdentity,
|
||||||
onSelected: onSelected,
|
onSelected: onSelected,
|
||||||
|
initiallyCollapsed: false,
|
||||||
);
|
);
|
||||||
Widget scaled(BuildContext context, Widget? child) => MediaQuery(
|
Widget scaled(BuildContext context, Widget? child) => MediaQuery(
|
||||||
data: MediaQuery.of(
|
data: MediaQuery.of(
|
||||||
|
|||||||
@@ -1,13 +1,41 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:pipelines_app/features/artifacts/ui/artifact_tile.dart';
|
import 'package:pipelines_app/features/artifacts/ui/artifact_tile.dart';
|
||||||
import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart';
|
import 'package:pipelines_app/features/artifacts/domain/artifact_groups.dart';
|
||||||
import 'package:pipelines_app/features/artifacts/domain/artifact_record.dart';
|
import 'package:pipelines_app/features/artifacts/domain/artifact_record.dart';
|
||||||
import 'package:pipelines_app/features/artifacts/ui/artifact_visit_list.dart';
|
import 'package:pipelines_app/features/artifacts/ui/artifact_visit_list.dart';
|
||||||
|
import 'package:pipelines_app/ui/layout/sticky_section.dart';
|
||||||
|
|
||||||
import 'artifact_visit_list_fixture.dart';
|
import 'artifact_visit_list_fixture.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
for (final cupertino in [false, true]) {
|
||||||
|
testWidgets(
|
||||||
|
'${cupertino ? 'Cupertino' : 'Material'} artifact groups start collapsed and expand',
|
||||||
|
(tester) async {
|
||||||
|
final group = visitGroup(artifacts: [recordedArtifact('result.csv')]);
|
||||||
|
await tester.pumpWidget(
|
||||||
|
cupertino
|
||||||
|
? CupertinoApp(
|
||||||
|
home: CupertinoPageScaffold(
|
||||||
|
child: ArtifactVisitList(groups: [group]),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: MaterialApp(
|
||||||
|
home: Scaffold(body: ArtifactVisitList(groups: [group])),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
expect(find.byType(ArtifactTile), findsNothing);
|
||||||
|
expect(find.bySemanticsLabel('review · visit 1'), findsOneWidget);
|
||||||
|
|
||||||
|
await tester.tap(find.byType(StickySectionTitle));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
expect(find.byType(ArtifactTile), findsOneWidget);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
test('a shared filename in two visits has distinct identities', () {
|
test('a shared filename in two visits has distinct identities', () {
|
||||||
const url = '/artifacts/7/result.csv';
|
const url = '/artifacts/7/result.csv';
|
||||||
final first = visitGroup(
|
final first = visitGroup(
|
||||||
@@ -248,6 +276,7 @@ void main() {
|
|||||||
body: ArtifactVisitList(
|
body: ArtifactVisitList(
|
||||||
groups: [group],
|
groups: [group],
|
||||||
header: const Text('Artifacts · 1 recorded'),
|
header: const Text('Artifacts · 1 recorded'),
|
||||||
|
initiallyCollapsed: false,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import 'package:pipelines_app/core/api_gateway.dart';
|
|||||||
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
|
import 'package:pipelines_app/features/runs/data/runs_repository.dart';
|
||||||
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
import 'package:pipelines_app/features/runs/ui/run_detail_view.dart';
|
||||||
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
import 'package:pipelines_app/features/runs/ui/runs_controller.dart';
|
||||||
|
import 'package:pipelines_app/ui/layout/sticky_section.dart';
|
||||||
|
|
||||||
import '../../artifacts/domain/artifact_fixtures.dart';
|
import '../../artifacts/domain/artifact_fixtures.dart';
|
||||||
|
|
||||||
@@ -113,6 +114,11 @@ void main() {
|
|||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts')));
|
await tester.tap(find.byKey(const ValueKey('run-detail-tab-artifacts')));
|
||||||
await tester.pumpAndSettle();
|
await tester.pumpAndSettle();
|
||||||
|
final sections = find.byType(StickySectionTitle);
|
||||||
|
for (var index = 0; index < sections.evaluate().length; index += 1) {
|
||||||
|
await tester.tap(sections.at(index));
|
||||||
|
}
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
expect(find.text('Artifacts · 2 recorded'), findsOneWidget);
|
expect(find.text('Artifacts · 2 recorded'), findsOneWidget);
|
||||||
expect(find.text('build.log'), findsOneWidget);
|
expect(find.text('build.log'), findsOneWidget);
|
||||||
|
|||||||
@@ -6,10 +6,19 @@ import 'package:pipelines_app/features/graph/widgets/stage_definition_view.dart'
|
|||||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_facts.dart';
|
import 'package:pipelines_app/features/runs/ui/run_detail_visit_facts.dart';
|
||||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart';
|
import 'package:pipelines_app/features/runs/ui/run_detail_visit_sections.dart';
|
||||||
import 'package:pipelines_app/features/runs/ui/run_detail_visit_session_state.dart';
|
import 'package:pipelines_app/features/runs/ui/run_detail_visit_session_state.dart';
|
||||||
|
import 'package:pipelines_app/ui/layout/sticky_section.dart';
|
||||||
|
|
||||||
import 'run_detail_graph_support.dart';
|
import 'run_detail_graph_support.dart';
|
||||||
import 'run_detail_visit_support.dart';
|
import 'run_detail_visit_support.dart';
|
||||||
|
|
||||||
|
Future<void> _expandArtifactGroup(WidgetTester tester) async {
|
||||||
|
final sections = find.byType(StickySectionTitle);
|
||||||
|
for (var index = 0; index < sections.evaluate().length; index += 1) {
|
||||||
|
await tester.tap(sections.at(index));
|
||||||
|
}
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
for (final platform in RunDetailTestPlatform.values) {
|
for (final platform in RunDetailTestPlatform.values) {
|
||||||
testWidgets('${platform.name} stage tabs sit at the bottom with one Back', (
|
testWidgets('${platform.name} stage tabs sit at the bottom with one Back', (
|
||||||
@@ -71,6 +80,7 @@ void main() {
|
|||||||
await openVisitTab(tester, RunVisitSection.artifacts);
|
await openVisitTab(tester, RunVisitSection.artifacts);
|
||||||
// The section is the run's gallery, focused on this visit: exactly the
|
// The section is the run's gallery, focused on this visit: exactly the
|
||||||
// stage's files, without the session evidence file.
|
// stage's files, without the session evidence file.
|
||||||
|
await _expandArtifactGroup(tester);
|
||||||
expect(find.byType(ArtifactGalleryPage), findsOneWidget);
|
expect(find.byType(ArtifactGalleryPage), findsOneWidget);
|
||||||
expect(find.text('plan.csv'), findsOneWidget);
|
expect(find.text('plan.csv'), findsOneWidget);
|
||||||
expect(find.text('session.html'), findsNothing);
|
expect(find.text('session.html'), findsNothing);
|
||||||
@@ -185,6 +195,7 @@ void main() {
|
|||||||
await openVisit(tester, platform, run: run, sequence: 2);
|
await openVisit(tester, platform, run: run, sequence: 2);
|
||||||
expectVisitHeading(tester, 'plan', 2);
|
expectVisitHeading(tester, 'plan', 2);
|
||||||
await openVisitTab(tester, RunVisitSection.artifacts);
|
await openVisitTab(tester, RunVisitSection.artifacts);
|
||||||
|
await _expandArtifactGroup(tester);
|
||||||
expect(find.text('plan-2.csv'), findsOneWidget);
|
expect(find.text('plan-2.csv'), findsOneWidget);
|
||||||
expect(find.text('public/shared.csv'), findsNothing);
|
expect(find.text('public/shared.csv'), findsNothing);
|
||||||
expect(find.byType(ArtifactGalleryPage), findsOneWidget);
|
expect(find.byType(ArtifactGalleryPage), findsOneWidget);
|
||||||
|
|||||||
Reference in New Issue
Block a user