Merge ~steverydz/maas:ipmi-disabled-form into maas:master

Proposed by Steve Rydz
Status: Merged
Approved by: Steve Rydz
Approved revision: cad0ed550ea86606a7bf78b8e57be566760509d2
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~steverydz/maas:ipmi-disabled-form
Merge into: maas:master
Diff against target: 43 lines (+18/-0)
2 files modified
src/maasserver/static/js/angular/controllers/node_details.js (+7/-0)
src/maasserver/static/js/angular/controllers/tests/test_node_details.js (+11/-0)
Reviewer Review Type Date Requested Status
Caleb Ellis (community) Approve
MAAS Lander Approve
Review via email: mp+371339@code.launchpad.net

Commit message

LP: #1837210 - Fix machine config form diabled if no mac address

Description of the change

Done:
- Add an array of optional keys
- Check if key is in optional keys and return true if that's the case

QA:
- Go to a machine that has a power type of IPMI (tested on karura)
- In the configuration tab edit the power configuration form
- Remove the value from the Power MAC field
- See that you are able to save the form

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b ipmi-disabled-form lp:~steverydz/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: cad0ed550ea86606a7bf78b8e57be566760509d2

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

Incredibly minor, non-blocking comments but otherwise good to go.

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.js b/src/maasserver/static/js/angular/controllers/node_details.js
2index 2c986dd..f08f6d2 100644
3--- a/src/maasserver/static/js/angular/controllers/node_details.js
4+++ b/src/maasserver/static/js/angular/controllers/node_details.js
5@@ -1272,10 +1272,17 @@ function NodeDetailsController(
6 return false;
7 }
8
9+ // Keys which are optional
10+ const optionalKeys = ["mac_address"];
11+
12 // If keys but no values in obj
13 var hasParameters = false;
14
15 Object.keys(power_parameters).forEach(function(key) {
16+ if (optionalKeys.includes(key)) {
17+ return true;
18+ }
19+
20 if (power_parameters[key] !== "") {
21 hasParameters = true;
22 } else {
23diff --git a/src/maasserver/static/js/angular/controllers/tests/test_node_details.js b/src/maasserver/static/js/angular/controllers/tests/test_node_details.js
24index 81d1f91..9f1e16a 100644
25--- a/src/maasserver/static/js/angular/controllers/tests/test_node_details.js
26+++ b/src/maasserver/static/js/angular/controllers/tests/test_node_details.js
27@@ -2551,5 +2551,16 @@ describe("NodeDetailsController", function() {
28 })
29 ).toBe(true);
30 });
31+
32+ it("returns true if optional power_parameters are empty", function() {
33+ makeController();
34+ expect(
35+ $scope.powerParametersValid({
36+ power_address: "qemu+ssh://ubuntu@172.16.3.247/system",
37+ power_id: 26,
38+ mac_address: ""
39+ })
40+ ).toBe(true);
41+ });
42 });
43 });

Subscribers

People subscribed via source and target branches