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

Improve UI

This commit is contained in:
Mehdi Abaakouk 2012-01-20 16:50:58 +01:00
parent 295062c834
commit 53e48a4076
4 changed files with 77 additions and 41 deletions

View file

@ -1,5 +1,5 @@
import sys import sys
sys.path.insert(0,"/var/www/lg.tetaneutral.net/") sys.path.insert(0,"/var/www/lg2.tetaneutral.net/")
from lg import app as application from lg import app as application

View file

@ -37,6 +37,7 @@ table {
height: 100%; height: 100%;
border-right: 1px solid #AFAFAF; border-right: 1px solid #AFAFAF;
position:fixed; position:fixed;
font-size:11px;
} }
#header h1{ #header h1{
text-align: center; text-align: center;
@ -92,14 +93,23 @@ ul.proto li{
select, input, { width: 100%;} select, input, { width: 100%;}
input[type=text],textarea { width: 97%; font-size:10px; } input[type=text],textarea { width: 97%; font-size:10px; }
input#submit {
display:block ;
margin: 5px auto;
width: 80px;
}
input#ipopup{
width: auto;
}
/* POPUP */ /* POPUP */
.jqifade{ .jqifade,
.popupfade{
position: absolute; position: absolute;
background-color: #aaaaaa; background-color: #aaaaaa;
} }
div.jqi{ div.jqi,
div.popup{
width: 600px; width: 600px;
position: absolute; position: absolute;
background-color: #ffffff; background-color: #ffffff;
@ -111,10 +121,15 @@ div.jqi{
-webkit-border-radius: 10px; -webkit-border-radius: 10px;
padding: 7px; padding: 7px;
} }
div.popup{
width : 400px;
}
div.popup .popupcontainer,
div.jqi .jqicontainer{ div.jqi .jqicontainer{
font-weight: bold; font-weight: bold;
} }
div.jqi .jqiclose{ div.jqi .jqiclose,
div.popup .popupclose{
position: absolute; position: absolute;
top: 4px; right: -2px; top: 4px; right: -2px;
width: 18px; width: 18px;
@ -122,18 +137,22 @@ div.jqi .jqiclose{
color: #bbbbbb; color: #bbbbbb;
font-weight: bold; font-weight: bold;
} }
div.popup .popupmessage,
div.jqi .jqimessage{ div.jqi .jqimessage{
padding: 10px; padding: 10px;
color: #444444; color: #444444;
height: 400px; height: 400px;
overflow: auto; overflow: auto;
} }
div.popup .popupmessage{ height:auto;}
div.popup .popupbuttons,
div.jqi .jqibuttons{ div.jqi .jqibuttons{
text-align: right; text-align: right;
padding: 5px 0 5px 0; padding: 5px 0 5px 0;
border: solid 1px #eeeeee; border: solid 1px #eeeeee;
background-color: #f4f4f4; background-color: #f4f4f4;
} }
div.popup button,
div.jqi button{ div.jqi button{
padding: 3px 10px; padding: 3px 10px;
margin: 0 10px; margin: 0 10px;
@ -143,12 +162,15 @@ div.jqi button{
font-weight: bold; font-weight: bold;
font-size: 12px; font-size: 12px;
} }
div.popup button:hover,
div.jqi button:hover{ div.jqi button:hover{
background-color: #728A8C; background-color: #728A8C;
} }
div.popup button.popupdefaultbutton,
div.jqi button.jqidefaultbutton{ div.jqi button.jqidefaultbutton{
background-color: #BF5E26; background-color: #BF5E26;
} }
.popupwarning .popup .popupbuttons,
.jqiwarning .jqi .jqibuttons{ .jqiwarning .jqi .jqibuttons{
background-color: #BF5E26; background-color: #BF5E26;
} }

View file

@ -15,48 +15,69 @@ $( function() {
}); });
previous_req_type = "{{session.req_type}}".replace("_detail","") previous_req_type = "{{session.req_type}}".replace("_detail","")
function update_view(){ function update_view(nopopup){
$("#request_args").hide()
$("#submit").hide()
next_req_type = $("#req_type").val().replace("_detail","") next_req_type = $("#req_type").val().replace("_detail","")
if (previous_req_type != next_req_type) { if (previous_req_type != next_req_type) {
$("#request_args").val("") $("#request_args").val("")
} }
previous_req_type = next_req_type previous_req_type = next_req_type
if (nopopup) {
$("#submit").click()
return
}
switch(next_req_type) switch(next_req_type)
{ {
case "summary": case "summary":
$("#submit").click() $("#submit").click()
break; break;
default: default:
$("#submit").show() txt = $("#" + $("#req_type").val() ).html().replace("...", '<input type="text" id="ipopup" name="ipopup" value="' + $("#request_args").val() + '">')
$("#request_args").show()
if ($("#request_args").val()) { $.prompt(txt,
$("#submit").click() {
} else { prefix: 'popup',
$("#request_args").focus() callback: function(v,m,f){
} if ( f != undefined){
$("#request_args").val(f.ipopup)
$("#submit").click()
}
}
});
$("#ipopup").keyup(function(event) {
if (event.which == 13) {
event.preventDefault();
$("#request_args").val($("#ipopup").val())
$("#submit").click()
}
});
$("#ipopup").focus()
break; break;
} }
} }
$("ul li").click(function(){ $("ul li").click(function(){
// set hiddent field with class value // set hiddent field with class value
p = $(this).parent() // lu p = $(this).parent() // lu
c = p.attr("class") c = p.attr("class")
$("#"+c).val($(this).attr("id")) $("#"+c).val($(this).attr("id"))
$("ul."+p.attr("class") + " li").removeClass('selected') $("ul."+p.attr("class") + " li").removeClass('selected')
$(this).addClass('selected') $(this).addClass('selected')
update_view() switch(c){
case "hosts":
case "proto":
update_view(true);
break;
default:
update_view(false);
break;
}
}); });
update_view() //update_view(true)
$("ul.proto li#{{session.proto}}").addClass('selected') $("ul.proto li#{{session.proto}}").addClass('selected')
$("ul.hosts li[id='{{session.hosts}}']").addClass('selected') $("ul.hosts li[id='{{session.hosts}}']").addClass('selected')
@ -66,13 +87,6 @@ $( function() {
$("ul.hosts li[id='{{session.hosts}}']").addClass('current') $("ul.hosts li[id='{{session.hosts}}']").addClass('current')
$("ul.req_type li#{{session.req_type}}").addClass('current') $("ul.req_type li#{{session.req_type}}").addClass('current')
$("#request_args").keyup(function(event) {
if (event.which == 13) {
event.preventDefault();
$("#submit").click()
}
});
$("#submit").click( function(){ $("#submit").click( function(){
switch ($("#req_type").val()) switch ($("#req_type").val())
{ {
@ -109,18 +123,18 @@ $( function() {
{% endfor %} {% endfor %}
</ul> </ul>
<ul class="req_type"> <ul class="req_type">
<li id="summary">summary</li> <li id="summary">show protocols</li>
<li id="detail">detail</li> <li id="detail">show protocols ... all</li>
<li id="prefix">prefix</li> <li id="prefix">show route for ...</li>
<li id="prefix_detail">prefix (detail)</li> <li id="prefix_detail">show route for ... all</li>
<li id="where">where net ~ [ ... ]</li> <li id="where">show route where net ~ [ ... ]</li>
<li id="where_detail">where net ~ [ ... ] (detail)</li> <li id="where_detail">show route where net ~ [ ... ] all</li>
</ul> </ul>
<br /> {% if session.request_args %}
<!--textarea type="text" id="request_args" style="display:none">{{session.request_args}}</textarea--> <p>... = {{session.request_args}}</p>
<input type="text" id="request_args" style="display:none" value="{{session.request_args}}" /> {% endif %}
<br /> <input type="hidden" id="request_args" style="display:none" value="{{session.request_args}}" />
<input type="button" id="submit" value="submit" /> <input type="button" id="submit" value="submit" style="display:none" />
</form> </form>
</div> </div>
<div id="content"> <div id="content">

View file

@ -4,7 +4,7 @@
<div class="detail"> <div class="detail">
<h2>{{host}}/{{session.proto}}: {{command}}</h2> <h2>{{host}}/{{session.proto}}: {{command}}</h2>
{% if session.request_args != expression %} {% if session.request_args != expression %}
DNS: <a href="/whois/{{session.request_args}}" class="whois">{{session.request_args}}</a> => <a href="/whois/{{ expression|replace("/32","") }}" class="whois">{{expression|replace("/32","")}}</a> DNS: <a href="/whois/{{session.request_args}}" class="whois">{{session.request_args}}</a> => <a href="/whois/{{ expression|replace("/32","")|replace("/128","") }}" class="whois">{{expression|replace("/32","")|replace("/128","")}}</a>
{% endif %} {% endif %}
<pre> <pre>
{{ detail[host]|safe }} {{ detail[host]|safe }}