Merge ~mpontillo/maas:subnet-details-show-containers--bug-1761269 into maas:master

Proposed by Mike Pontillo
Status: Merged
Approved by: Andres Rodriguez
Approved revision: ca0beb2121af373a2b4089971940b6a2cd586141
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~mpontillo/maas:subnet-details-show-containers--bug-1761269
Merge into: maas:master
Diff against target: 48 lines (+14/-0)
3 files modified
src/maasserver/models/staticipaddress.py (+1/-0)
src/maasserver/static/js/angular/controllers/subnet_details.js (+4/-0)
src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js (+9/-0)
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Newell Jensen (community) Approve
MAAS Lander Approve
Review via email: mp+344210@code.launchpad.net

Commit message

LP: #1761269 - Show containers as containers (instead of as devices) on subnet details page

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

UNIT TESTS
-b subnet-details-show-containers--bug-1761269 lp:~mpontillo/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: ca0beb2121af373a2b4089971940b6a2cd586141

review: Approve
Revision history for this message
Newell Jensen (newell-jensen) wrote :

LGTM

review: Approve
Revision history for this message
Andres Rodriguez (andreserl) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/models/staticipaddress.py b/src/maasserver/models/staticipaddress.py
2index 2da4093..837045d 100644
3--- a/src/maasserver/models/staticipaddress.py
4+++ b/src/maasserver/models/staticipaddress.py
5@@ -938,6 +938,7 @@ class StaticIPAddress(CleanSave, TimestampedModel):
6 "node_type": node.node_type,
7 "fqdn": node.fqdn,
8 "hostname": node.hostname,
9+ "is_container": node.parent_id is not None,
10 }
11 if iface is not None:
12 data["node_summary"]["via"] = iface.get_name()
13diff --git a/src/maasserver/static/js/angular/controllers/subnet_details.js b/src/maasserver/static/js/angular/controllers/subnet_details.js
14index c9c4ed8..67fb620 100644
15--- a/src/maasserver/static/js/angular/controllers/subnet_details.js
16+++ b/src/maasserver/static/js/angular/controllers/subnet_details.js
17@@ -141,7 +141,11 @@ angular.module('MAAS').controller('SubnetDetailsController', [
18 // Return the name of the node type for the given IP.
19 $scope.getUsageForIP = function(ip) {
20 if(angular.isObject(ip.node_summary)) {
21+ var isContainer = ip.node_summary.is_container;
22 var nodeType = ip.node_summary.node_type;
23+ if(nodeType === 1 && isContainer === true) {
24+ return "Container";
25+ }
26 var str = NODE_TYPES[nodeType];
27 if(angular.isString(str)) {
28 return str;
29diff --git a/src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js b/src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js
30index 174d07b..9b3a838 100644
31--- a/src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js
32+++ b/src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js
33@@ -325,6 +325,15 @@ describe("SubnetDetailsController", function() {
34 expect($scope.getUsageForIP(ipAddress)).toBe('BMC');
35 });
36
37+ it("handles containers", function() {
38+ makeControllerResolveSetActiveItem();
39+ var ip = {};
40+ ip.node_summary = {};
41+ ip.node_summary.node_type = 1;
42+ ip.node_summary.is_container = true;
43+ expect($scope.getUsageForIP(ip)).toBe('Container');
44+ });
45+
46 it("handles DNS records", function() {
47 makeControllerResolveSetActiveItem();
48 var ipAddress = {

Subscribers

People subscribed via source and target branches