From eec64c3bc7dcefb8164520b973aa516504500900 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Mon, 5 Oct 2020 14:56:50 +0200 Subject: [PATCH] chg: [UI show domain] add last origin table: domain + item --- bin/lib/Domain.py | 11 ++++++ var/www/blueprints/crawler_splash.py | 2 +- .../crawler/crawler_splash/showDomain.html | 34 +++++++++++++++---- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/bin/lib/Domain.py b/bin/lib/Domain.py index bfc0b4cb..52b5b7c6 100755 --- a/bin/lib/Domain.py +++ b/bin/lib/Domain.py @@ -474,6 +474,14 @@ def get_domain_last_origin(domain, domain_type): origin_item = r_serv_onion.hget('{}_metadata:{}'.format(domain_type, domain), 'paste_parent') return origin_item +def get_domain_father(domain, domain_type): + dict_father = {} + dict_father['item_father'] = r_serv_onion.hget('{}_metadata:{}'.format(domain_type, domain), 'paste_parent') + if dict_father['item_father'] != 'auto' and dict_father['item_father'] != 'manual': + if Item.is_crawled(dict_father['item_father']): + dict_father['domain_father'] = Item.get_domain(dict_father['item_father']) + return dict_father + def get_domain_tags(domain): ''' Retun all tags of a given domain. @@ -744,6 +752,9 @@ class Domain(object): ''' return get_domain_last_origin(self.domain, self.type) + def get_domain_father(self): + return get_domain_father(self.domain, self.type) + def domain_was_up(self): ''' Return True if this domain was UP at least one time diff --git a/var/www/blueprints/crawler_splash.py b/var/www/blueprints/crawler_splash.py index 7d006c3d..b2ef7f63 100644 --- a/var/www/blueprints/crawler_splash.py +++ b/var/www/blueprints/crawler_splash.py @@ -110,7 +110,7 @@ def showDomain(): if domain.domain_was_up(): dict_domain = {**dict_domain, **domain.get_domain_correlation()} dict_domain['correlation_nb'] = Domain.get_domain_total_nb_correlation(dict_domain) - dict_domain['origin_item'] = domain.get_domain_last_origin() + dict_domain['father'] = domain.get_domain_father() dict_domain['tags'] = domain.get_domain_tags() dict_domain['tags_safe'] = Tag.is_tags_safe(dict_domain['tags']) dict_domain['history'] = domain.get_domain_history_with_status() diff --git a/var/www/templates/crawler/crawler_splash/showDomain.html b/var/www/templates/crawler/crawler_splash/showDomain.html index d83aee39..bbe86fe2 100644 --- a/var/www/templates/crawler/crawler_splash/showDomain.html +++ b/var/www/templates/crawler/crawler_splash/showDomain.html @@ -94,12 +94,34 @@ -
- {% if dict_domain['origin_item']=='manual' or dict_domain['origin_item']=='auto' %} - {{ dict_domain['origin_item'] }} - {%else%} - Last Origin: {{ dict_domain['origin_item'] }} - {%endif%} + + + + + + + {% if dict_domain['father']=='manual' or dict_domain['father']=='auto' %} + + + + + {%else%} + + + + + {% if dict_domain['father']['domain_father'] %} + + + {%endif%} +

+ {%endif%} +

+
Last Origin:
{{ dict_domain['father'] }}
+ {{ dict_domain['father']['item_father'] }} +
+ {{ dict_domain['father']['domain_father'] }} +
{% if 'correlation_nb' in dict_domain %} {% if dict_domain["correlation_nb"] > 0 %}