Merge ~caleb-ellis/maas:filter-count into maas:master

Proposed by Caleb Ellis
Status: Merged
Approved by: Caleb Ellis
Approved revision: 9378c4e0e38fb1be145e6a0c21a73145fad91d30
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~caleb-ellis/maas:filter-count
Merge into: maas:master
Diff against target: 38 lines (+6/-3)
2 files modified
src/maasserver/static/js/angular/directives/machines_table.js (+4/-2)
src/maasserver/static/partials/nodes-list.html (+2/-1)
Reviewer Review Type Date Requested Status
Anthony Dillon Approve
MAAS Maintainers Pending
Review via email: mp+367480@code.launchpad.net

Commit message

LP: #1829225 - Fix incorrect filter counts in machine list

Description of the change

## Done
- Fixed incorrect filter counts in machine list. This was occurring due to not properly clearing the metadata when loading the machine list, so the counts were getting added to every time you navigated to the machine list. This fix introduces two-way binding for the machine metadata, which is not ideal but ensures that the metadata is always correct.

## QA
- Go to machine list
- Check that the filter dropdown counts are correct
- Navigate to a different page then navigate back to the machine list
- Check that the machines still load in batches
- Check that the filter dropdowns are still correct

To post a comment you must log in.
Revision history for this message
Anthony Dillon (ya-bo-ng) wrote :

LGTM +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/static/js/angular/directives/machines_table.js b/src/maasserver/static/js/angular/directives/machines_table.js
2index 7ccfe0c..295272b 100644
3--- a/src/maasserver/static/js/angular/directives/machines_table.js
4+++ b/src/maasserver/static/js/angular/directives/machines_table.js
5@@ -33,7 +33,8 @@ function maasMachinesTable(
6 onCheckAll: "&",
7 onCheck: "=",
8 pools: "=",
9- zones: "="
10+ zones: "=",
11+ metadata: "="
12 },
13 templateUrl:
14 "static/partials/machines-table.html?v=" +
15@@ -78,7 +79,8 @@ function maasMachinesTable(
16 // ng-repeats the initial digest cycle is slow and the UI is
17 // blocked on first navigation.
18 if (angular.isDefined($scope.loading)) {
19- MachinesManager.clearItems();
20+ MachinesManager.clear();
21+ $scope.metadata = MachinesManager.getMetadata();
22 }
23 const machines = MachinesManager.getItems();
24
25diff --git a/src/maasserver/static/partials/nodes-list.html b/src/maasserver/static/partials/nodes-list.html
26index f4898b9..8e7fe41 100644
27--- a/src/maasserver/static/partials/nodes-list.html
28+++ b/src/maasserver/static/partials/nodes-list.html
29@@ -992,7 +992,8 @@ sudo maas-rack register --url {$ tabs.controllers.registerUrl $} --secret {$ tab
30 on-check-all="toggleCheckAll('machines')"
31 on-check="toggleChecked($machine, 'machines')"
32 pools="pools"
33- zones="zones">
34+ zones="zones"
35+ metadata=tabs.machines.metadata>
36 </maas-machines-table>
37 </div>
38 </form>

Subscribers

People subscribed via source and target branches