Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DHCP status for DHCP relay (#1173) #1195

Merged
merged 2 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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