Skip to content

Commit

Permalink
Fix handling argument of show route where net ~ [ prefix+ ] command
Browse files Browse the repository at this point in the history
  • Loading branch information
tamihiro committed Apr 3, 2019
1 parent 5f98a35 commit 94d0357
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
13 changes: 6 additions & 7 deletions lg.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,28 +491,27 @@ def add_edge(_previous_as, _as, **kwargs):
hop_label = ""


add_node(_as, fillcolor=(first and "#F5A9A9" or "white"))
if _as == asmap[-1]:
add_node(_as, fillcolor="#F5A9A9", shape="box", )
else:
add_node(_as, fillcolor=(first and "#F5A9A9" or "white"), )
if hop_label:
edge = add_edge(nodes[previous_as], nodes[_as], label=hop_label, fontsize="7")
else:
edge = add_edge(nodes[previous_as], nodes[_as], fontsize="7")

hop_label = ""

if first:
if first or _as == asmap[-1]:
edge.set_style("bold")
edge.set_color("red")
elif edge.get_color() != "red":
elif edge.get_style() != "bold":
edge.set_style("dashed")
edge.set_color(color)

previous_as = _as
first = False

if previous_as:
node = add_node(previous_as)
node.set_shape("box")

for _as in prepend_as:
graph.add_edge(pydot.Edge(*(_as, _as), label=" %dx" % prepend_as[_as], color="grey", fontcolor="grey"))

Expand Down
2 changes: 1 addition & 1 deletion static/js/lg.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function reload(){
loc = "/" + request_type + "/" + hosts + "/" + proto;
if (request_type != "summary" ){
if( request_args != undefined && request_args != ""){
loc = loc + "?q=" + escape(request_args);
loc = loc + "?q=" + encodeURIComponent(request_args);
change_url(loc)
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<li class="nav-header">Request history</li>
{% for hosts, proto, request_type, request_args in session.history %}
<li{% if loop.first %} class="active"{% endif %}>
<a href="/{{ [request_type, hosts, proto]|join("/") }}{% if request_args %}?q={{request_args}}{% endif %}">
<a href="/{{ [request_type, hosts, proto]|join("/") }}{% if request_args %}?q={{request_args|urlencode}}{% endif %}">
{{hosts}}/{{proto}}: {{ commands_dict[request_type]|replace("...", request_args) }}
</a>
</li>
Expand Down
2 changes: 1 addition & 1 deletion templates/route.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% for host in detail %}
<h3>
{{host}}: {{command}}
<small><a class="pull-right" href="/{{session.request_type|replace("_detail","")}}_bgpmap/{{session.hosts}}/{{session.proto}}?q={{session.request_args}}">View the BGP map</a></small>
<small><a class="pull-right" href="/{{session.request_type|replace("_detail","")}}_bgpmap/{{session.hosts}}/{{session.proto}}?q={{session.request_args|urlencode}}">View the BGP map</a></small>
</h3>
{% if session.request_args != expression|replace("/32","")|replace("/128","") %}
<i>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></i><br />
Expand Down

0 comments on commit 94d0357

Please sign in to comment.