Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a page that show how many backport the bot has made. #645

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,5 @@ params:
links:
- text: Press kit
link: /press-kit
- text: Bot
link: /bot
5 changes: 5 additions & 0 deletions content/bot/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Backport Bot
---

This is all the backport the Scientific Python Bot has made.
183 changes: 183 additions & 0 deletions layouts/bot/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
{{ define "main" }} {{ $pageLink := .Permalink }}

<section class="content-padding flex-row">
<div class="content-container">
<div class="columns">
<div class="column is-centered-tablet-portrait">
<h1 class="title section-title">{{ .Title }}</h1>
<h5 class="subtitle">{{ .Params.Subtitle }}</h5>
<div class="divider"></div>
</div>
</div>

{{ .Content }}

<div class="">
<link
href="https://d26b395fwzu5fz.cloudfront.net/keen-dataviz-1.1.3.css"
rel="stylesheet"
/>
<div class="chart" id="keen-example-chart"></div>
<div class="chart" id="backport-success">auto</div>
<div >
<div class="item initial chart" id="keen-chart-2">auto</div>
<div class="item auto chart" id="total-pr">auto</div>
</div>
</div>

<br />
</div>
<script
src="https://d26b395fwzu5fz.cloudfront.net/keen-analysis-1.2.2.js"
type="text/javascript"
></script>
<script
src="https://d26b395fwzu5fz.cloudfront.net/keen-dataviz-1.1.3.js"
type="text/javascript"
></script>
<script type="text/javascript">
var client = new Keen({
projectId: "59e6286dc9e77c0001097979",
readKey:
"3ED31C47C7576FB00C2150C4DFE176EC96B379CE631051B89F83243160668F201FF1FCE12B97A5B579B4ACDA4282CD71BE218EF858963B70E89ACDFAEFE80053E9B6900C2DA61BD277F107B05D3ED16240DC5527B3C9BCCA6895DA8CF479B9E3",
});

var chart = new Keen.Dataviz()
.el("#keen-example-chart")
.height(320)
.title("Activity / repository / week on a 52 week period")
.type("bar")
.stacked(true)
.prepare();

client
.query("count", {
event_collection: "dispatch",
filters: [
{
operator: "not_contains",
property_name: "mention.repository",
property_value: "/test1",
},
],
group_by: ["mention.repository"],
interval: "weekly",
timeframe: "this_52_weeks",
timezone: "US/Pacific",
})
.then(function (res) {
chart.data(res).render();
})
.catch(function (err) {
chart.message(err.message);
});

var chart2 = new Keen.Dataviz()
.el("#keen-chart-2")
.height(340)
.width("400px")
.title("Number of backport/Year/Project.")
.type("table")
.prepare();

client
.query("count", {
event_collection: "dispatch",
filters: [
{
operator: "contains",
property_name: "mention.command",
property_value: "backport",
},
],
group_by: ["mention.organisation"],
timeframe: "this_5_years",
timezone: "US/Pacific",
})
.then(function (res) {
var data = chart2.data(res);
console.log(data);
data.dataset = data.dataset.sortRows("desc", function (arr) {
console.log(arr);
return arr[1];
});
data.dataset.matrix[0] = ["Organisation", "Backports"];
data.render();
})
.catch(function (err) {
chart2.message(err.message);
});

var chart3 = new Keen.Dataviz()
.el("#total-pr")
.height(340)
.title("All attempted backports (excluding test repositories)")
.type("metric")
.prepare();

client
.query("count", {
event_collection: "dispatch",
filters: [
{
operator: "contains",
property_name: "mention.command",
property_value: "backport",
},
{
operator: "not_contains",
property_name: "mention.repository",
property_value: "test1",
},
],
timeframe: "this_14_years",
timezone: "US/Pacific",
})
.then(function (res) {
chart3.data(res).render();
})
.catch(function (err) {
chart3.message(err.message);
});

var chart4 = new Keen.Dataviz()
.el("#backport-success")
.height(240)
.title("Backport Success")
.stacked(true)
.type("columnchart")
.prepare();

client
.query("count", {
event_collection: "backport_stats",
filters: [
{
operator: "not_contains",
property_name: "slug",
property_value: "test1",
},
{ operator: "ne", property_name: "reason", property_value: "Success" },
],
group_by: ["reason"],
interval: "weekly",
timeframe: "this_52_weeks",
timezone: "US/Pacific",
})
.then(function (res) {
chart4.data(res).render();
})
.catch(function (err) {
chart.message(err.message);
});
</script>
<div id="shortcuts-container">
<div id="shortcuts">
<div id="shortcuts-header">
<i class="fa-solid fa-list"></i> On this page
</div>
</div>
</div>
</section>

{{ end }}