]> git.ipfire.org Git - ipfire.org.git/commitdiff
location: Redesign lookup page
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Jun 2020 16:45:22 +0000 (16:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 8 Jun 2020 16:45:22 +0000 (16:45 +0000)
Fixes: #12422
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/util.py
src/templates/location/base.html
src/templates/location/lookup.html

index f7182c896f0378a6d4d0d14eadf24c4377400c75..a44f228946ed1f37c5f40209c8a207e6801e0123 100644 (file)
@@ -72,6 +72,15 @@ class Address(Object):
                if self.asn:
                        return self.backend.location.get_as(self.asn)
 
+       def is_anonymous_proxy(self):
+               return self.network.has_flag(location.NETWORK_FLAG_ANONYMOUS_PROXY)
+
+       def is_satellite_provider(self):
+               return self.network.has_flag(location.NETWORK_FLAG_SATELLITE_PROVIDER)
+
+       def is_anycast(self):
+               return self.network.has_flag(location.NETWORK_FLAG_ANYCAST)
+
        # Blacklist
 
        def _make_blacklist_rr(self, blacklist):
index 8ed0828030a39c31dceb67776185a3c084f8798f..815f28b62863a35b9d8de47d460c6ea6540c1a03 100644 (file)
@@ -1,13 +1,15 @@
 {% extends "../base.html" %}
 
 {% block content %}
-       <h1 class="text-center mt-5 mb-5">
-               <a class="text-white" href="/lookup/{{ address }}">{{ _("Location of %s") % address }}</a>
+       <h1 class="text-center my-5">
+               <a class="text-white" href="/lookup/{{ address }}">{{ address }}</a>
        </h1>
 
-       <div class="row justify-content-center">
-               <div class="col-12 col-md-6">
-                       {% block main %}{% end block %}
+       <section>
+               <div class="row justify-content-center">
+                       <div class="col-12 col-lg-6">
+                               {% block main %}{% end block %}
+                       </div>
                </div>
-       </div>
+       </section>
 {% end block %}
index 63cb3c83f7c2e7cba0580de072344cab09f61cd2..b979d3e5175a2c220abac2a64688d2218a8dd744 100644 (file)
@@ -3,18 +3,36 @@
 {% block title %}{{ _("Location of %s") % address }}{% end block %}
 
 {% block main %}
-       <div class="card mb-4">
+       <div class="card">
                <div class="card-body">
-                       <dl>
+                       <dl class="row">
+                               <dt class="col-sm-4">{{ _("Network") }}</dt>
+                               <dd class="col-sm-8">{{ address.network }}</dd>
+
+                               <dt class="col-sm-4">{{ _("Announced by") }}</dt>
+                               <dd class="col-sm-8">{{ address.autonomous_system or _("N/A") }}</dd>
+
                                {% if address.country_code %}
-                                       <dt>{{ _("Country") }}</dt>
-                                       <dd>
+                                       <dt class="col-sm-4">{{ _("Country") }}</dt>
+                                       <dd class="col-sm-8">
                                                {{ format_country_name(address.country_code) }}
                                        </dd>
                                {% end %}
 
-                               <dt>{{ _("Autonomous System") }}</dt>
-                               <dd>{{ address.autonomous_system or _("N/A") }}</dd>
+                               <dt class="col-sm-4"></dt>
+                               <dd class="col-sm-8">
+                                       <span class="badge {% if address.is_anonymous_proxy() %}badge-success{% else %}badge-light{% end %}">
+                                               {{ _("Anonymous Proxy") }}
+                                       </span>
+
+                                       <span class="badge {% if address.is_satellite_provider() %}badge-success{% else %}badge-light{% end %}">
+                                               {{ _("Satellite Provider") }}
+                                       </span>
+
+                                       <span class="badge {% if address.is_anycast() %}badge-success{% else %}badge-light{% end %}">
+                                               {{ _("Anycast") }}
+                                       </span>
+                               </dd>
                        </dl>
 
                        <a class="btn btn-light btn-block" href="/lookup/{{ address }}/blacklists">