Add bug count and issues link to generated chart page
Display the current open bug total on the chart page and add a link to the Forgejo issues list. Also document optional forgejo.issues_url in config. Closes #3 Closes #2
This commit is contained in:
parent
0aaabd8671
commit
e575848c6d
3 changed files with 11 additions and 1 deletions
|
|
@ -23,6 +23,7 @@ Create a configuration file with the following structure:
|
||||||
[forgejo]
|
[forgejo]
|
||||||
hostname=<Your Forgejo hostname>
|
hostname=<Your Forgejo hostname>
|
||||||
token=<Your Forgejo Token>
|
token=<Your Forgejo Token>
|
||||||
|
issues_url=<Optional URL to your issue list>
|
||||||
|
|
||||||
[output]
|
[output]
|
||||||
dest=<Path to output HTML file>
|
dest=<Path to output HTML file>
|
||||||
|
|
|
||||||
7
build.py
7
build.py
|
|
@ -107,14 +107,19 @@ def main() -> None:
|
||||||
|
|
||||||
open_bugs_over_time = count_open_bugs(bug_reports)
|
open_bugs_over_time = count_open_bugs(bug_reports)
|
||||||
json_data = json.dumps(open_bugs_over_time)
|
json_data = json.dumps(open_bugs_over_time)
|
||||||
|
current_open_bug_count = open_bugs_over_time[-1][1] if open_bugs_over_time else 0
|
||||||
|
bug_list_url = config.get("forgejo", "issues_url", fallback=f"https://{hostname}/issues")
|
||||||
|
|
||||||
script_dir = os.path.dirname(os.path.abspath(__file__))
|
script_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
template_path = os.path.join(script_dir, "template.html")
|
template_path = os.path.join(script_dir, "template.html")
|
||||||
with open(template_path, "r") as fh:
|
with open(template_path, "r") as fh:
|
||||||
template_html = fh.read()
|
template_html = fh.read()
|
||||||
|
page_html = template_html.replace("jsonData = []", "jsonData = " + json_data)
|
||||||
|
page_html = page_html.replace("__OPEN_BUG_COUNT__", str(current_open_bug_count))
|
||||||
|
page_html = page_html.replace("__BUG_LIST_URL__", bug_list_url)
|
||||||
dest = config.get("output", "dest")
|
dest = config.get("output", "dest")
|
||||||
with open(dest, "w") as out:
|
with open(dest, "w") as out:
|
||||||
out.write(template_html.replace("jsonData = []", "jsonData = " + json_data))
|
out.write(page_html)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,10 @@
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
<p>
|
||||||
|
Open bugs now: <strong>__OPEN_BUG_COUNT__</strong> -
|
||||||
|
<a href="__BUG_LIST_URL__">Bug list</a>
|
||||||
|
</p>
|
||||||
<canvas id="bugChart" width="800" height="400"></canvas>
|
<canvas id="bugChart" width="800" height="400"></canvas>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue