From ab38e5ebde782acd70a5654f6f7d5c0ac89d065a Mon Sep 17 00:00:00 2001 From: jutty Date: Wed, 17 Dec 2025 02:21:31 -0300 Subject: [PATCH] Make number of nodes listed on index configurable --- src/types.rs | 9 +++++++++ static/graph.toml | 2 -- templates/index.html | 21 ++++++++++++++++----- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/types.rs b/src/types.rs index f828294..f8d2a55 100644 --- a/src/types.rs +++ b/src/types.rs @@ -82,6 +82,10 @@ pub struct Config { pub index_search: bool, #[serde(default = "mktrue")] pub index_node_list: bool, + #[serde(default = "mk8")] + pub index_node_count: u16, + #[serde(default = "mktrue")] + pub index_root_node: bool, #[serde(default = "mktrue")] pub tree_node_text: bool, } @@ -90,6 +94,9 @@ pub struct Config { fn mktrue() -> bool { true } +fn mk8() -> u16 { + 8 +} impl Graph { pub fn new(message: Option) -> Graph { @@ -113,6 +120,8 @@ impl Graph { raw_json: true, index_search: true, index_node_list: true, + index_node_count: 8, + index_root_node: true, tree_node_text: true, }, version: (0, 1, 0), diff --git a/static/graph.toml b/static/graph.toml index aeea612..f2ec600 100644 --- a/static/graph.toml +++ b/static/graph.toml @@ -140,5 +140,3 @@ footer_credits = false footer_text = """ made by jutty • acknowledgements • source code """ - - diff --git a/templates/index.html b/templates/index.html index 0a5e945..1916b56 100644 --- a/templates/index.html +++ b/templates/index.html @@ -20,25 +20,36 @@ {% endif %} - {% if config.index_node_list %} + {% if config.index_node_list or config.index_root_node %}
+ {% if config.index_node_list %}

Nodes

+ {% endif %} {% endif %} {% else %}