embark/lib/modules/webserver/backend/index.html

152 lines
6.2 KiB
HTML

<!doctype html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv="Content-Language" content="en" />
<meta name="msapplication-TileColor" content="#2d89ef">
<meta name="theme-color" content="#4188c9">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<link rel="icon" href="./favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico" />
<!-- Generated: 2018-04-04 13:48:30 +0200 -->
<title>Embark</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,300i,400,400i,500,500i,600,600i,700,700i&amp;subset=latin-ext">
<!--
<script src="./assets/js/require.min.js"></script>
<script>
requirejs.config({
baseUrl: '.'
});
</script>
-->
<!-- Dashboard Core -->
<link href="./assets/css/dashboard.css" rel="stylesheet" />
<script src="./assets/js/jquery-3.3.1.min.js"></script>
<div class="row row-cards row-deck">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">Contracts</h3>
</div>
<div class="table-responsive">
<table class="table card-table table-vcenter text-nowrap">
<thead>
<tr>
<th>Contract Name</th>
<th>Address</th>
<th>Status</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody id="contractsTable">
</tbody>
</table>
</div>
</div>
</div>
</div>
<script>
$.get( "/embark/contracts").done(function( data ) {
$.each(data, function(i, contract) {
let $tr = $('<tr>');
if (contract.deploy === false) {
$tr.append(
$(`<td><a href="contracts/view.html?${contract.name}">${contract.name}</a>`),
$('<td>').text('Interface or set to not deploy'),
$('<td>').text('n/a'),
);
} else if (contract.error) {
$tr.append(
$(`<td><a href="contracts/view.html?${contract.name}">${contract.name}</a>`),
$('<td>').text((contract.error).split("\n")[0].replace(/Error: /g, '').substring(0, 32)),
$('<td>').text('Error'),
);
} else {
$tr.append(
$(`<td><a href="contracts/view.html?${contract.name}">${contract.name}</a>`),
$('<td>').text(contract.address || '...'),
$('<td>').text(contract.address !== undefined ? 'Deployed' : 'Pending')
);
}
$tr.append(
$('<td class="text-right"><a href="javascript:void(0)" class="btn btn-secondary btn-sm">Manage</a><div class="dropdown"><button class="btn btn-secondary btn-sm dropdown-toggle" data-toggle="dropdown">Actions</button></div></td>'),
$('<td><a class="icon" href="javascript:void(0)"><i class="fe fe-edit"></i></a></td>')
);
$tr.appendTo('#contractsTable');
});
});
var ws = new WebSocket("ws://localhost:8000/embark/logs");
ws.onopen = function() {
};
ws.onmessage = function (evt) {
var received_msg = evt.data;
var log = JSON.parse(received_msg);
console.log(log);
$(".log").append('<br>[' + log.logLevel + '] ' + log.msg_clear);
};
ws.onclose = function() {
console.log("Connection is closed...");
};
window.onbeforeunload = function(event) {
ws.close();
};
$(".command-line input").keypress(function(e) {
if (e.which == 13) {
let value = $(".command-line input").val();
$.post( "/embark/console", { cmd: value }).done(function( data ) {
$(".log").append('<br>' + data.replace(/\n/g, '<br>'));
});
$(".command-line input").val('');
}
});
</script>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<div class="row align-items-center flex-row-reverse">
<div class="col-auto ml-auto">
<div class="row align-items-center">
<div class="col-auto">
<ul class="list-inline list-inline-dots mb-0">
<li class="list-inline-item"><a href="./docs/index.html">Documentation</a></li>
<li class="list-inline-item"><a href="./faq.html">FAQ</a></li>
</ul>
</div>
<div class="col-auto">
<a href="https://github.com/tabler/tabler" class="btn btn-outline-primary btn-sm">Source code</a>
</div>
</div>
</div>
<div class="col-12 col-lg-auto mt-3 mt-lg-0 text-center">
Copyright © 2018 <a href=".">Status Embark</a>.
</div>
</div>
</div>
</footer>
</div>
</body>
</html>