Skip to content

Commit

Permalink
Fix rerun filtered environments doesn't take into consideration revie…
Browse files Browse the repository at this point in the history
…w filters (#222)

* Fix rerun filtered environments doesn't take into consideration review filters

* Add rejected filter option for environments

* Remove commented out code
  • Loading branch information
omar-selo authored Oct 17, 2024
1 parent c0b9642 commit c98f613
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
7 changes: 5 additions & 2 deletions frontend/lib/models/filters.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,11 @@ final emptyEnvironmentReviewFilters = FiltersGroup<EnvironmentReview>(
filters: [
Filter<EnvironmentReview>(
name: 'Review status',
extractOption: (te) =>
te.reviewDecision.isEmpty ? 'Undecided' : 'Reviewed',
extractOption: (er) => switch (er.reviewDecision) {
[] => 'Undecided',
[EnvironmentReviewDecision.rejected] => 'Rejected',
[...] => 'Approved',
},
),
],
);
5 changes: 4 additions & 1 deletion frontend/lib/ui/artefact_page/artefact_page_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ class ArtefactPageBody extends ConsumerWidget {
testExecutions: filteredCombination.map((comb) => comb.$2),
),
const Spacer(),
const RerunFilteredEnvironmentsButton(),
RerunFilteredEnvironmentsButton(
filteredTestExecutions:
filteredCombination.map((comb) => comb.$2),
),
],
),
NonBlockingProviderPreloader(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,22 @@ import 'package:intersperse/intersperse.dart';

import '../../models/test_execution.dart';
import '../../providers/artefact_builds.dart';
import '../../providers/filtered_test_executions.dart';
import '../../routing.dart';
import '../spacing.dart';

class RerunFilteredEnvironmentsButton extends ConsumerWidget {
const RerunFilteredEnvironmentsButton({super.key});
const RerunFilteredEnvironmentsButton({
super.key,
required this.filteredTestExecutions,
});

final Iterable<TestExecution> filteredTestExecutions;

@override
Widget build(BuildContext context, WidgetRef ref) {
final pageUri = GoRouterState.of(context).uri;
final artefactId = AppRoutes.artefactIdFromUri(pageUri);

final filteredTestExecutions = ref
.watch(filteredTestExecutionsProvider(pageUri))
.requireValue
.toList();

handlePress() => showDialog(
context: context,
builder: (_) => _ConfirmationDialog(
Expand All @@ -46,7 +45,7 @@ class _ConfirmationDialog extends ConsumerWidget {
required this.artefactId,
});

final List<TestExecution> filteredTestExecutions;
final Iterable<TestExecution> filteredTestExecutions;
final int artefactId;

@override
Expand Down

0 comments on commit c98f613

Please sign in to comment.