display sdr devices

This commit is contained in:
Jakob Ketterl 2020-04-26 02:15:19 +02:00
parent 5282b5f8df
commit fb90a4e54b
3 changed files with 26 additions and 0 deletions

View File

@ -18,3 +18,7 @@ body {
.row .map-input {
margin: 15px 15px 0;
}
.device {
margin-top: 20px;
}

View File

@ -16,5 +16,8 @@ ${header}
<div class="col-12">
<h1>SDR device settings</h1>
</div>
<div class="col-12">
${devices}
</div>
</div>
</body>

View File

@ -49,6 +49,25 @@ class SettingsController(AdminController):
class SdrSettingsController(AdminController):
def template_variables(self):
variables = super().template_variables()
variables["devices"] = self.render_devices()
return variables
def render_devices(self):
def render_devicde(device_id, config):
return """
<div class="card device bg-dark text-white">
<div class="card-header">
{device_name}
</div>
<div class="card-body">
device settings go here
</div>
</div>
""".format(device_name=config["name"])
return "".join(render_devicde(key, value) for key, value in Config.get()["sdrs"].items())
def indexAction(self):
self.serve_template("sdrsettings.html", **self.template_variables())