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
|
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header">
Peer list
</h1>
<ol class="breadcrumb">
<li>
<i class="fa fa-dashboard"></i> Dashboard
</li>
<li class="active">
<i class="fa fa-server"></i> Peer list
</li>
</ol>
</div>
</div>
<!-- /.row -->
<%= render ShardWeb.LayoutView, "flashes.html", assigns %>
<table class="table table-striped">
<tr>
<th>Peer ID</th>
<th>Address</th>
<th>Port</th>
</tr>
<%= for {{:inet, ip, port}, _pid, auth, state} <- conn_list() do %>
<tr class="<%= if state == :establishing do "conn_establishing" else "" end %>">
<td>
<%= case auth do %>
<% nil -> %><i class="fa fa-globe"></i> (anonymous)
<% %SNet.Auth{his_pk: his_pk} -> %>
<i class="fa fa-user"></i>
<%= SApp.Identity.get_nick(his_pk) %>
<a href="<%= identity_path(@conn, :view, his_pk|>Base.encode16) %>">
<small><%= Shard.Keys.pk_display(his_pk) %></small>
</a>
<% end %>
</td>
<td><%= :inet_parse.ntoa(ip) %></td>
<td><%= port %></td>
</tr>
<% end %>
</table>
<%= form_for @conn, page_path(@conn, :add_peer), [class: "form-inline"], fn f -> %>
<%= text_input f, :ip, [class: "form-control", placeholder: "Hostname / IP address"] %>
<%= text_input f, :port, [class: "form-control", placeholder: "Port", value: "4044"] %>
<%= submit "Add peer", [class: "btn btn-default"] %>
<% end %>
|