chg: [Crawler UI] add basic tooltips

This commit is contained in:
Terrtia 2019-03-01 11:40:43 +01:00
parent 93c7db86e4
commit 6f5f880b7d
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
4 changed files with 37 additions and 61 deletions

View file

@ -117,8 +117,12 @@ def get_last_crawled_domains_metadata(list_domains_crawled, date, type=None):
type = get_domain_type(domain) type = get_domain_type(domain)
metadata_domain['domain'] = domain metadata_domain['domain'] = domain
if len(domain) > 45:
domain_name, tld_domain = domain.rsplit('.', 1)
metadata_domain['domain_name'] = '{}[...].{}'.format(domain_name[:40], tld_domain)
else:
metadata_domain['domain_name'] = domain
metadata_domain['epoch'] = epoch metadata_domain['epoch'] = epoch
print(epoch)
metadata_domain['last_check'] = r_serv_onion.hget('{}_metadata:{}'.format(type, domain), 'last_check') metadata_domain['last_check'] = r_serv_onion.hget('{}_metadata:{}'.format(type, domain), 'last_check')
if metadata_domain['last_check'] is None: if metadata_domain['last_check'] is None:
metadata_domain['last_check'] = '********' metadata_domain['last_check'] = '********'
@ -196,9 +200,12 @@ def crawler_splash_onion():
return render_template("Crawler_Splash_onion.html", last_onions=list_onion, statDomains=statDomains, return render_template("Crawler_Splash_onion.html", last_onions=list_onion, statDomains=statDomains,
crawler_metadata=crawler_metadata, date_from=date_string, date_to=date_string) crawler_metadata=crawler_metadata, date_from=date_string, date_to=date_string)
@hiddenServices.route("/crawlers/crawler_splash_regular", methods=['GET']) @hiddenServices.route("/crawlers/Crawler_Splash_last_by_type", methods=['GET'])
def crawler_splash_regular(): def Crawler_Splash_last_by_type():
type = 'regular' type = request.args.get('type')
# verify user input
if type not in list_types:
type = 'onion'
type_name = dic_type_name[type] type_name = dic_type_name[type]
list_domains = [] list_domains = []

View file

@ -28,16 +28,8 @@
.bar_stack:hover{ .bar_stack:hover{
cursor: pointer; cursor: pointer;
} }
div.tooltip { .popover{
position: absolute; max-width: 100%;
text-align: center;
padding: 2px;
font: 12px sans-serif;
background: #ebf4fb;
border: 2px solid #b7ddf2;
border-radius: 8px;
pointer-events: none;
color: #000000;
} }
</style> </style>
@ -69,8 +61,8 @@
</thead> </thead>
<tbody id="tbody_last_crawled"> <tbody id="tbody_last_crawled">
{% for metadata_domain in last_domains %} {% for metadata_domain in last_domains %}
<tr> <tr data-toggle="popover" data-trigger="hover" title="<span class='badge badge-dark'>{{metadata_domain['domain']}}</span>" data-content="{{metadata_domain['epoch']}}">
<td><a target="_blank" href="{{ url_for('hiddenServices.onion_domain') }}?onion_domain={{ metadata_domain['domain'] }}">{{ metadata_domain['domain'] }}</a></td> <td><a target="_blank" href="{{ url_for('hiddenServices.onion_domain') }}?onion_domain={{ metadata_domain['domain'] }}">{{ metadata_domain['domain_name'] }}</a></td>
<td>{{'{}/{}/{}'.format(metadata_domain['first_seen'][0:4], metadata_domain['first_seen'][4:6], metadata_domain['first_seen'][6:8])}}</td> <td>{{'{}/{}/{}'.format(metadata_domain['first_seen'][0:4], metadata_domain['first_seen'][4:6], metadata_domain['first_seen'][6:8])}}</td>
<td>{{'{}/{}/{}'.format(metadata_domain['last_check'][0:4], metadata_domain['last_check'][4:6], metadata_domain['last_check'][6:8])}}</td> <td>{{'{}/{}/{}'.format(metadata_domain['last_check'][0:4], metadata_domain['last_check'][4:6], metadata_domain['last_check'][6:8])}}</td>
<td><div style="color:{{metadata_domain['status_color']}}; display:inline-block"> <td><div style="color:{{metadata_domain['status_color']}}; display:inline-block">
@ -224,6 +216,12 @@ $(document).ready(function(){
chart.onResize(); chart.onResize();
}); });
$('[data-toggle="popover"]').popover({
placement: 'top',
container: 'body',
html : true,
});
}); });
function toggle_sidebar(){ function toggle_sidebar(){

View file

@ -22,39 +22,9 @@
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-12 col-md-2 p-0 bg-light border-right"> {% include 'crawler/menu_sidebar.html' %}
<div class="col-12 col-lg-10" id="core_content">
<nav class="navbar navbar-expand navbar-light bg-light flex-md-column flex-row align-items-start py-2">
<h5 class="d-flex text-muted w-100">
<span>Splash Crawlers </span>
<a class="ml-auto" href="#">
<i class="fas fa-plus-circle ml-auto"></i>
</a>
</h5>
<ul class="nav flex-md-column flex-row navbar-nav justify-content-between w-100"> <!--nav-pills-->
<li class="nav-item">
<a class="nav-link active" href="#">
<i class="fas fa-search"></i>
<span>Dashboard</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<i class="fas fa-search"></i>
Automatic Splash Crawler
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<i class="fas fa-search"></i>
Manual Splash Crawler
</a>
</li>
</ul>
</nav>
</div>
@ -71,6 +41,7 @@
</div> </div>
</div> </div>
</div>
</body> </body>

View file

@ -20,13 +20,13 @@
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{{url_for('hiddenServices.crawler_splash_onion')}}" id="nav_onion_crawler"> <a class="nav-link" href="{{url_for('hiddenServices.Crawler_Splash_last_by_type')}}?type=onion" id="nav_onion_crawler">
<i class="fas fa-user-secret"></i> <i class="fas fa-user-secret"></i>
Onion Crawler Onion Crawler
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{{url_for('hiddenServices.crawler_splash_regular')}}" id="nav_regular_crawler"> <a class="nav-link" href="{{url_for('hiddenServices.Crawler_Splash_last_by_type')}}?type=regular" id="nav_regular_crawler">
<i class="fab fa-html5"></i> <i class="fab fa-html5"></i>
Regular Crawler Regular Crawler
</a> </a>