Skip to content

Commit

Permalink
feat: allow disabling services/networks overview
Browse files Browse the repository at this point in the history
  • Loading branch information
oddlama committed Jul 12, 2024
1 parent 9ed5c7b commit a676a5c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 15 deletions.
12 changes: 12 additions & 0 deletions topology/renderers/elk/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
;
in {
options.renderers.elk = {
overviews = {
services.enable = mkOption {
type = types.bool;
default = true;
description = "Include a services overview in the main output";
};
networks.enable = mkOption {
type = types.bool;
default = true;
description = "Include a networks overview in the main output";
};
};
output = mkOption {
description = "The derivation containing the rendered output";
type = types.path;
Expand Down
40 changes: 25 additions & 15 deletions topology/renderers/elk/main.nix
Original file line number Diff line number Diff line change
Expand Up @@ -106,26 +106,36 @@ in rec {
"org.eclipse.elk.padding" = "[top=0,left=0,bottom=0,right=0]";
"org.eclipse.elk.priority" = 10000; # Place first!
};
children = {
services-overview = {
svg = {
file = config.lib.renderers.svg.services.mkOverview;
scale = 0.8;
children =
{}
// optionalAttrs config.renderers.elk.overviews.services.enable {
services-overview = {
svg = {
file = config.lib.renderers.svg.services.mkOverview;
scale = 0.8;
};
};
};

network-overview = {
svg = {
file = config.lib.renderers.svg.net.mkOverview;
scale = 0.8;
}
// optionalAttrs config.renderers.elk.overviews.networks.enable {
networks-overview = {
svg = {
file = config.lib.renderers.svg.net.mkOverview;
scale = 0.8;
};
};
};
};
};
}
(mkEdge "children.legends.children.services-overview" "children.legends.children.network-overview" false {
style.stroke = "none"; # invisible
})
(
optionalAttrs (
config.renderers.elk.overviews.services.enable
&& config.renderers.elk.overviews.networks.enable
) (
mkEdge "children.legends.children.services-overview" "children.legends.children.networks-overview" false {
style.stroke = "none"; # invisible
}
)
)
]
++ flatten (map nodeToElk (attrValues config.nodes))
);
Expand Down

0 comments on commit a676a5c

Please sign in to comment.