From 8c3b789cb99778c09e3a2ab71aeb58479bf21976 Mon Sep 17 00:00:00 2001 From: jiacai2050 Date: Wed, 5 Jun 2024 20:29:13 +0800 Subject: [PATCH 1/2] seperate repo chart --- app.mjs | 23 +++++++++++++---------- template.ejs | 12 +++++++++--- web/app.js | 44 +++++++++++--------------------------------- 3 files changed, 33 insertions(+), 46 deletions(-) diff --git a/app.mjs b/app.mjs index 84582ac..2dc5964 100755 --- a/app.mjs +++ b/app.mjs @@ -167,19 +167,21 @@ async function GenerateHtml() { '25': '0.13.0', }; let repoHistories = []; + const repoFields = [ + 'forks', + 'stars', + 'watchers', + 'open_pulls', + 'closed_pulls', + 'merged_pulls', + 'open_issues', + 'closed_issues', + ]; { const rs = await client.execute( ` SELECT - created_at, - forks, - stars, - watchers, - open_pulls, - closed_pulls, - merged_pulls, - open_issues, - closed_issues + created_at, ${repoFields.join(', ')} FROM repo_histories ORDER BY @@ -204,7 +206,7 @@ limit 1000 const idsToShow = [ '25', // 0.13.0 - '23', // 0.12.0 + // '23', // 0.12.0 // '20', // '0.14.0', // '19', // '0.15.0', ]; @@ -237,6 +239,7 @@ limit 1000 repoHistoriesStr: JSON.stringify(repoHistories), idToTitle: idToTitle, idsToShow: idsToShow, + repoFields: repoFields, }); fs.writeFileSync('web/raw.html', body, fileOpts); } diff --git a/template.ejs b/template.ejs index c70cb63..483b5ba 100644 --- a/template.ejs +++ b/template.ejs @@ -14,7 +14,10 @@ const repoHistories = <%- repoHistoriesStr %>; window.onload = function() { const charts = [ - renderRepoChart(repoHistories, "repo-chart"), + <% for(const [index, field] of repoFields.entries()) { %> + renderRepoChart(repoHistories, '<%= field %>', <%= index+1 %>), + <% } %> + <% for(const id of idsToShow) { %> renderMilestoneChart(historiesById, <%= id %>), <% } %> @@ -31,8 +34,6 @@

Zig Milestone Monitor

-

Zig repository

-
<% for(const id of idsToShow) { %>

<%= idToTitle[id] %>

@@ -55,6 +56,11 @@
<% } %> +

Zig repository

+ <% for(const field of repoFields) { %> +
+ <% } %> +