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
diff --git a/src/maasserver/models/staticipaddress.py b/src/maasserver/models/staticipaddress.py
index 2da4093..837045d 100644
--- a/src/maasserver/models/staticipaddress.py
+++ b/src/maasserver/models/staticipaddress.py
@@ -938,6 +938,7 @@ class StaticIPAddress(CleanSave, TimestampedModel):
938 "node_type": node.node_type,938 "node_type": node.node_type,
939 "fqdn": node.fqdn,939 "fqdn": node.fqdn,
940 "hostname": node.hostname,940 "hostname": node.hostname,
941 "is_container": node.parent_id is not None,
941 }942 }
942 if iface is not None:943 if iface is not None:
943 data["node_summary"]["via"] = iface.get_name()944 data["node_summary"]["via"] = iface.get_name()
diff --git a/src/maasserver/static/js/angular/controllers/subnet_details.js b/src/maasserver/static/js/angular/controllers/subnet_details.js
index c9c4ed8..67fb620 100644
--- a/src/maasserver/static/js/angular/controllers/subnet_details.js
+++ b/src/maasserver/static/js/angular/controllers/subnet_details.js
@@ -141,7 +141,11 @@ angular.module('MAAS').controller('SubnetDetailsController', [
141 // Return the name of the node type for the given IP.141 // Return the name of the node type for the given IP.
142 $scope.getUsageForIP = function(ip) {142 $scope.getUsageForIP = function(ip) {
143 if(angular.isObject(ip.node_summary)) {143 if(angular.isObject(ip.node_summary)) {
144 var isContainer = ip.node_summary.is_container;
144 var nodeType = ip.node_summary.node_type;145 var nodeType = ip.node_summary.node_type;
146 if(nodeType === 1 && isContainer === true) {
147 return "Container";
148 }
145 var str = NODE_TYPES[nodeType];149 var str = NODE_TYPES[nodeType];
146 if(angular.isString(str)) {150 if(angular.isString(str)) {
147 return str;151 return str;
diff --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
index 174d07b..9b3a838 100644
--- a/src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js
+++ b/src/maasserver/static/js/angular/controllers/tests/test_subnet_details.js
@@ -325,6 +325,15 @@ describe("SubnetDetailsController", function() {
325 expect($scope.getUsageForIP(ipAddress)).toBe('BMC');325 expect($scope.getUsageForIP(ipAddress)).toBe('BMC');
326 });326 });
327327
328 it("handles containers", function() {
329 makeControllerResolveSetActiveItem();
330 var ip = {};
331 ip.node_summary = {};
332 ip.node_summary.node_type = 1;
333 ip.node_summary.is_container = true;
334 expect($scope.getUsageForIP(ip)).toBe('Container');
335 });
336
328 it("handles DNS records", function() {337 it("handles DNS records", function() {
329 makeControllerResolveSetActiveItem();338 makeControllerResolveSetActiveItem();
330 var ipAddress = {339 var ipAddress = {

Subscribers

People subscribed via source and target branches