pkgs/switch-report: redesign tables
This commit is contained in:
parent
8a5f0cf4ee
commit
627c51e745
|
@ -12,13 +12,15 @@ let
|
|||
then
|
||||
# group ports
|
||||
linksByPorts // {
|
||||
${lib.concatStringsSep "<br>" links.${linkName}.ports} = linkName;
|
||||
${lib.concatMapStringsSep "<br>" (port:
|
||||
"`${port}`"
|
||||
) links.${linkName}.ports} = linkName;
|
||||
}
|
||||
else
|
||||
# expand lists of access ports to seperate rows
|
||||
builtins.foldl' (linksByPorts': port:
|
||||
linksByPorts' // {
|
||||
${port} = linkName;
|
||||
"`${port}`" = linkName;
|
||||
}
|
||||
) linksByPorts links.${linkName}.ports
|
||||
) {} (builtins.attrNames links);
|
||||
|
@ -28,8 +30,8 @@ let
|
|||
|
||||
`${model}` @ **${location}**
|
||||
|
||||
|Name|Ports|Trunk|Networks|
|
||||
|-:|-:|:-:|:-|
|
||||
|Ports|Target|Networks|
|
||||
|-:|:-:|:-|
|
||||
${lib.concatMapStrings (ports:
|
||||
let
|
||||
linkName = linksByPorts.${ports};
|
||||
|
@ -37,17 +39,19 @@ let
|
|||
in ''
|
||||
|${
|
||||
lib.optionalString (link.group != null)
|
||||
"Group ${toString link.group}: "
|
||||
}**${
|
||||
"**Group ${toString link.group}**<br>"
|
||||
}${
|
||||
ports
|
||||
}|**${
|
||||
linkName
|
||||
}**|${
|
||||
ports
|
||||
}|${
|
||||
lib.optionalString link.trunk "✓"
|
||||
}|${
|
||||
lib.concatStringsSep "<br>" (
|
||||
if link.trunk
|
||||
then "**Trunk:** "
|
||||
else "**Access:** "
|
||||
}${
|
||||
lib.concatStringsSep ", " (
|
||||
map (net:
|
||||
"${net} (`${toString config.site.net.${net}.vlan}`)"
|
||||
"${net} (`${toString config.site.net.${net}.vlan}`)"
|
||||
) (builtins.sort (a: b:
|
||||
let
|
||||
vlanA = config.site.net.${a}.vlan;
|
||||
|
|
Loading…
Reference in New Issue