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