aboutsummaryrefslogtreecommitdiff
path: root/shardweb/lib/templates/page
diff options
context:
space:
mode:
Diffstat (limited to 'shardweb/lib/templates/page')
-rw-r--r--shardweb/lib/templates/page/peer_list.html.eex47
-rw-r--r--shardweb/lib/templates/page/shard_list.html.eex46
2 files changed, 93 insertions, 0 deletions
diff --git a/shardweb/lib/templates/page/peer_list.html.eex b/shardweb/lib/templates/page/peer_list.html.eex
new file mode 100644
index 0000000..f385528
--- /dev/null
+++ b/shardweb/lib/templates/page/peer_list.html.eex
@@ -0,0 +1,47 @@
+<!-- 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-globe"></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} <- conn_list() do %>
+ <tr>
+ <td>
+ <%= case auth do %>
+ <% nil -> %>(anonymous)
+ <% %SNet.Auth{his_pk: his_pk} -> %> <%= Shard.Keys.pk_display(his_pk) %>
+ <% 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 %>
+
diff --git a/shardweb/lib/templates/page/shard_list.html.eex b/shardweb/lib/templates/page/shard_list.html.eex
new file mode 100644
index 0000000..a0648d3
--- /dev/null
+++ b/shardweb/lib/templates/page/shard_list.html.eex
@@ -0,0 +1,46 @@
+<!-- Page Heading -->
+<div class="row">
+ <div class="col-lg-12">
+ <h1 class="page-header">
+ Shard list
+
+ </h1>
+ <ol class="breadcrumb">
+ <li>
+ <i class="fa fa-dashboard"></i> Dashboard
+ </li>
+ <li class="active">
+ <i class="fa fa-table"></i> Shard list
+ </li>
+ </ol>
+ </div>
+</div>
+<!-- /.row -->
+
+<%= render ShardWeb.LayoutView, "flashes.html", assigns %>
+
+<table class="table table-striped">
+ <tr>
+ <th>Shard</th>
+ <th>Id</th>
+ <th>Pid</th>
+ </tr>
+ <%= for {id, manifest, pid} <- shard_list() do %>
+ <tr>
+ <td>
+ <%= case manifest do %>
+ <% %SApp.Identity.Manifest{pk: pk} -> %><i class="fa fa-user"></i>
+ <%= GenServer.call(pid, :get_info).nick %>
+ <small><%= Shard.Keys.pk_display pk %></small>
+ <% %SApp.Chat.Manifest{channel: chan} -> %><i class="fa fa-comments"></i> #<%= chan %>
+ <% %SApp.Chat.PrivChat.Manifest{pk_list: pk_list} -> %><i class="fa fa-comment"></i>
+ <%= pk_list |> Enum.map(&SApp.Identity.get_nick/1) |> Enum.join(", ") %>
+ <% x -> %> <%= inspect x %>
+ <% end %>
+ </td>
+ <td><small><%= id |> Base.encode16 %></small></td>
+ <td><%= inspect(pid) %></td>
+ </tr>
+ <% end %>
+</table>
+