Skip to content

Commit

Permalink
Fix DHCP status for DHCP relay (#1173) (#1195)
Browse files Browse the repository at this point in the history
Co-authored-by: Caleb Ellis <[email protected]>
  • Loading branch information
vtapia and Caleb Ellis authored Jun 4, 2020
1 parent f71504d commit 18f0ef7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
11 changes: 10 additions & 1 deletion legacy/src/app/controllers/networks_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,18 @@ function NetworksListController(
$scope.newObject = null;
};

// Return the name name for the VLAN.
// Return the short name for the VLAN.
$scope.getVLANName = function(vlan) {
return VLANsManager.getName(vlan);
};

// Return the full name for the VLAN.
$scope.getFullVLANName = function(vlan_id) {
var vlan = VLANsManager.getItemFromList(vlan_id);
var fabric = FabricsManager.getItemFromList(vlan.fabric);
return FabricsManager.getName(fabric) + "." + VLANsManager.getName(vlan);
};

// Return the name of the fabric from its given ID.
$scope.getFabricNameById = function(fabricId) {
return FabricsManager.getName(FabricsManager.getItemFromList(fabricId));
Expand All @@ -310,6 +317,8 @@ function NetworksListController(

if (vlan.dhcp_on) {
return "MAAS-provided";
} else if (vlan.relay_vlan) {
return "Relayed via " + $scope.getFullVLANName(vlan.relay_vlan);
}

return "No DHCP";
Expand Down
10 changes: 10 additions & 0 deletions legacy/src/app/controllers/node_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -1519,6 +1519,13 @@ function NodeDetailsController(
return text;
};

// Return the full name for the VLAN.
$scope.getFullVLANName = function(vlan_id) {
var vlan = VLANsManager.getItemFromList(vlan_id);
var fabric = FabricsManager.getItemFromList(vlan.fabric);
return FabricsManager.getName(fabric) + "." + VLANsManager.getName(vlan);
};

$scope.getDHCPStatus = iface => {
const { vlans } = $scope;
const vlan = vlans.find(vlan => vlan.id === iface.vlan_id);
Expand All @@ -1529,7 +1536,10 @@ function NodeDetailsController(

if (vlan.dhcp_on) {
return "MAAS-provided";
} else if (vlan.relay_vlan) {
return "Relayed via " + $scope.getFullVLANName(vlan.relay_vlan);
}

}
return "No DHCP";
};
Expand Down

0 comments on commit 18f0ef7

Please sign in to comment.