wip(app): runs-pipeline-url (retained from the cancelled overrun lane)
This commit is contained in:
@@ -289,6 +289,8 @@ class _PipelinesAppState extends State<PipelinesApp>
|
|||||||
server: widget.server,
|
server: widget.server,
|
||||||
refreshToken: _pipelinesRefresh,
|
refreshToken: _pipelinesRefresh,
|
||||||
onRunStarted: _runStarted,
|
onRunStarted: _runStarted,
|
||||||
|
onViewPipelineRuns: (id) =>
|
||||||
|
_delegate.goTo(AppRoute.runsForPipeline(id)),
|
||||||
initialPipelineId: route.pipelineId,
|
initialPipelineId: route.pipelineId,
|
||||||
initialVersion: route.version,
|
initialVersion: route.version,
|
||||||
initialStageKey: route.stageKey,
|
initialStageKey: route.stageKey,
|
||||||
@@ -302,13 +304,19 @@ class _PipelinesAppState extends State<PipelinesApp>
|
|||||||
session: _session,
|
session: _session,
|
||||||
server: widget.server,
|
server: widget.server,
|
||||||
initialRunId: route.runId,
|
initialRunId: route.runId,
|
||||||
|
initialPipelineId: route.pipelineId,
|
||||||
initialStageKey: route.stageKey,
|
initialStageKey: route.stageKey,
|
||||||
initialVisit: route.visit,
|
initialVisit: route.visit,
|
||||||
initialDecide: route.decide,
|
initialDecide: route.decide,
|
||||||
listRefreshToken: _runsRefresh,
|
listRefreshToken: _runsRefresh,
|
||||||
notifications: _notifications,
|
notifications: _notifications,
|
||||||
onRunSelected: (id) => _delegate.goTo(AppRoute.run(id)),
|
onRunSelected: (id) => _delegate.goTo(AppRoute.run(id)),
|
||||||
onBack: () => _delegate.goTo(AppRoute.runs),
|
onBack: (id) => _delegate.goTo(
|
||||||
|
id == null ? AppRoute.runs : AppRoute.runsForPipeline(id),
|
||||||
|
),
|
||||||
|
onPipelineFilterChanged: (id) => _delegate.goTo(
|
||||||
|
id == null ? AppRoute.runs : AppRoute.runsForPipeline(id),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
AppDestination.chat: (_) => ChatDestination(
|
AppDestination.chat: (_) => ChatDestination(
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class PipelinesDestination extends StatelessWidget {
|
|||||||
required this.server,
|
required this.server,
|
||||||
this.refreshToken = 0,
|
this.refreshToken = 0,
|
||||||
this.onRunStarted,
|
this.onRunStarted,
|
||||||
|
this.onViewPipelineRuns,
|
||||||
this.initialPipelineId,
|
this.initialPipelineId,
|
||||||
this.initialVersion = 0,
|
this.initialVersion = 0,
|
||||||
this.initialStageKey,
|
this.initialStageKey,
|
||||||
@@ -34,6 +35,7 @@ class PipelinesDestination extends StatelessWidget {
|
|||||||
|
|
||||||
/// Receives the run id an accepted launch named; the shell opens that route.
|
/// Receives the run id an accepted launch named; the shell opens that route.
|
||||||
final ValueChanged<int>? onRunStarted;
|
final ValueChanged<int>? onRunStarted;
|
||||||
|
final ValueChanged<int>? onViewPipelineRuns;
|
||||||
|
|
||||||
/// The pipeline and pinned version a deep link names.
|
/// The pipeline and pinned version a deep link names.
|
||||||
final int? initialPipelineId;
|
final int? initialPipelineId;
|
||||||
@@ -77,6 +79,7 @@ class PipelinesDestination extends StatelessWidget {
|
|||||||
gateway: session.gateway,
|
gateway: session.gateway,
|
||||||
embedded: true,
|
embedded: true,
|
||||||
onRunStarted: onRunStarted,
|
onRunStarted: onRunStarted,
|
||||||
|
onViewPipelineRuns: onViewPipelineRuns,
|
||||||
initialPipelineId: initialPipelineId,
|
initialPipelineId: initialPipelineId,
|
||||||
initialVersion: initialVersion,
|
initialVersion: initialVersion,
|
||||||
initialStageKey: initialStageKey,
|
initialStageKey: initialStageKey,
|
||||||
|
|||||||
@@ -19,11 +19,13 @@ class RunsDestination extends StatelessWidget {
|
|||||||
required this.session,
|
required this.session,
|
||||||
required this.server,
|
required this.server,
|
||||||
this.initialRunId,
|
this.initialRunId,
|
||||||
|
this.initialPipelineId,
|
||||||
this.initialStageKey,
|
this.initialStageKey,
|
||||||
this.initialVisit,
|
this.initialVisit,
|
||||||
this.initialDecide = false,
|
this.initialDecide = false,
|
||||||
this.onRunSelected,
|
this.onRunSelected,
|
||||||
this.onBack,
|
this.onBack,
|
||||||
|
this.onPipelineFilterChanged,
|
||||||
this.listRefreshToken = 0,
|
this.listRefreshToken = 0,
|
||||||
this.notifications,
|
this.notifications,
|
||||||
});
|
});
|
||||||
@@ -31,6 +33,7 @@ class RunsDestination extends StatelessWidget {
|
|||||||
final AppSession session;
|
final AppSession session;
|
||||||
final ServerEndpoint server;
|
final ServerEndpoint server;
|
||||||
final int? initialRunId;
|
final int? initialRunId;
|
||||||
|
final int? initialPipelineId;
|
||||||
|
|
||||||
/// The stage key and optional visit a `/runs/:id/stage/:key[?visit=N]` route
|
/// The stage key and optional visit a `/runs/:id/stage/:key[?visit=N]` route
|
||||||
/// names. They reach the detail only through [RunsScreen]; the destination
|
/// names. They reach the detail only through [RunsScreen]; the destination
|
||||||
@@ -43,7 +46,8 @@ class RunsDestination extends StatelessWidget {
|
|||||||
final bool initialDecide;
|
final bool initialDecide;
|
||||||
|
|
||||||
final ValueChanged<int>? onRunSelected;
|
final ValueChanged<int>? onRunSelected;
|
||||||
final VoidCallback? onBack;
|
final ValueChanged<int?>? onBack;
|
||||||
|
final ValueChanged<int?>? onPipelineFilterChanged;
|
||||||
|
|
||||||
/// Advances when a launch was accepted elsewhere. The mounted Runs screen
|
/// Advances when a launch was accepted elsewhere. The mounted Runs screen
|
||||||
/// re-reads its list once; no row is inserted locally.
|
/// re-reads its list once; no row is inserted locally.
|
||||||
@@ -87,6 +91,7 @@ class RunsDestination extends StatelessWidget {
|
|||||||
Widget _runsScreen() => RunsScreen(
|
Widget _runsScreen() => RunsScreen(
|
||||||
gateway: session.gateway,
|
gateway: session.gateway,
|
||||||
initialRunId: initialRunId,
|
initialRunId: initialRunId,
|
||||||
|
initialPipelineId: initialPipelineId,
|
||||||
initialStageKey: initialStageKey,
|
initialStageKey: initialStageKey,
|
||||||
initialVisit: initialVisit,
|
initialVisit: initialVisit,
|
||||||
initialDecide: initialDecide,
|
initialDecide: initialDecide,
|
||||||
@@ -95,5 +100,6 @@ class RunsDestination extends StatelessWidget {
|
|||||||
notifications: notifications,
|
notifications: notifications,
|
||||||
onRunSelected: onRunSelected,
|
onRunSelected: onRunSelected,
|
||||||
onBack: onBack,
|
onBack: onBack,
|
||||||
|
onPipelineFilterChanged: onPipelineFilterChanged,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class PipelinesScreen extends StatefulWidget {
|
|||||||
this.embedded = false,
|
this.embedded = false,
|
||||||
this.syncToken = 0,
|
this.syncToken = 0,
|
||||||
this.onRunStarted,
|
this.onRunStarted,
|
||||||
|
this.onViewPipelineRuns,
|
||||||
this.initialPipelineId,
|
this.initialPipelineId,
|
||||||
this.initialVersion = 0,
|
this.initialVersion = 0,
|
||||||
this.initialStageKey,
|
this.initialStageKey,
|
||||||
@@ -45,6 +46,7 @@ class PipelinesScreen extends StatefulWidget {
|
|||||||
/// Receives the run id an accepted launch names, so the composition can open
|
/// Receives the run id an accepted launch names, so the composition can open
|
||||||
/// the existing run route. The feature never navigates on its own.
|
/// the existing run route. The feature never navigates on its own.
|
||||||
final ValueChanged<int>? onRunStarted;
|
final ValueChanged<int>? onRunStarted;
|
||||||
|
final ValueChanged<int>? onViewPipelineRuns;
|
||||||
|
|
||||||
/// The pipeline a deep link names, opened after the list read starts.
|
/// The pipeline a deep link names, opened after the list read starts.
|
||||||
final int? initialPipelineId;
|
final int? initialPipelineId;
|
||||||
@@ -170,6 +172,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
|||||||
gateway: widget.gateway,
|
gateway: widget.gateway,
|
||||||
showBack: true,
|
showBack: true,
|
||||||
onRunStarted: widget.onRunStarted,
|
onRunStarted: widget.onRunStarted,
|
||||||
|
onViewPipelineRuns: widget.onViewPipelineRuns,
|
||||||
stageKey: stageKey,
|
stageKey: stageKey,
|
||||||
stagePipelineId: widget.initialPipelineId,
|
stagePipelineId: widget.initialPipelineId,
|
||||||
stageVersion: widget.initialVersion,
|
stageVersion: widget.initialVersion,
|
||||||
@@ -192,6 +195,7 @@ class _PipelinesScreenState extends State<PipelinesScreen> {
|
|||||||
gateway: widget.gateway,
|
gateway: widget.gateway,
|
||||||
showBack: false,
|
showBack: false,
|
||||||
onRunStarted: widget.onRunStarted,
|
onRunStarted: widget.onRunStarted,
|
||||||
|
onViewPipelineRuns: widget.onViewPipelineRuns,
|
||||||
stageKey: stageKey,
|
stageKey: stageKey,
|
||||||
stagePipelineId: widget.initialPipelineId,
|
stagePipelineId: widget.initialPipelineId,
|
||||||
stageVersion: widget.initialVersion,
|
stageVersion: widget.initialVersion,
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class PipelineDetailPanel extends StatefulWidget {
|
|||||||
required this.gateway,
|
required this.gateway,
|
||||||
required this.showBack,
|
required this.showBack,
|
||||||
this.onRunStarted,
|
this.onRunStarted,
|
||||||
|
this.onViewPipelineRuns,
|
||||||
this.stageKey,
|
this.stageKey,
|
||||||
this.stagePipelineId,
|
this.stagePipelineId,
|
||||||
this.stageVersion = 0,
|
this.stageVersion = 0,
|
||||||
@@ -45,6 +46,7 @@ class PipelineDetailPanel extends StatefulWidget {
|
|||||||
|
|
||||||
/// A run started from this detail's Run action; receives the server's id.
|
/// A run started from this detail's Run action; receives the server's id.
|
||||||
final ValueChanged<int>? onRunStarted;
|
final ValueChanged<int>? onRunStarted;
|
||||||
|
final ValueChanged<int>? onViewPipelineRuns;
|
||||||
|
|
||||||
/// The stage the route names for this detail, or null when it names none.
|
/// The stage the route names for this detail, or null when it names none.
|
||||||
final String? stageKey;
|
final String? stageKey;
|
||||||
@@ -337,6 +339,25 @@ class _PipelineDetailPanelState extends State<PipelineDetailPanel> {
|
|||||||
onRunStarted: widget.onRunStarted,
|
onRunStarted: widget.onRunStarted,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Align(
|
||||||
|
alignment: AlignmentDirectional.centerStart,
|
||||||
|
child: Semantics(
|
||||||
|
button: true,
|
||||||
|
label: detail.name.trim().isEmpty
|
||||||
|
? 'View runs of this pipeline'
|
||||||
|
: 'View runs of ${detail.name}',
|
||||||
|
child: ExcludeSemantics(
|
||||||
|
child: TextButton.icon(
|
||||||
|
onPressed: widget.onViewPipelineRuns == null
|
||||||
|
? null
|
||||||
|
: () => widget.onViewPipelineRuns!(detail.id),
|
||||||
|
icon: const Icon(Icons.list_alt),
|
||||||
|
label: const Text('Runs'),
|
||||||
|
key: const Key('pipeline-view-runs'),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class RunsScreen extends StatefulWidget {
|
|||||||
super.key,
|
super.key,
|
||||||
required this.gateway,
|
required this.gateway,
|
||||||
this.initialRunId,
|
this.initialRunId,
|
||||||
|
this.initialPipelineId,
|
||||||
this.initialStageKey,
|
this.initialStageKey,
|
||||||
this.initialVisit,
|
this.initialVisit,
|
||||||
this.initialDecide = false,
|
this.initialDecide = false,
|
||||||
@@ -31,6 +32,7 @@ class RunsScreen extends StatefulWidget {
|
|||||||
this.listRefreshToken = 0,
|
this.listRefreshToken = 0,
|
||||||
this.onRunSelected,
|
this.onRunSelected,
|
||||||
this.onBack,
|
this.onBack,
|
||||||
|
this.onPipelineFilterChanged,
|
||||||
this.attentionStore = const SharedPreferencesAttentionStore(),
|
this.attentionStore = const SharedPreferencesAttentionStore(),
|
||||||
this.attentionNow,
|
this.attentionNow,
|
||||||
this.notifications,
|
this.notifications,
|
||||||
@@ -40,6 +42,7 @@ class RunsScreen extends StatefulWidget {
|
|||||||
|
|
||||||
/// The run the current route names, or null for the list.
|
/// The run the current route names, or null for the list.
|
||||||
final int? initialRunId;
|
final int? initialRunId;
|
||||||
|
final int? initialPipelineId;
|
||||||
|
|
||||||
/// The recorded stage visit the route names inside [initialRunId]. The detail
|
/// The recorded stage visit the route names inside [initialRunId]. The detail
|
||||||
/// applies it once per route target; the feature never invents a visit.
|
/// applies it once per route target; the feature never invents a visit.
|
||||||
@@ -60,7 +63,8 @@ class RunsScreen extends StatefulWidget {
|
|||||||
final int listRefreshToken;
|
final int listRefreshToken;
|
||||||
|
|
||||||
final ValueChanged<int>? onRunSelected;
|
final ValueChanged<int>? onRunSelected;
|
||||||
final VoidCallback? onBack;
|
final ValueChanged<int?>? onBack;
|
||||||
|
final ValueChanged<int?>? onPipelineFilterChanged;
|
||||||
|
|
||||||
/// Persisted attention dismissals and the clock for its local-day window.
|
/// Persisted attention dismissals and the clock for its local-day window.
|
||||||
/// The app uses SharedPreferences; tests and fixtures inject a memory store.
|
/// The app uses SharedPreferences; tests and fixtures inject a memory store.
|
||||||
@@ -77,6 +81,8 @@ class RunsScreen extends StatefulWidget {
|
|||||||
class _RunsScreenState extends State<RunsScreen> {
|
class _RunsScreenState extends State<RunsScreen> {
|
||||||
late final RunsController controller;
|
late final RunsController controller;
|
||||||
num? _shownRunId;
|
num? _shownRunId;
|
||||||
|
int? _reportedPipelineId;
|
||||||
|
bool _applyingRoutePipeline = false;
|
||||||
|
|
||||||
/// The route's decision request is one-shot: the first loaded detail for the
|
/// The route's decision request is one-shot: the first loaded detail for the
|
||||||
/// named run consumes it, whether or not that run is waiting.
|
/// named run consumes it, whether or not that run is waiting.
|
||||||
@@ -86,8 +92,14 @@ class _RunsScreenState extends State<RunsScreen> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
controller = RunsController(RunsRepository(widget.gateway));
|
controller = RunsController(RunsRepository(widget.gateway));
|
||||||
|
_reportedPipelineId = widget.initialPipelineId;
|
||||||
|
if (widget.initialPipelineId != null) {
|
||||||
|
controller.clearFilters();
|
||||||
|
controller.setPipeline(widget.initialPipelineId);
|
||||||
|
}
|
||||||
controller.listen(widget.gateway.frames);
|
controller.listen(widget.gateway.frames);
|
||||||
controller.addListener(_selectionChanged);
|
controller.addListener(_selectionChanged);
|
||||||
|
controller.addListener(_pipelineFilterChanged);
|
||||||
controller.addListener(_detailChanged);
|
controller.addListener(_detailChanged);
|
||||||
controller.load(widget.initialRunId);
|
controller.load(widget.initialRunId);
|
||||||
}
|
}
|
||||||
@@ -99,6 +111,21 @@ class _RunsScreenState extends State<RunsScreen> {
|
|||||||
widget.initialDecide != oldWidget.initialDecide) {
|
widget.initialDecide != oldWidget.initialDecide) {
|
||||||
_decideConsumed = false;
|
_decideConsumed = false;
|
||||||
}
|
}
|
||||||
|
if (widget.initialPipelineId != oldWidget.initialPipelineId) {
|
||||||
|
final id = widget.initialPipelineId;
|
||||||
|
// A run detail replaces the list URL but retains its active list filter.
|
||||||
|
// Only a route back to the list can explicitly clear that facet.
|
||||||
|
if (id != null || widget.initialRunId == null) {
|
||||||
|
_applyingRoutePipeline = true;
|
||||||
|
try {
|
||||||
|
if (id != null) controller.clearFilters();
|
||||||
|
controller.setPipeline(id);
|
||||||
|
_reportedPipelineId = id;
|
||||||
|
} finally {
|
||||||
|
_applyingRoutePipeline = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (widget.syncToken != oldWidget.syncToken) {
|
if (widget.syncToken != oldWidget.syncToken) {
|
||||||
controller.resync();
|
controller.resync();
|
||||||
}
|
}
|
||||||
@@ -132,6 +159,19 @@ class _RunsScreenState extends State<RunsScreen> {
|
|||||||
if (mounted) setState(() {});
|
if (mounted) setState(() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _pipelineFilterChanged() {
|
||||||
|
final id = controller.pipelineId;
|
||||||
|
if (_applyingRoutePipeline) {
|
||||||
|
_reportedPipelineId = id;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (id == _reportedPipelineId) return;
|
||||||
|
_reportedPipelineId = id;
|
||||||
|
if (controller.selectedRunId == null) {
|
||||||
|
widget.onPipelineFilterChanged?.call(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Opens the route's decision prompt after the named detail has arrived.
|
/// Opens the route's decision prompt after the named detail has arrived.
|
||||||
/// A non-waiting run consumes the request without a prompt, and the prompt
|
/// A non-waiting run consumes the request without a prompt, and the prompt
|
||||||
/// itself only closes; the detail underneath is left as it is.
|
/// itself only closes; the detail underneath is left as it is.
|
||||||
@@ -166,12 +206,13 @@ class _RunsScreenState extends State<RunsScreen> {
|
|||||||
|
|
||||||
void _back() {
|
void _back() {
|
||||||
controller.back();
|
controller.back();
|
||||||
widget.onBack?.call();
|
widget.onBack?.call(controller.pipelineId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
controller.removeListener(_selectionChanged);
|
controller.removeListener(_selectionChanged);
|
||||||
|
controller.removeListener(_pipelineFilterChanged);
|
||||||
controller.removeListener(_detailChanged);
|
controller.removeListener(_detailChanged);
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
|
|||||||
@@ -37,6 +37,23 @@ class RunsFilters extends StatelessWidget {
|
|||||||
Widget _materialToolbar(int count) => Row(
|
Widget _materialToolbar(int count) => Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
|
PopupMenuButton<_FilterChoice>(
|
||||||
|
tooltip: 'Filter by pipeline',
|
||||||
|
onSelected: _apply,
|
||||||
|
itemBuilder: (context) => [
|
||||||
|
const PopupMenuItem(
|
||||||
|
value: (kind: 'pipeline', value: ''),
|
||||||
|
child: Text('Any pipeline'),
|
||||||
|
),
|
||||||
|
for (final pipeline in _pipelines)
|
||||||
|
CheckedPopupMenuItem(
|
||||||
|
value: (kind: 'pipeline', value: '${pipeline.$1}'),
|
||||||
|
checked: controller.pipelineId == pipeline.$1,
|
||||||
|
child: Text(pipeline.$2),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
child: _materialButton(Icons.account_tree_outlined, 'Pipeline'),
|
||||||
|
),
|
||||||
PopupMenuButton<_FilterChoice>(
|
PopupMenuButton<_FilterChoice>(
|
||||||
tooltip: count > 0
|
tooltip: count > 0
|
||||||
? '$count active ${count == 1 ? 'filter' : 'filters'}'
|
? '$count active ${count == 1 ? 'filter' : 'filters'}'
|
||||||
@@ -102,6 +119,12 @@ class RunsFilters extends StatelessWidget {
|
|||||||
];
|
];
|
||||||
|
|
||||||
void _apply(_FilterChoice choice) {
|
void _apply(_FilterChoice choice) {
|
||||||
|
if (choice.kind == 'pipeline') {
|
||||||
|
controller.setPipeline(
|
||||||
|
choice.value.isEmpty ? null : int.parse(choice.value),
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (choice.kind == 'status') {
|
if (choice.kind == 'status') {
|
||||||
controller.setStatus(choice.value);
|
controller.setStatus(choice.value);
|
||||||
} else if (choice.kind == 'schedule') {
|
} else if (choice.kind == 'schedule') {
|
||||||
@@ -111,6 +134,19 @@ class RunsFilters extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<(int, String)> get _pipelines {
|
||||||
|
final names = <int, String>{};
|
||||||
|
for (final run in controller.runs) {
|
||||||
|
final rawId = run['pipeline_id'];
|
||||||
|
final id = rawId is num ? rawId.toInt() : int.tryParse('$rawId');
|
||||||
|
if (id == null || id <= 0) continue;
|
||||||
|
final name = '${run['name'] ?? ''}'.trim();
|
||||||
|
names.putIfAbsent(id, () => name.isEmpty ? 'Pipeline $id' : name);
|
||||||
|
}
|
||||||
|
return names.entries.map((entry) => (entry.key, entry.value)).toList()
|
||||||
|
..sort((a, b) => a.$2.toLowerCase().compareTo(b.$2.toLowerCase()));
|
||||||
|
}
|
||||||
|
|
||||||
Widget _cupertinoToolbar(BuildContext context, int count) => Row(
|
Widget _cupertinoToolbar(BuildContext context, int count) => Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
@@ -148,6 +184,17 @@ class RunsFilters extends StatelessWidget {
|
|||||||
builder: (context, _) => CupertinoActionSheet(
|
builder: (context, _) => CupertinoActionSheet(
|
||||||
title: const Text('Filter runs'),
|
title: const Text('Filter runs'),
|
||||||
actions: [
|
actions: [
|
||||||
|
CupertinoActionSheetAction(
|
||||||
|
onPressed: () => controller.setPipeline(null),
|
||||||
|
child: const Text('Any pipeline'),
|
||||||
|
),
|
||||||
|
for (final pipeline in _pipelines)
|
||||||
|
CupertinoActionSheetAction(
|
||||||
|
onPressed: () => controller.setPipeline(pipeline.$1),
|
||||||
|
child: Text(
|
||||||
|
'${controller.pipelineId == pipeline.$1 ? '✓ ' : ''}${pipeline.$2}',
|
||||||
|
),
|
||||||
|
),
|
||||||
for (final status in runStates)
|
for (final status in runStates)
|
||||||
CupertinoActionSheetAction(
|
CupertinoActionSheetAction(
|
||||||
onPressed: () => controller.setStatus(status),
|
onPressed: () => controller.setStatus(status),
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ Widget materialApp(
|
|||||||
ServerEndpoint server, {
|
ServerEndpoint server, {
|
||||||
int? initialRunId,
|
int? initialRunId,
|
||||||
ValueChanged<int>? onRunSelected,
|
ValueChanged<int>? onRunSelected,
|
||||||
VoidCallback? onBack,
|
ValueChanged<int?>? onBack,
|
||||||
}) => MaterialApp(
|
}) => MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: RunsDestination(
|
body: RunsDestination(
|
||||||
|
|||||||
@@ -86,6 +86,30 @@ void main() {
|
|||||||
expect(find.text('Viewing v1 (latest v2).'), findsNothing);
|
expect(find.text('Viewing v1 (latest v2).'), findsNothing);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('detail Runs action names and opens that pipeline filter', (
|
||||||
|
tester,
|
||||||
|
) async {
|
||||||
|
final fixture = PipelineFixture();
|
||||||
|
final gateway = gatewayFor(fixture);
|
||||||
|
final opened = <int>[];
|
||||||
|
tester.view.physicalSize = const Size(1100, 900);
|
||||||
|
tester.view.devicePixelRatio = 1;
|
||||||
|
addTearDown(tester.view.resetPhysicalSize);
|
||||||
|
addTearDown(tester.view.resetDevicePixelRatio);
|
||||||
|
await tester.pumpWidget(
|
||||||
|
MaterialApp(
|
||||||
|
home: PipelinesScreen(gateway: gateway, onViewPipelineRuns: opened.add),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
await tester.tap(find.byKey(const Key('pipeline-row-1')));
|
||||||
|
await tester.pumpAndSettle();
|
||||||
|
|
||||||
|
expect(find.bySemanticsLabel('View runs of Alpha review'), findsOneWidget);
|
||||||
|
await tester.tap(find.byKey(const Key('pipeline-view-runs')));
|
||||||
|
expect(opened, [1]);
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('refresh keeps the selected row and its detail', (tester) async {
|
testWidgets('refresh keeps the selected row and its detail', (tester) async {
|
||||||
final fixture = PipelineFixture();
|
final fixture = PipelineFixture();
|
||||||
final gateway = gatewayFor(fixture);
|
final gateway = gatewayFor(fixture);
|
||||||
|
|||||||
@@ -46,17 +46,21 @@ const _runs = [
|
|||||||
Widget _materialScreen(
|
Widget _materialScreen(
|
||||||
_Gateway gateway, {
|
_Gateway gateway, {
|
||||||
int? initialRunId,
|
int? initialRunId,
|
||||||
|
int? initialPipelineId,
|
||||||
int syncToken = 0,
|
int syncToken = 0,
|
||||||
ValueChanged<int>? onRunSelected,
|
ValueChanged<int>? onRunSelected,
|
||||||
VoidCallback? onBack,
|
ValueChanged<int?>? onBack,
|
||||||
|
ValueChanged<int?>? onPipelineFilterChanged,
|
||||||
}) => MaterialApp(
|
}) => MaterialApp(
|
||||||
home: Scaffold(
|
home: Scaffold(
|
||||||
body: RunsScreen(
|
body: RunsScreen(
|
||||||
gateway: gateway,
|
gateway: gateway,
|
||||||
initialRunId: initialRunId,
|
initialRunId: initialRunId,
|
||||||
|
initialPipelineId: initialPipelineId,
|
||||||
syncToken: syncToken,
|
syncToken: syncToken,
|
||||||
onRunSelected: onRunSelected,
|
onRunSelected: onRunSelected,
|
||||||
onBack: onBack,
|
onBack: onBack,
|
||||||
|
onPipelineFilterChanged: onPipelineFilterChanged,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -149,12 +153,12 @@ void main() {
|
|||||||
tester,
|
tester,
|
||||||
) async {
|
) async {
|
||||||
int? selected;
|
int? selected;
|
||||||
var backs = 0;
|
int? backedPipeline;
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
_materialScreen(
|
_materialScreen(
|
||||||
gateway,
|
gateway,
|
||||||
onRunSelected: (id) => selected = id,
|
onRunSelected: (id) => selected = id,
|
||||||
onBack: () => backs++,
|
onBack: (id) => backedPipeline = id,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
await _mountList(tester, gateway);
|
await _mountList(tester, gateway);
|
||||||
@@ -167,10 +171,60 @@ void main() {
|
|||||||
|
|
||||||
await tester.tap(find.text('Back to list'));
|
await tester.tap(find.text('Back to list'));
|
||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(backs, 1);
|
expect(backedPipeline, isNull);
|
||||||
expect(find.text('Alpha run'), findsOneWidget);
|
expect(find.text('Alpha run'), findsOneWidget);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets(
|
||||||
|
'pipeline route shows its chip and clearing reports the URL change',
|
||||||
|
(tester) async {
|
||||||
|
int? changedPipeline = 3;
|
||||||
|
await tester.pumpWidget(
|
||||||
|
_materialScreen(
|
||||||
|
gateway,
|
||||||
|
initialPipelineId: 3,
|
||||||
|
onPipelineFilterChanged: (id) => changedPipeline = id,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await _mountList(tester, gateway);
|
||||||
|
|
||||||
|
expect(find.text('Pipeline 3'), findsOneWidget);
|
||||||
|
expect(changedPipeline, 3);
|
||||||
|
await tester.tap(find.byTooltip('Clear filter: Pipeline 3'));
|
||||||
|
await tester.pump();
|
||||||
|
expect(changedPipeline, isNull);
|
||||||
|
expect(find.text('Pipeline 3'), findsNothing);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
testWidgets('run detail keeps the pipeline filter for Back routing', (
|
||||||
|
tester,
|
||||||
|
) async {
|
||||||
|
int? backPipeline;
|
||||||
|
await tester.pumpWidget(
|
||||||
|
_materialScreen(
|
||||||
|
gateway,
|
||||||
|
initialPipelineId: 3,
|
||||||
|
onBack: (id) => backPipeline = id,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await _mountList(tester, gateway);
|
||||||
|
await tester.pumpWidget(
|
||||||
|
_materialScreen(
|
||||||
|
gateway,
|
||||||
|
initialRunId: 2,
|
||||||
|
onBack: (id) => backPipeline = id,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
await tester.pump();
|
||||||
|
gateway.replyDetail(2, 0, {'id': 2, 'title': 'Beta run'});
|
||||||
|
await tester.pump();
|
||||||
|
|
||||||
|
await tester.tap(find.text('Back to list'));
|
||||||
|
await tester.pump();
|
||||||
|
expect(backPipeline, 3);
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('a route change opens and closes the named run', (tester) async {
|
testWidgets('a route change opens and closes the named run', (tester) async {
|
||||||
await tester.pumpWidget(_materialScreen(gateway, initialRunId: 2));
|
await tester.pumpWidget(_materialScreen(gateway, initialRunId: 2));
|
||||||
await _mountList(tester, gateway);
|
await _mountList(tester, gateway);
|
||||||
|
|||||||
Reference in New Issue
Block a user