]> git.ipfire.org Git - ipfire.org.git/commitdiff
fireinfo: Redesign profile page
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Oct 2018 11:18:35 +0000 (11:18 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Oct 2018 11:18:35 +0000 (11:18 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/fireinfo.py
src/templates/fireinfo/modules/table-devices.html
src/templates/fireinfo/profile.html

index 223468b9328e7172b4fc9c6af26dc82cee6bae66..f5c1ad57233e3f2e85f648190c048ff4308ecd3b 100644 (file)
@@ -363,12 +363,11 @@ class Device(Object):
 
        def __lt__(self, other):
                if isinstance(other, self.__class__):
-                       return self.subsystem < other.subsystem or \
+                       return self.cls < other.cls or \
                                self.vendor_string < other.vendor_string or \
                                self.vendor < other.vendor or \
                                self.model_string < other.model_string or \
-                               self.model < other.model or \
-                               self.driver < other.driver
+                               self.model < other.model
 
        @property
        def data(self):
@@ -727,8 +726,8 @@ class Profile(Object):
                        return False
 
                # WiFi module
-               if self.count_device("usb", "148f", "5572") < 1:
-                       return False
+               #if self.count_device("usb", "148f", "5572") < 1:
+               #       return False
 
                return True
 
index b1c5b2bd6eed8eb7097ca61f58aabee243482bc7..34ec81129d0ba338126ec7c475b78dc76ba0a92e 100644 (file)
@@ -1,31 +1,25 @@
-<dl>
-       {% for d in devices %}
-               <dt>
-                       <a class="vendor" href="/device/{{ d.subsystem }}/{{ d.vendor }}">{{ d.vendor_string }}</a>
-                       &bull;
-                       <a href="/device/{{ d.subsystem }}/{{ d.vendor }}/{{ d.model }}">
-                               {{ d.model_string or "N/A (%s)" % d.model }}
-                       </a>
-               </dt>
-               <dd>
-                       <ul class="list-inline">
-                               <li>
-                                       <img src="{{ static_url("images/icons/bus-%s.png" % d.subsystem) }}"
-                                               alt="{{ d.subsystem.upper() }}" />
-                               </li>
+<ul class="list-group list-group-flush">
+       {% for d in sorted(devices) %}
+               <div class="list-group-item flex-column align-items-start">
+                       <p class="small text-muted mb-0">
+                               {{ d.cls }}
 
-                               {% if d.driver %}
-                                       <li>
-                                               {{ _("Driver") }}: <a href="/device/driver/{{ d.driver }}">{{ d.driver }}</a>
-                                       </li>
+                               {% if d.subsystem == "usb" %}
+                                       <span class="fab fa-usb"></span>
                                {% end %}
+                       </p>
+
+                       <p class="mb-0">
+                               <a class="vendor" href="/device/{{ d.subsystem }}/{{ d.vendor }}">{{ d.vendor_string }}</a>
+                               &dash;
+                               <a href="/device/{{ d.subsystem }}/{{ d.vendor }}/{{ d.model }}">
+                                       {{ d.model_string or "N/A (%s)" % d.model }}
+                               </a>
 
-                               {% if d.percentage is not None %}
-                                       <li class="pull-right">
-                                               {{ _("Device distribution") }}: {{ "%.1f%%" % (d.percentage * 100) }}
-                                       </li>
+                               {% if d.driver %}
+                                       (<a href="/device/driver/{{ d.driver }}">{{ d.driver }}</a>)
                                {% end %}
-                       </ul>
-               </dd>
+                       </p>
+               </div>
        {% end %}
-</dl>
+</ul>
index 5aeba0928f6dfc71a639f05491b1a8bcd1c7542f..cb86c9872ad9633f65ee9ff8ba1f48f198374879 100644 (file)
 {% extends "../base.html" %}
 
-{% block title %}{{ _("Profile") }} {{ profile.public_id }}{% end block %}
+{% block title %}{{ _("Profile %s") % profile.public_id }}{% end block %}
 
 {% block body %}
-<div class="container">
-       <section class="features-content col-12">
-               <h2 class="display-2">{{ _("Profile") }} <small>{{ profile.public_id }}</small></h2>
-       
-               <div class="row">
-                       <div class="col">
-                               <h3>{{ profile.release }}</h3>
-                               
-                               <p>
-                               {% for zone in profile.network %}
-                                       {% if zone == "red" %}
-                                               <span class="label label-danger">{{ _("RED") }}</span>
-                                       {% elif zone == "green" %}
-                                               <span class="label label-success">{{ _("GREEN") }}</span>
-                                       {% elif zone == "orange" %}
-                                               <span class="label label-warning">{{ _("ORANGE") }}</span>
-                                       {% elif zone == "blue" %}
-                                               <span class="label label-info">{{ _("BLUE") }}</span>
-                                       {% end %}
-                               {% end %}
-                               </p>
+       <section>
+               <div class="container">
+                       <div class="row">
+                               <div class="col col-lg-8 offset-lg-1">
+                                       <h1 class="display-2 mb-0">{{ _("Profile") }}</h1>
+                                       <h5>{{ profile.public_id }}</h5>
+                               </div>
                        </div>
-                       
-                       <div class="col">
+               </div>
+       </section>
+
+       <div class="container">
+               <div class="row justify-content-center">
+                       <div class="col-12 col-lg-10">
                                {% if profile.appliance_id %}
-                                       <div class="alert alert-success">
-                                               <p>
-                                                       {% if profile.appliance_id.startswith("fountainnetworks-") %}
-                                                               <span class="pull-right">
-                                                                       {{ _("Get yours at") }}
-                                                                       <a href="//www.fountainnetworks.com/" class="alert-link">
-                                                                               fountainnetworks.com
-                                                                       </a>
-                                                               </span>
-                                                       {% elif profile.appliance_id.startswith("lightningwirelabs-") %}
-                                                               <span class="pull-right">
-                                                                       {{ _("Get yours at") }}
-                                                                       <a href="//www.lightningwirelabs.com/products/ipfire/appliances" class="alert-link">
-                                                                               lightningwirelabs.com
+                                       <div class="card mb-3">
+                                               <div class="card-body">
+                                                       <div class="row">
+                                                               <div class="col-12 col-sm-7">
+                                                                       <small>{{ _("This is a") }}</small>
+                                                                       <h5 class="card-title text-lwl">{{ profile.appliance }}</h5>
+                                                               </div>
+
+                                                               <div class="col-12 col-sm-5 d-flex align-items-center">
+                                                                       <a class="btn btn-lwl btn-block text-truncate" href="https://www.lightningwirelabs.com">
+                                                                               {{ _("Go to Lightning Wire Labs") }} <span class="fas fa-external-link-alt ml-2"></span>
                                                                        </a>
-                                                               </span>
-                                                       {% end %}
-                               
-                                                       <strong>{{ profile.appliance }}</strong>
-                                               </p>
+                                                               </div>
+                                                       </div>
+                                               </div>
                                        </div>
                                {% end %}
-                       </div>
-               </div>
-               
-               <div class="row">
-                       <div class="col">
-                               <h4><a href="/statistics/processors">{{ _("Processor") }}</a></h4>
-                               <p><strong>{{ profile.processor }}</strong></p>                 
-                               {% if profile.processor.count >= 2 %}
-                                       <p>
-                                               {% if profile.processor.count == 2 %}
-                                                       {{ _("Dual-core processor") }}
-                                               {% elif profile.processor.count == 4 %}
-                                                       {{ _("Quad-core processor") }}
-                                               {% elif profile.processor.count == 8 %}
-                                                       {{ ("Octo-core processor") }}
-                                               {% else %}
-                                                       {{ _("%s core processor") % profile.processor.count }}
-                                               {% end %}
-               
-                                               {% if profile.processor.uses_ht() %}
-                                                       {% if profile.processor.vendor == "Intel" %}
-                                                               {{ _("using Intel Hyper-Threading Technology") }}
-                                                       {% else %}
-                                                               {{ _("with %s logical cores") % profile.processor.core_count }}
-                                                       {% end %}
-                                               {% end %}
-                                       </p>
-                               {% end %}
-                               
-                               <ul class="list-inline">
-                                       <li>
-                                               <strong>{{ _("Supported features") }}:</strong>
-                                       </li>
-                                       {% for cap, available in profile.processor.capabilities %}
-                                               <li>
-                                                       <span class="label {% if available is None %}label-default{% elif available %}label-success{% else %}label-danger{% end %}">
-                                                               {% if cap == "64bit" %}
-                                                                       {{ _("64 bit") }}
-                                                               {% elif cap == "aes" %}
-                                                                       {{ _("AES-NI") }}
-                                                               {% elif cap == "nx" %}
-                                                                       {{ _("NX") }}
-                                                               {% elif cap == "pae" %}
-                                                                       {{ _("PAE") }}
-                                                               {% elif cap == "rdrand" %}
-                                                                       {{ _("RDRAND") }}
-                                                               {% elif cap == "virt" %}
-                                                                       {{ _("VT-x/AMD-V") }}
+
+                               <div class="card mb-5">
+                                       <div class="card-body">
+                                               <div class="row">
+                                                       <div class="col-12 col-sm-8 mb-4">
+                                                               <h5 class="card-title mb-0">
+                                                                       {{ _("Running %s") % profile.release }}
+                                                               </h5>
+
+                                                               <small class="text-muted">
+                                                                       {{ _("Last update %s") % locale.format_date(profile.time_updated) }}
+                                                               </small>
+                                                       </div>
+
+                                                       <div class="col-12 col-sm-4 text-center text-sm-right mb-4">
+                                                               {% for zone in profile.network %}
+                                                                       {% if zone == "red" %}
+                                                                               <span class="badge badge-danger">{{ _("RED") }}</span>
+                                                                       {% elif zone == "green" %}
+                                                                               <span class="badge badge-success">{{ _("GREEN") }}</span>
+                                                                       {% elif zone == "orange" %}
+                                                                               <span class="badge badge-warning">{{ _("ORANGE") }}</span>
+                                                                       {% elif zone == "blue" %}
+                                                                               <span class="badge badge-info">{{ _("BLUE") }}</span>
+                                                                       {% end %}
                                                                {% end %}
-                                                       </span>
-                                               </li>
-                                       {% end %}
-                               </ul>
-                       </div>
-                       
-                       <div class="col">
-                               <dl class="dl-horizontal">
-                                       {% if profile.virtual %}
-                                               <dt>
-                                                       <a href="/statistics/virtual">{{ _("Hypervisor") }}</a>
-                                               </dt>
-                                               <dd>
-                                                       {% if profile.hypervisor == "VMWare" %}
-                                                               {{ _("VMware") }}
-                                                       {% elif profile.hypervisor is None %}
-                                                               {{ _("Unknown") }}
-                                                       {% else %}
-                                                               {{ profile.hypervisor }}
+                                                       </div>
+                                               </div>
+
+                                               <dl class="row mb-0">
+                                                       {% if profile.virtual %}
+                                                               <dt class="col-sm-3">{{ _("Hypervisor") }}</dt>
+                                                               <dd class="col-sm-9">
+                                                                       {% if profile.hypervisor == "VMWare" %}
+                                                                               {{ _("VMware") }}
+                                                                       {% elif profile.hypervisor is None %}
+                                                                               {{ _("Unknown") }}
+                                                                       {% else %}
+                                                                               {{ profile.hypervisor }}
+                                                                       {% end %}
+                                                               </dd>
+                                                       {% elif not profile.appliance_id and profile.system %}
+                                                               <dt class="col-sm-3">{{ _("System") }}</dt>
+                                                               <dd class="col-sm-9">
+                                                                       {% if profile.system_vendor %}
+                                                                               {{ profile.system_vendor }}
+                                                                       {% end %}
+
+                                                                       {% if profile.system_vendor and profile.system_model %}
+                                                                               &dash;
+                                                                       {% end %}
+
+                                                                       {% if profile.system_model %}
+                                                                               {{ profile.system_model }}
+                                                                       {% end %}
+                                                               </dd>
                                                        {% end %}
-                                               </dd>
-                                       {% elif not profile.appliance_id and profile.system %}
-                                               {% if profile.system_vendor %}
-                                                       <dt>{{ _("Vendor") }}</dt>
-                                                       <dd>{{ profile.system_vendor }}</dd>
-                                               {% end %}
-               
-                                               {% if profile.system_model %}
-                                                       <dt>{{ _("Model") }}</dt>
-                                                       <dd>{{ profile.system_model }}</dd>
-                                               {% end %}
-                                       {% end %}
-               
-                                       {% if profile.memory %}
-                                               <dt>
-                                                       <a href="/statistics/memory">{{ _("Memory") }}</a>
-                                               </dt>
-                                               <dd>
-                                                       {% if profile.memory <= (256 * 1024 ** 2) %}
-                                                               <span class="text-danger">
-                                                       {% elif profile.memory >= 1024 ** 3 %}
-                                                               <span class="text-success">
-                                                       {% else %}
-                                                               <span class="text-warning">
+
+                                                       {% if profile.processor %}
+                                                               <dt class="col-sm-3">{{ _("Processor") }}</dt>
+                                                               <dd class="col-sm-9">
+                                                                       <p class="card-text mb-0">{{ profile.processor }}</p>
+
+                                                                       <ul class="list-inline mb-0">
+                                                                               {% for cap, available in profile.processor.capabilities %}
+                                                                                       <li class="list-inline-item">
+                                                                                               <span class="badge {% if available %}badge-success{% else %}badge-light{% end %}">
+                                                                                                       {% if cap == "64bit" %}
+                                                                                                               {{ _("64 bit") }}
+                                                                                                       {% elif cap == "aes" %}
+                                                                                                               {{ _("AES-NI") }}
+                                                                                                       {% elif cap == "nx" %}
+                                                                                                               {{ _("NX") }}
+                                                                                                       {% elif cap == "pae" %}
+                                                                                                               {{ _("PAE") }}
+                                                                                                       {% elif cap == "rdrand" %}
+                                                                                                               {{ _("RDRAND") }}
+                                                                                                       {% elif cap == "virt" %}
+                                                                                                               {{ _("VT-x/AMD-V") }}
+                                                                                                       {% end %}
+                                                                                               </span>
+                                                                                       </li>
+                                                                               {% end %}
+                                                                       </ul>
+                                                               </dd>
                                                        {% end %}
-                                                               {{ format_size(profile.memory) }}
-                                                       </span>
-                                               </dd>
-                                       {% end %}
-               
-                                       {% if profile.storage %}
-                                               <dt>{{ _("System Storage") }}</dt>
-                                               <dd>{{ format_size(profile.storage) }}</dd>
-                                       {% end %}
-               
-                                       {% if profile.kernel %}
-                                               <dt>{{ _("Kernel") }}</dt>
-                                               <dd>{{ profile.kernel }}</dd>
-                                       {% end %}
-               
-                                       {% if profile.location %}
-                                               <dt>
-                                                       <a href="/statistics/geo-locations">{{ _("Location") }}</a>
-                                               </dt>
-                                               <dd>
-                                                       {{ profile.location_string }}
-                                               </dd>
-                                       {% end %}
-               
-                                       {% if profile.language %}
-                                               <dt>
-                                                       <a href="/statistics/languages">{{ _("Language") }}</a>
-                                               </dt>
-                                               <dd>{% module LanguageName(profile.language) %}</dd>
+
+                                                       {% if profile.memory %}
+                                                               <dt class="col-md-3">{{ _("Memory") }}</dt>
+                                                               <dd class="col-md-9">
+                                                                       {{ format_size(profile.memory) }}
+                                                               </dd>
+                                                       {% end %}
+
+                                                       {% if profile.storage %}
+                                                               <dt class="col-md-3">{{ _("Storage") }}</dt>
+                                                               <dd class="col-md-9">
+                                                                       {{ format_size(profile.storage) }}
+                                                               </dd>
+                                                       {% end %}
+
+                                                       {% if profile.location %}
+                                                               <dt class="col-md-3">{{ _("Location") }}</dt>
+                                                               <dd class="col-md-9">
+                                                                       {{ profile.location_string }}
+                                                               </dd>
+                                                       {% end %}
+
+                                                       {% if profile.language %}
+                                                               <dt class="col-md-3">{{ _("Language") }}</dt>
+                                                               <dd class="col-md-9">
+                                                                       {% module LanguageName(profile.language) %}
+                                                               </dd>
+                                                       {% end %}
+                                               </dl>
+                                       </div>
+
+                                       {% if profile.devices %}
+                                               {% module FireinfoDeviceTable([d for d in profile.devices if d.is_showable()]) %}
                                        {% end %}
-                               </dl>
-                       </div>
-               </div>
-               
-               <div class="row">
-                       <div class="col">
-                               {% if profile.devices %}
-                                       {% module FireinfoDeviceAndGroupsTable([d for d in profile.devices if d.is_showable()]) %}
-                                       <hr>
-                               {% end %}
-                       </div>
-               </div>
-               
-               <div class="row">
-                       <div class="col">
-                               <h3>{{ _("Signature images") }}</h3>
+                               </div>
+
+                               <h5>{{ _("Signature images") }}</h5>
+
                                <ul class="list-unstyled">
                                        {% for i in range(1) %}
-                                               <li>
+                                               <li class="list-inline-item">
                                                        <!-- XXX need some bbcode here -->
                                                        <a href="//i-use.ipfire.org/profile/{{ profile.public_id }}/{{ i }}.png">
-                                                               <img src="//i-use.ipfire.org/profile/{{ profile.public_id }}/{{ i }}.png"
+                                                               <img class="img-fluid" src="//i-use.ipfire.org/profile/{{ profile.public_id }}/{{ i }}.png"
                                                                        alt="{{ _("Signature image") }}" />
                                                        </a>
                                                </li>
                                        {% end %}
                                </ul>
                        </div>
-                       <div class="col">
-                               <p>{{ _("Last update") }}: {{ locale.format_date(profile.time_updated) }}</p>
-                       </div>
                </div>
-       </section>
-</div>
+       </div>
 {% end block %}