Skip to content

Commit a5d9870

Browse files
authored
feat: import notebook (#3192)
1 parent c1a825c commit a5d9870

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

src/flows/templates/types/tools.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
export default register =>
2+
register({
3+
type: 'tools',
4+
init: (id, token) => {
5+
const headers = {
6+
'Content-Type': 'application/json',
7+
'Accept-Encoding': 'gzip',
8+
Authorization: `Token ${token}`,
9+
}
10+
11+
return fetch(
12+
`https://influxdb.aws.influxdata.io/api/v2private/notebooks/${id}`,
13+
{
14+
method: 'GET',
15+
headers,
16+
}
17+
)
18+
.then(res => res.json())
19+
.then(res => {
20+
delete res.id
21+
delete res.orgID
22+
res.spec.pipes.unshift({
23+
type: 'region',
24+
region: 'https://influxdb.aws.influxdata.io',
25+
token,
26+
source: 'custom',
27+
visible: true,
28+
title: 'Tools Cluster',
29+
})
30+
31+
return res
32+
})
33+
},
34+
})

0 commit comments

Comments
 (0)