2021-02-15 14:29:02 +00:00
|
|
|
from owrx.controllers.admin import AuthorizationMixin
|
|
|
|
from owrx.controllers.template import WebpageController
|
|
|
|
from owrx.config import Config
|
|
|
|
|
|
|
|
|
|
|
|
class SdrSettingsController(AuthorizationMixin, WebpageController):
|
|
|
|
def header_variables(self):
|
|
|
|
variables = super().header_variables()
|
|
|
|
variables["assets_prefix"] = "../"
|
|
|
|
return variables
|
|
|
|
|
|
|
|
def template_variables(self):
|
|
|
|
variables = super().template_variables()
|
2021-02-18 22:05:43 +00:00
|
|
|
variables["content"] = self.render_devices()
|
2021-02-18 21:12:13 +00:00
|
|
|
variables["title"] = "SDR device settings"
|
2021-02-15 14:29:02 +00:00
|
|
|
return variables
|
|
|
|
|
|
|
|
def render_devices(self):
|
2021-02-18 22:05:43 +00:00
|
|
|
def render_device(device_id, config):
|
|
|
|
return """
|
2021-02-15 14:29:02 +00:00
|
|
|
<div class="card device bg-dark text-white">
|
|
|
|
<div class="card-header">
|
|
|
|
{device_name}
|
|
|
|
</div>
|
|
|
|
<div class="card-body">
|
2021-02-18 21:24:31 +00:00
|
|
|
sdr detail goes here
|
2021-02-15 14:29:02 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
""".format(
|
2021-02-18 22:05:43 +00:00
|
|
|
device_name=config["name"]
|
|
|
|
)
|
|
|
|
|
|
|
|
return """
|
|
|
|
<div class="col-12">
|
|
|
|
{devices}
|
|
|
|
</div>
|
|
|
|
""".format(
|
|
|
|
devices="".join(render_device(key, value) for key, value in Config.get()["sdrs"].items())
|
2021-02-15 14:29:02 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
def indexAction(self):
|
2021-02-18 21:12:13 +00:00
|
|
|
self.serve_template("settings/general.html", **self.template_variables())
|