forked from turbot/steampipe-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsources.sp
114 lines (97 loc) · 2.4 KB
/
sources.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
105
106
107
108
109
110
111
112
113
114
dashboard "Sources" {
tags = {
service = "Hacker News"
}
container {
text {
width = 6
value = <<EOT
[Home](http://${local.host}:9194/hackernews.dashboard.Home)
🞄
[People](http://${local.host}:9194/hackernews.dashboard.People)
🞄
[Posts](http://${local.host}:9194/hackernews.dashboard.Posts)
🞄
[Repos](http://${local.host}:9194/hackernews.dashboard.Repos)
🞄
[Search](http://${local.host}:9194/hackernews.dashboard.Search)
🞄
Sources
🞄
[Submissions](http://${local.host}:9194/hackernews.dashboard.Submissions?input.hn_user=none)
🞄
[Urls](http://${local.host}:9194/hackernews.dashboard.Urls)
EOT
}
}
table {
width = 6
query = query.domains
column "domain" {
href = "http://${local.host}:9194/hackernews.dashboard.Sources?input.domain={{.'domain'}}"
}
}
container {
width = 6
container {
container {
input "domain" {
width = 6
placeholder = "search or choose domain"
sql = <<EOQ
with domains as (
select distinct
substring(url from 'http[s]*://([^/$]+)') as domain
from
hn_items_all
)
select
domain as label,
domain as value
from
domains
where
domain is not null
order by
domain
EOQ
}
text "source_examples" {
width = 6
value = <<EOT
Examples:
[www.nytimes.com](http://${local.host}:9194/hackernews.dashboard.Sources?input.domain=www.nytimes.com),
[github.com](http://${local.host}:9194/hackernews.dashboard.Sources?input.domain=github.com),
[simonwillison.net](http://${local.host}:9194/hackernews.dashboard.Sources?input.domain=simonwillison.net)
EOT
}
}
chart {
args = [
self.input.domain
]
query = query.domain_detail
axes {
y {
title {
value = "stories"
}
}
}
}
table {
args = [ self.input.domain ]
query = query.source_detail
column "link" {
href = "https://news.ycombinator.com/item?id={{.'link'}}"
}
column "url" {
wrap = "all"
}
column "title" {
wrap = "all"
}
}
}
}
}