Merge ~steverydz/maas:1845613-dhcp-col-bug into maas:master

Proposed by Steve Rydz
Status: Merged
Approved by: Steve Rydz
Approved revision: de1a8ff9f655694f9259cc9ff8307e5e9d72a3c5
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~steverydz/maas:1845613-dhcp-col-bug
Merge into: maas:master
Diff against target: 40 lines (+12/-5)
2 files modified
src/maasserver/static/js/angular/controllers/node_details_networking.js (+7/-5)
src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js (+5/-0)
Reviewer Review Type Date Requested Status
Caleb Ellis (community) Approve
MAAS Lander Approve
Adam Collard (community) Approve
Review via email: mp+373313@code.launchpad.net

Commit message

LP: #1845613 - Add null check to prevent template string showing in UI

Description of the change

Done:
Add null check for the vlan parameter to prevent an error causing the angular template string to show in the UI.

QA:
- Go to a machine detail page and go to the network tab
- Edit a physical machine and disconnect it from a fabric
- See that the DHCP column in the table shows "No DHCP"

To post a comment you must log in.
Revision history for this message
Adam Collard (adam-collard) wrote :

LGTM

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b 1845613-dhcp-col-bug lp:~steverydz/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci-jenkins.internal:8080/job/maas/job/branch-tester/6516/console
COMMIT: c26d1099b32eb8eb56dffc78a53a5b31b70e71a9

review: Needs Fixing
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b 1845613-dhcp-col-bug lp:~steverydz/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 4042fc43563eeda7896f7bc085b7dc3b195762ef

review: Approve
Revision history for this message
Caleb Ellis (caleb-ellis) wrote :

LGTM!

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/controllers/node_details_networking.js b/src/maasserver/static/js/angular/controllers/node_details_networking.js
2index d116646..28861dc 100644
3--- a/src/maasserver/static/js/angular/controllers/node_details_networking.js
4+++ b/src/maasserver/static/js/angular/controllers/node_details_networking.js
5@@ -2276,12 +2276,14 @@ export function NodeNetworkingController(
6 };
7
8 $scope.getDHCPStatus = vlan => {
9- if (vlan.external_dhcp) {
10- return `External (${vlan.external_dhcp})`;
11- }
12+ if (vlan) {
13+ if (vlan.external_dhcp) {
14+ return `External (${vlan.external_dhcp})`;
15+ }
16
17- if (vlan.dhcp_on) {
18- return "MAAS-provided";
19+ if (vlan.dhcp_on) {
20+ return "MAAS-provided";
21+ }
22 }
23
24 return "No DHCP";
25diff --git a/src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js b/src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js
26index 8d2e87a..b2ad7ba 100644
27--- a/src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js
28+++ b/src/maasserver/static/js/angular/controllers/tests/test_node_details_networking.js
29@@ -4943,6 +4943,11 @@ describe("NodeNetworkingController", function() {
30 const vlan = { external_dhcp: null, dhcp_on: false };
31 expect($scope.getDHCPStatus(vlan)).toEqual("No DHCP");
32 });
33+
34+ it("returns correct text if vlan is null", () => {
35+ makeController();
36+ expect($scope.getDHCPStatus(null)).toEqual("No DHCP");
37+ });
38 });
39
40 describe("changeConnectionStatus", () => {

Subscribers

People subscribed via source and target branches