-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add frontend changes to display event log
- Loading branch information
Showing
11 changed files
with
185 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:yaru/yaru.dart'; | ||
import 'package:yaru_icons/yaru_icons.dart'; | ||
|
||
part 'test_event.freezed.dart'; | ||
part 'test_event.g.dart'; | ||
|
||
@freezed | ||
class TestEvent with _$TestEvent { | ||
const factory TestEvent({ | ||
@JsonKey(name: 'event_name') required String eventName, | ||
required String timestamp, | ||
required String detail, | ||
}) = _TestEvent; | ||
|
||
factory TestEvent.fromJson(Map<String, Object?> json) => | ||
_$TestEventFromJson(json); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import 'package:riverpod_annotation/riverpod_annotation.dart'; | ||
|
||
import '../models/test_event.dart'; | ||
import 'api.dart'; | ||
|
||
part 'test_events.g.dart'; | ||
|
||
@riverpod | ||
Future<List<TestEvent>> testEvents( | ||
TestEventsRef ref, | ||
int testExecutionId, | ||
) async { | ||
final api = ref.watch(apiProvider); | ||
return await api.getTestExecutionEvents(testExecutionId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
frontend/lib/ui/artefact_page/test_event_log_expandable.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import 'package:dartx/dartx.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:yaru/yaru.dart'; | ||
import 'package:yaru_widgets/yaru_widgets.dart'; | ||
|
||
import '../../models/test_event.dart'; | ||
import '../../providers/test_events.dart'; | ||
import '../spacing.dart'; | ||
|
||
class TestEventLogExpandable extends ConsumerWidget { | ||
const TestEventLogExpandable({ | ||
super.key, | ||
required this.testExecutionId, | ||
required this.initiallyExpanded, | ||
}); | ||
|
||
final int testExecutionId; | ||
final bool initiallyExpanded; | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
final testEvents = ref.watch(testEventsProvider(testExecutionId)); | ||
|
||
return testEvents.when( | ||
loading: () => const Center(child: YaruCircularProgressIndicator()), | ||
error: (error, stackTrace) => Center(child: Text('Error: $error')), | ||
data: (testEvents) { | ||
return ExpansionTile( | ||
controlAffinity: ListTileControlAffinity.leading, | ||
childrenPadding: const EdgeInsets.only(left: Spacing.level4), | ||
shape: const Border(), | ||
title: Text('Event Log'), | ||
initiallyExpanded: this.initiallyExpanded, | ||
children: <Widget>[ | ||
DataTable( | ||
columns: const <DataColumn>[ | ||
DataColumn( | ||
label: Expanded( | ||
child: Text( | ||
'Event Name', | ||
style: TextStyle(fontStyle: FontStyle.italic), | ||
), | ||
), | ||
), | ||
DataColumn( | ||
label: Expanded( | ||
child: Text( | ||
'Timestamp', | ||
style: TextStyle(fontStyle: FontStyle.italic), | ||
), | ||
), | ||
), | ||
DataColumn( | ||
label: Expanded( | ||
child: Text( | ||
'Detail', | ||
style: TextStyle(fontStyle: FontStyle.italic), | ||
), | ||
), | ||
), | ||
], | ||
rows: testEvents.map((testEvent) => DataRow( | ||
cells: <DataCell>[ | ||
DataCell(Text(testEvent.eventName)), | ||
DataCell(Text(testEvent.timestamp)), | ||
DataCell(Text(testEvent.detail)), | ||
], | ||
)) | ||
.toList(), | ||
), | ||
], | ||
); | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.