-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
73 lines (66 loc) · 2.92 KB
/
index.html
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
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap/dist/css/bootstrap.min.css" />
<link type="text/css" rel="stylesheet" href="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.css" />
<title>LND channel overview</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="//unpkg.com/babel-polyfill@latest/dist/polyfill.min.js"></script>
<script src="//unpkg.com/bootstrap-vue@latest/dist/bootstrap-vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script>
</head>
<body>
<div class="container">
<h1>Lightning Channels</h1>
</div>
<div id="channels">
<b-container v-for="(v,k) in channels" :key="k">
<h2>
<b-badge v-if="v.private" variant="warning">private</b-badge>
<b-badge v-if="!v.active" variant="dark">inactive</b-badge>
{{nodes[v.remote_pubkey].alias}}
</h2>
{{k}}: {{v.capacity}} {{v.local_balance}} <span class="text-monospace">{{v.remote_pubkey}}</span>
<b-progress :value="parseInt(v.local_balance)" :max="parseInt(v.capacity)" :variant="v.active?v.private?'secondary':'primary':'dark'" show-progress></b-progress>
</b-container>
</div>
</body>
<script>
var app = new Vue({
el: '#channels',
data: {
"channels": {},
"nodes": {}
},
methods: {
getListOfChannels: function() {
this.$http.get('channels', {}).then(response => {
let channels = response.body.channels.sort(function(a, b) {
return parseInt(a.capacity) > parseInt(b.capacity);
});
for (let channel of channels) {
if (!this.nodes[channel.remote_pubkey]) {
this.$set(this.nodes, channel.remote_pubkey, {
alias: channel.remote_pubkey
})
this.$http.get('nodes/' + channel.remote_pubkey, {}).then(response => {
let nodeinfo = response.body;
if ("" === nodeinfo.node.alias) nodeinfo.node.alias = "∅ " + nodeinfo.node.pub_key;
this.$set(this.nodes, nodeinfo.node.pub_key, nodeinfo.node);
}, error => {
console.log("Error: ", error);
});
}
this.$set(this.channels, channel.chan_id, channel);
}
}, error => {
console.log("Error: ", error);
});
},
}
})
app.getListOfChannels();
</script>
</html>