chg: UI improvement, support sanejs not configured

pull/79/head
Raphaël Vinot 2020-05-25 14:42:13 +02:00
parent 761a8f826f
commit 0876117e90
2 changed files with 4 additions and 3 deletions

View File

@ -165,11 +165,12 @@ def hostnode_popup(tree_uuid: str, node_uuid: str):
} }
urls = [] urls = []
if lookyloo.sanejs.available:
if hasattr(lookyloo, 'sanejs') and lookyloo.sanejs.available:
to_lookup = [url.body_hash for url in hostnode.urls if hasattr(url, 'body_hash')] to_lookup = [url.body_hash for url in hostnode.urls if hasattr(url, 'body_hash')]
lookups = lookyloo.sanejs.hashes_lookup(to_lookup) lookups = lookyloo.sanejs.hashes_lookup(to_lookup)
for url in hostnode.urls: for url in hostnode.urls:
if lookyloo.sanejs.available and hasattr(url, 'body_hash') and url.body_hash in lookups: if hasattr(url, 'body_hash') and url.body_hash in lookups:
url.add_feature('sane_js_details', lookups[url.body_hash]) url.add_feature('sane_js_details', lookups[url.body_hash])
if lookups[url.body_hash]: if lookups[url.body_hash]:
if isinstance(lookups[url.body_hash], list): if isinstance(lookups[url.body_hash], list):

View File

@ -13,7 +13,7 @@
{% block content %} {% block content %}
<center> <center>
<h3>{{ hostname }}</h3> <h3>{{ hostname }}</h3>
<button type="button" class="btn btn-secondary" onclick="whereAmI()">Locate node on tree</button> <button type="button" class="btn btn-info" onclick="whereAmI()">Locate node on tree</button>
<a href="{{ url_for('hostnode_details_text', tree_uuid=tree_uuid, node_uuid=hostname_uuid) }}" class="btn btn-info" role="button">Get URLs as text</a> <a href="{{ url_for('hostnode_details_text', tree_uuid=tree_uuid, node_uuid=hostname_uuid) }}" class="btn btn-info" role="button">Get URLs as text</a>
</center> </center>
<p>Click on the URL to get the content of the response</p> <p>Click on the URL to get the content of the response</p>