From: Michael Tremer
Date: Tue, 30 Oct 2018 11:36:56 +0000 (+0000)
Subject: fireinfo: Drop model page
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7d048a8f5a65ec02dee380f26fd3eced0cd262c;p=ipfire.org.git
fireinfo: Drop model page
There is nothing useful on it
Signed-off-by: Michael Tremer
---
diff --git a/Makefile.am b/Makefile.am
index 7eb76a99..4857218c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -141,7 +141,6 @@ templates_fireinfo_DATA = \
src/templates/fireinfo/driver.html \
src/templates/fireinfo/index.html \
src/templates/fireinfo/i-use-1.png \
- src/templates/fireinfo/model-detail.html \
src/templates/fireinfo/profile.html \
src/templates/fireinfo/stats-admin.html \
src/templates/fireinfo/stats-cpus-detail.html \
diff --git a/src/backend/fireinfo.py b/src/backend/fireinfo.py
index 194155e0..759b8735 100644
--- a/src/backend/fireinfo.py
+++ b/src/backend/fireinfo.py
@@ -2054,31 +2054,6 @@ class Fireinfo(Object):
return self._process_devices(res)
- def get_device_percentage(self, subsystem, vendor, model, when=None):
- res = self.db.get("WITH profiles AS (SELECT fireinfo_profiles_with_data_at(%s) AS id), \
- devices AS (SELECT * FROM profiles \
- LEFT JOIN fireinfo_profiles_devices ON profiles.id = fireinfo_profiles_devices.profile_id \
- LEFT JOIN fireinfo_devices ON fireinfo_profiles_devices.device_id = fireinfo_devices.id) \
- SELECT COUNT(*)::float / (SELECT COUNT(*) FROM devices) AS percentage FROM devices \
- WHERE devices.subsystem = %s AND devices.vendor = %s AND devices.model = %s",
- when, subsystem, vendor, model)
-
- if res:
- return res.percentage
-
- def get_device_in_profile(self, subsystem, vendor, model, limit=10, when=None):
- res = self.db.query("WITH profiles AS (SELECT fireinfo_profiles_with_data_at(%s) AS id), \
- profiles_with_device AS (SELECT DISTINCT fireinfo_profiles.public_id FROM profiles \
- LEFT JOIN fireinfo_profiles ON profiles.id = fireinfo_profiles.id \
- LEFT JOIN fireinfo_profiles_devices ON profiles.id = fireinfo_profiles_devices.profile_id \
- LEFT JOIN fireinfo_devices ON fireinfo_profiles_devices.device_id = fireinfo_devices.id \
- WHERE fireinfo_devices.subsystem = %s AND fireinfo_devices.vendor = %s \
- AND fireinfo_devices.model = %s) \
- SELECT * FROM profiles_with_device ORDER BY RANDOM() LIMIT %s",
- when, subsystem, vendor, model, limit)
-
- return (r.public_id for r in res)
-
def get_network_zones_map(self, when=None):
res = self.db.get("WITH profiles AS (SELECT fireinfo_profiles_with_data_at(%s) AS id) \
SELECT COUNT(NULLIF(has_red, FALSE))::float / (SELECT COUNT(*) FROM profiles) AS has_red, \
diff --git a/src/templates/fireinfo/model-detail.html b/src/templates/fireinfo/model-detail.html
deleted file mode 100644
index ed68cc89..00000000
--- a/src/templates/fireinfo/model-detail.html
+++ /dev/null
@@ -1,29 +0,0 @@
-{% extends "../base.html" %}
-
-{% block title %}{{ vendor_name }} - {{ model_name or model_id }}{% end block %}
-
-{% block body %}
-
-
-
- {{ _("This device is installed on approximately %.2f%% of all systems.") % percentage }}
-
-
- {% if profiles %}
-
- {{ _("Here are some random profiles which have this device:") }}
-
-
- {% end %}
-{% end block %}
diff --git a/src/templates/fireinfo/modules/table-devices.html b/src/templates/fireinfo/modules/table-devices.html
index 9d514e9a..32f89747 100644
--- a/src/templates/fireinfo/modules/table-devices.html
+++ b/src/templates/fireinfo/modules/table-devices.html
@@ -10,11 +10,8 @@
- {{ d.vendor_string }}
- ‐
-
- {{ d.model_string or "N/A (%s)" % d.model }}
-
+ {{ d.vendor_string }}
+ ‐ {{ d.model_string or "N/A (%s)" % d.model }}
{% if d.driver %}
({{ d.driver }})
diff --git a/src/web/__init__.py b/src/web/__init__.py
index 087d2202..06224b89 100644
--- a/src/web/__init__.py
+++ b/src/web/__init__.py
@@ -188,7 +188,6 @@ class Application(tornado.web.Application):
(r"/device/driver/(.*)", fireinfo.DeviceDriverDetail),
(r"/device/vendors", fireinfo.DeviceVendorsHandler),
(r"/device/(pci|usb)/([0-9a-f]{4})", fireinfo.DeviceVendorHandler),
- (r"/device/(pci|usb)/([0-9a-f]{4})/([0-9a-f]{4})", fireinfo.DeviceModelHandler),
# Show profiles
(r"/profile/random", fireinfo.RandomProfileHandler),
@@ -216,7 +215,6 @@ class Application(tornado.web.Application):
(r"/stats/oses", tornado.web.RedirectHandler, { "url" : "/statistics/releases" }),
(r"/stats/virtual", tornado.web.RedirectHandler, { "url" : "/statistics/virtualization" }),
(r"/vendor/(pci|usb)/([0-9a-f]{4})", fireinfo.DeviceVendorCompatHandler),
- (r"/model/(pci|usb)/([0-9a-f]{4})/([0-9a-f]{4})", fireinfo.DeviceModelCompatHandler),
])
# i-use.ipfire.org
diff --git a/src/web/fireinfo.py b/src/web/fireinfo.py
index 53db55ea..77253b9d 100644
--- a/src/web/fireinfo.py
+++ b/src/web/fireinfo.py
@@ -290,24 +290,6 @@ class DeviceVendorCompatHandler(BaseHandler):
self.redirect("/device/%s/%s" % (subsystem, vendor_id))
-class DeviceModelHandler(BaseHandler):
- def get(self, subsystem, vendor, model):
- percentage = self.fireinfo.get_device_percentage(subsystem, vendor,
- model, when=self.when)
- percentage *= 100
-
- profiles = self.fireinfo.get_device_in_profile(subsystem, vendor,
- model, when=self.when)
-
- vendor_name = self.fireinfo.get_vendor_string(subsystem, vendor)
- model_name = self.fireinfo.get_model_string(subsystem, vendor, model)
-
- self.render("fireinfo/model-detail.html", profiles=profiles,
- vendor_id=vendor, vendor_name=vendor_name,
- model_id=model, model_name=model_name,
- percentage=percentage, subsystem=subsystem)
-
-
class DeviceModelCompatHandler(BaseHandler):
def get(self, subsystem, vendor_id, model_id):
self.redirect("/device/%s/%s/%s" % (subsystem, vendor_id, model_id))