From ebbb7a7a84118d2394ebf2a3fc8e2e77a1623825 Mon Sep 17 00:00:00 2001 From: jmforsythe <72832948+jmforsythe@users.noreply.github.com> Date: Wed, 28 Jun 2023 23:28:56 +0100 Subject: [PATCH] Update README and add some styling for submodules --- README.md | 4 +--- static/javascript/treemap.js | 4 ++++ static/javascript/treemap_style.js | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9444165..54ab235 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ *Map showing the files in cpython that Guido van Rossum changed the most; full SVG image available in repo* +## Now with submodule support ## Website now available A version of this program is now available for use at [heatmap.jonathanforsythe.co.uk](https://heatmap.jonathanforsythe.co.uk) @@ -83,9 +84,6 @@ These times are with `minimum size drawn = 0`, on very large repositories, so th ## Wanted features -### Submodule tracking -Currently the only submodule changes that can be seen are the top level commit pointer changes. In the future would like to recursively explore submodules and add their files to the database. - ### Faster database generation Currently done using git log which can take a very long time for large repos. Will look into any other ways of getting needed information on files. diff --git a/static/javascript/treemap.js b/static/javascript/treemap.js index 29e11e0..d7969d3 100644 --- a/static/javascript/treemap.js +++ b/static/javascript/treemap.js @@ -90,6 +90,7 @@ function handle_row(row, x, y, width, height, parent_path, level, SVG_ROOT) { const row_width = height != 0 ? row_area / height : 0 const box_height = row_width != 0 ? box_area / row_width : 0 let el = {"text": val.name, "area": box_area, "x": x, "y": y, "width": row_width, "height": box_height, "parent": parent_path, "level": level} + if ("submodule" in val && val.submodule == true) el.submodule = true; if (NEST && "children" in val) el.children = squarify(x, y, row_width, box_height, val.children, `${parent_path}/${val.name}`, level+1, SVG_ROOT) out.push(el) y += box_height @@ -97,6 +98,7 @@ function handle_row(row, x, y, width, height, parent_path, level, SVG_ROOT) { const row_height = width != 0 ? row_area / width : 0 const box_width = row_height != 0 ? box_area / row_height : 0 let el = {"text": val.name, "area": box_area, "x": x, "y": y, "width": box_width, "height": row_height, "parent": parent_path, "level": level} + if ("submodule" in val && val.submodule == true) el.submodule = true; if (NEST && "children" in val) el.children = squarify(x, y, box_width, row_height, val.children, `${parent_path}/${val.name}`, level+1, SVG_ROOT) out.push(el) x += box_width @@ -108,6 +110,7 @@ function handle_row(row, x, y, width, height, parent_path, level, SVG_ROOT) { // Turns our object into an svg element function get_box_text_element(obj) { const is_leaf = !("children" in obj) + const is_submodule = "submodule" in obj && obj.submodule == true let element = document.createElementNS('http://www.w3.org/2000/svg', 'svg') let box = document.createElementNS('http://www.w3.org/2000/svg', 'rect') @@ -120,6 +123,7 @@ function get_box_text_element(obj) { element.setAttribute("height", `${obj.height}`) element.classList.add(`svg_level_${obj.level}`) if (is_leaf) element.classList.add("svg_leaf") + if (is_submodule) element.classList.add("svg_submodule") const path = `${obj.parent}/${obj.text}` element.setAttribute("id", `svg_path_${path}`) diff --git a/static/javascript/treemap_style.js b/static/javascript/treemap_style.js index 9a4d0db..72a779d 100644 --- a/static/javascript/treemap_style.js +++ b/static/javascript/treemap_style.js @@ -25,6 +25,10 @@ const SVG_STYLE = ` stroke: lightblue; } +.svg_submodule .svg_box_selected { + stroke: orange; +} + .svg_text { visibility: hidden; font-family: monospace;