-
Notifications
You must be signed in to change notification settings - Fork 4
/
me.sp
105 lines (89 loc) · 1.65 KB
/
me.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
dashboard "Me" {
tags = {
service = "Mastodon"
}
container {
text {
value = replace(
replace(
"${local.menu}",
"__HOST__",
"${local.host}"
),
"[Me](${local.host}/mastodon.dashboard.Me)",
"Me"
)
}
}
container {
table {
width = 4
query = query.connection
}
input "limit" {
base = input.limit
}
}
container {
chart {
width = 6
title = "my toots by day"
args = [ self.input.limit.value ]
sql = <<EOQ
with data as (
select
to_char(created_at, 'YY-MM-DD') as day
from
mastodon_my_toot
limit $1
)
select
day,
count(*)
from
data
group by
day
order by
day
EOQ
}
chart {
width = 6
type = "donut"
title = "my toots by type"
args = [ self.input.limit.value ]
sql = <<EOQ
with data as (
select
case
when reblog -> 'url' is not null then 'boosted'
when in_reply_to_account_id is not null then 'in_reply_to'
else 'original'
end as type
from
mastodon_my_toot
limit $1
)
select
type,
count(*)
from
data
group by
type
order by
count desc
EOQ
}
}
container {
table {
args = [ self.input.limit.value, "include" ]
query = query.timeline_me
column "toot" {
wrap = "all"
}
}
}
}