Style graph

This commit is contained in:
Joscha 2023-08-18 02:41:19 +02:00
parent c83f193143
commit 7ecd812b11
3 changed files with 77 additions and 39 deletions

View file

@ -28,18 +28,23 @@ use self::util::MetricFolder;
source = " source = "
{% match self %} {% match self %}
{% when MetricTree::File with { name, metric } %} {% when MetricTree::File with { name, metric } %}
<label> <label><input type=\"checkbox\" name=\"{{ metric }}\"> {{ name }}</label>
<input type=\"checkbox\" name=\"{{ metric }}\">
{{ name }}
</label>
{% when MetricTree::Folder with { name, metric, children } %} {% when MetricTree::Folder with { name, metric, children } %}
{% if children.trees.is_empty() %}
{% if let Some(metric) = metric %} {% if let Some(metric) = metric %}
<input type=\"checkbox\" name=\"{{ metric }}\"> <label><input type=\"checkbox\" name=\"{{ metric }}\"> {{ name }}/</label>
{% endif %} {% endif %}
{% else if let Some(metric) = metric %}
<details> <details>
<summary><input type=\"checkbox\" name=\"{{ metric }}\"> {{ name }}/</summary>
{{ children|safe }}
</details>
{% else %}
<details class=\"no-metric\">
<summary>{{ name }}/</summary> <summary>{{ name }}/</summary>
{{ children|safe }} {{ children|safe }}
</details> </details>
{% endif %}
{% endmatch %} {% endmatch %}
" "
)] )]

View file

@ -1,7 +1,9 @@
* { * {
font-family: monospace; font-family: monospace;
font-size: inherit;
margin: 0; margin: 0;
padding: 0; padding: 0;
box-sizing: border-box;
} }
body { body {
@ -31,7 +33,6 @@ a:hover {
} }
button { button {
font-size: inherit;
padding: 0 .5ch; padding: 0 .5ch;
} }
@ -51,16 +52,17 @@ details {
details>summary { details>summary {
font-weight: bold; font-weight: bold;
cursor: pointer; cursor: pointer;
list-style-type: "> "; list-style: "> " inside;
} }
details[open]>summary { details[open]>summary {
list-style-type: "v "; list-style: "v " inside;
} }
ul, ul,
ol { ol {
list-style-type: "- "; list-style: "- " outside;
margin-left: 2ch;
} }
dl { dl {
@ -151,12 +153,62 @@ nav a:hover {
color: #a33; color: #a33;
} }
/* Refs */ /* Index */
.refs-list dl { .refs-list dl {
margin-bottom: 0; margin-bottom: 0;
} }
/* Graph */
.graph-container {
display: flex;
flex-flow: row wrap;
align-items: flex-start;
}
.graph-container #plot {
margin-right: 1em;
margin-bottom: 1em;
box-shadow: 0 0 .5em black;
}
.graph-container #metrics {
flex: 0 50ch;
box-shadow: 0 0 .5em black;
}
.metrics-list {
background-color: #ddd;
padding: .3em 1ch;
}
.metrics-list * {
margin: 0;
padding: 0;
background-color: unset;
list-style: none;
}
.metrics-list details[open]>summary {
list-style: none;
}
.metrics-list input[type="checkbox"] {
width: 2ch;
}
.metrics-list details.no-metric>summary {
list-style: "-> " outside;
margin-left: 3ch;
}
.metrics-list summary~* {
border-left: .1ch solid black;
margin-left: .9ch;
padding-left: 1ch;
}
/* Queue */ /* Queue */
.queue-commits form { .queue-commits form {

View file

@ -7,34 +7,15 @@
<script type="module" src="{{ link_graph_js }}"></script> <script type="module" src="{{ link_graph_js }}"></script>
{% endblock %} {% endblock %}
{# {% macro metric_tree(tree) %}
{% match tree %}
{% when File with { name, metric } %}
<label><input type="checkbox" name="{{ metric }}"> {{ name }}</label>
{% when Folder with { name, metric, children } %}
<details>
<summary>{{ name }}/</summary>
{% call metric_forest(children) %}
</details>
{% endmatch %}
{% endmacro %}
{% macro metric_forest(trees) %}
<ul>
{% for tree in forest %}
{% call metric_tree(tree) %}
{% endfor %}
</ul>
{% endmacro %} #}
{% block body %} {% block body %}
<h2>Graph</h2> <h2>Graph</h2>
<div class="graph-container">
<div id="plot"></div> <div id="plot"></div>
<div id="metrics" class="metrics-list">
<div id="metrics">
{{ metrics|safe }} {{ metrics|safe }}
</div> </div>
</div>
{% endblock %} {% endblock %}