Skip to content

Commit

Permalink
Merge pull request #3619 from canonical/filter-instances-on-select-all
Browse files Browse the repository at this point in the history
[gui] when clicking the select all checkbox, respect instance filters
  • Loading branch information
andrei-toterman authored Sep 12, 2024
2 parents 3986bf0 + 3ecfcd3 commit 1d338f7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/client/gui/lib/vm_table/vm_table_headers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import '../vm_details/cpu_sparkline.dart';
import '../vm_details/ip_addresses.dart';
import '../vm_details/memory_usage.dart';
import '../vm_details/vm_status_icon.dart';
import 'search_box.dart';
import 'table.dart';
import 'vms.dart';

Expand Down Expand Up @@ -91,7 +92,14 @@ class SelectAllCheckbox extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final selectedVms = ref.watch(selectedVmsProvider);
final vmNames = ref.watch(vmNamesProvider);
final searchName = ref.watch(searchNameProvider);
final runningOnly = ref.watch(runningOnlyProvider);
final vmNames = ref
.watch(vmInfosProvider)
.where((i) => !runningOnly || i.instanceStatus.status == Status.RUNNING)
.where((i) => i.name.contains(searchName))
.map((i) => i.name)
.toList();
final allSelected = selectedVms.containsAll(vmNames);

void toggleSelectedAll(bool isSelected) {
Expand Down

0 comments on commit 1d338f7

Please sign in to comment.