1
0
Fork 0
mirror of https://github.com/sileht/bird-lg.git synced 2024-11-22 06:54:43 +01:00
bird-lg/templates/layout.html

147 lines
4.1 KiB
HTML
Raw Normal View History

2011-12-16 11:02:24 +01:00
<!doctype html>
<title>Tetaneutral.net looking glass</title>
2012-01-20 00:12:19 +01:00
<meta charset="UTF-8">
2011-12-16 11:02:24 +01:00
<link rel=stylesheet type=text/css href="{{ url_for('static', filename='style.css') }}">
<script type="text/javascript" src="{{url_for('static', filename='jquery.js') }}"></script>
2012-01-20 00:12:19 +01:00
<script type="text/javascript" src="{{url_for('static', filename='jquery-impromptu.3.2.min.js') }}"></script>
2011-12-16 11:02:24 +01:00
<script type="text/javascript">
2012-01-20 00:12:19 +01:00
$( function() {
$("a.whois").click(function (event){
event.preventDefault();
link = $(this).attr('href')
$.getJSON(link, function(data) {
$.prompt("<h3>" + data.title + "</h3>" + data.output,{ show:'slideDown' });
});
});
2011-12-16 19:05:36 +01:00
2012-01-20 00:12:19 +01:00
previous_req_type = "{{session.req_type}}".replace("_detail","")
2012-01-20 16:50:58 +01:00
function update_view(nopopup){
2012-01-20 00:12:19 +01:00
next_req_type = $("#req_type").val().replace("_detail","")
if (previous_req_type != next_req_type) {
$("#request_args").val("")
}
previous_req_type = next_req_type
2012-01-20 16:50:58 +01:00
if (nopopup) {
$("#submit").click()
return
}
2012-01-20 00:12:19 +01:00
switch(next_req_type)
{
case "summary":
$("#submit").click()
break;
default:
2012-01-20 16:50:58 +01:00
txt = $("#" + $("#req_type").val() ).html().replace("...", '<input type="text" id="ipopup" name="ipopup" value="' + $("#request_args").val() + '">')
$.prompt(txt,
{
prefix: 'popup',
callback: function(v,m,f){
if ( f != undefined){
$("#request_args").val(f.ipopup)
$("#submit").click()
}
}
});
2011-12-16 11:02:24 +01:00
2012-01-20 16:50:58 +01:00
$("#ipopup").keyup(function(event) {
if (event.which == 13) {
event.preventDefault();
$("#request_args").val($("#ipopup").val())
$("#submit").click()
}
});
2011-12-16 11:02:24 +01:00
2012-01-20 16:50:58 +01:00
$("#ipopup").focus()
break;
}
2012-01-20 00:12:19 +01:00
}
2011-12-16 12:59:00 +01:00
2012-01-20 00:12:19 +01:00
$("ul li").click(function(){
// set hiddent field with class value
p = $(this).parent() // lu
c = p.attr("class")
2012-01-20 16:50:58 +01:00
2012-01-20 00:12:19 +01:00
$("#"+c).val($(this).attr("id"))
$("ul."+p.attr("class") + " li").removeClass('selected')
$(this).addClass('selected')
2012-01-20 16:50:58 +01:00
switch(c){
case "hosts":
case "proto":
update_view(true);
break;
default:
update_view(false);
break;
}
2012-01-20 00:12:19 +01:00
});
2012-01-20 16:50:58 +01:00
//update_view(true)
2012-01-20 00:12:19 +01:00
$("ul.proto li#{{session.proto}}").addClass('selected')
$("ul.hosts li[id='{{session.hosts}}']").addClass('selected')
$("ul.req_type li#{{session.req_type}}").addClass('selected')
$("ul.proto li#{{session.proto}}").addClass('current')
$("ul.hosts li[id='{{session.hosts}}']").addClass('current')
$("ul.req_type li#{{session.req_type}}").addClass('current')
$("#submit").click( function(){
switch ($("#req_type").val())
{
case "summary":
document.location = "/summary/" + $("#hosts").val() + "/" + $("#proto").val();
break;
default:
document.location = "/" + $("#req_type").val() + "/" + $("#hosts").val() + "/" + $("#proto").val() + "?q=" + $("#request_args").val() ;
break;
2012-01-03 10:11:24 +01:00
}
2012-01-20 00:12:19 +01:00
});
2011-12-16 19:05:36 +01:00
2012-01-20 00:12:19 +01:00
if (document.location.pathname == "/"){
$("#submit").click()
}
});
2011-12-16 11:02:24 +01:00
</script>
<div id="page">
2012-01-20 00:12:19 +01:00
<div id="header">
<h1>Tetaneutral.net<br />Looking Glass</h1>
2011-12-16 11:02:24 +01:00
<form>
2012-01-20 00:12:19 +01:00
<input id="hosts" type="hidden" value="{{session.hosts}}" />
<input id="proto" type="hidden" value="{{session.proto}}" />
<input id="req_type" type="hidden" value="{{session.req_type}}" />
<ul class="proto">
<li id="ipv4">ipv4</li>
<li id="ipv6">ipv6</li>
</ul>
<ul class="hosts">
<li id="{{all_hosts}}">all</li>
{% for host in config.HOST_MAPPING %}
<li id="{{host}}">{{host}}</li>
{% endfor %}
</ul>
<ul class="req_type">
2012-01-20 16:50:58 +01:00
<li id="summary">show protocols</li>
<li id="detail">show protocols ... all</li>
<li id="prefix">show route for ...</li>
<li id="prefix_detail">show route for ... all</li>
<li id="where">show route where net ~ [ ... ]</li>
<li id="where_detail">show route where net ~ [ ... ] all</li>
2012-01-20 00:12:19 +01:00
</ul>
2012-01-20 16:50:58 +01:00
{% if session.request_args %}
<p>... = {{session.request_args}}</p>
{% endif %}
<input type="hidden" id="request_args" style="display:none" value="{{session.request_args}}" />
<input type="button" id="submit" value="submit" style="display:none" />
2011-12-16 11:02:24 +01:00
</form>
2012-01-20 00:12:19 +01:00
</div>
<div id="content">
{% if errors %}
<div id="error">{{errors}}</div>
{% endif %}
2011-12-16 11:02:24 +01:00
{% block body %}{% endblock %}
2012-01-20 00:12:19 +01:00
</div>
2011-12-16 11:02:24 +01:00
</div>