diff --git a/htdocs/css/admin.css b/htdocs/css/admin.css
index a632da6..5c94caa 100644
--- a/htdocs/css/admin.css
+++ b/htdocs/css/admin.css
@@ -13,10 +13,6 @@ html, body {
margin: 15px 15px 0;
}
-.device {
- margin-top: 20px;
-}
-
.settings-section {
margin-top: 3em;
}
@@ -84,4 +80,8 @@ table.bookmarks .frequency {
.wsjt-decoding-depths-table td:first-child {
padding-left: 0;
+}
+
+.sdr-device-list .list-group-item {
+ background: initial;
}
\ No newline at end of file
diff --git a/htdocs/settings/general.html b/htdocs/settings/general.html
index e9297b1..1e6724d 100644
--- a/htdocs/settings/general.html
+++ b/htdocs/settings/general.html
@@ -2,18 +2,18 @@
-
+
""".format(
- device_name=config["name"]
+ device_name=config["name"],
+ device_link="{}/{}".format(self.request.path, quote(device_id)),
)
return """
-
+
""".format(
devices="".join(render_device(key, value) for key, value in Config.get()["sdrs"].items())
)
def indexAction(self):
self.serve_template("settings/general.html", **self.template_variables())
+
+
+class SdrDeviceController(AuthorizationMixin, WebpageController):
+ def get_device(self):
+ device_id = unquote(self.request.matches.group(1))
+ if device_id not in Config.get()["sdrs"]:
+ return None
+ return Config.get()["sdrs"][device_id]
+
+ def header_variables(self):
+ variables = super().header_variables()
+ variables["assets_prefix"] = "../../"
+ return variables
+
+ def template_variables(self, device):
+ variables = super().template_variables()
+ variables["title"] = device["name"]
+ variables["content"] = "TODO"
+ variables["assets_prefix"] = "../../"
+ return variables
+
+ def indexAction(self):
+ device = self.get_device()
+ if device is None:
+ self.send_response("device not found", code=404)
+ return
+ self.serve_template("settings/general.html", **self.template_variables(device))
diff --git a/owrx/http.py b/owrx/http.py
index 4d712d4..9360fb6 100644
--- a/owrx/http.py
+++ b/owrx/http.py
@@ -6,7 +6,7 @@ from owrx.controllers.api import ApiController
from owrx.controllers.metrics import MetricsController
from owrx.controllers.settings import SettingsController
from owrx.controllers.settings.general import GeneralSettingsController
-from owrx.controllers.settings.sdr import SdrSettingsController
+from owrx.controllers.settings.sdr import SdrDeviceListController, SdrDeviceController
from owrx.controllers.settings.reporting import ReportingController
from owrx.controllers.settings.backgrounddecoding import BackgroundDecodingController
from owrx.controllers.settings.decoding import DecodingSettingsController
@@ -115,7 +115,8 @@ class Router(object):
StaticRoute(
"/settings/general", GeneralSettingsController, method="POST", options={"action": "processFormData"}
),
- StaticRoute("/settings/sdr", SdrSettingsController),
+ StaticRoute("/settings/sdr", SdrDeviceListController),
+ RegexRoute("/settings/sdr/(.+)", SdrDeviceController),
StaticRoute("/settings/bookmarks", BookmarksController),
StaticRoute("/settings/bookmarks", BookmarksController, method="POST", options={"action": "new"}),
RegexRoute("/settings/bookmarks/(.+)", BookmarksController, method="POST", options={"action": "update"}),