add some device details on the list page
This commit is contained in:
parent
c2e8ac516c
commit
44250f9719
@ -4,10 +4,7 @@ from owrx.controllers.settings import SettingsFormController
|
|||||||
from owrx.source import SdrDeviceDescription, SdrDeviceDescriptionMissing
|
from owrx.source import SdrDeviceDescription, SdrDeviceDescriptionMissing
|
||||||
from owrx.config import Config
|
from owrx.config import Config
|
||||||
from urllib.parse import quote, unquote
|
from urllib.parse import quote, unquote
|
||||||
|
from owrx.sdr import SdrService
|
||||||
import logging
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class SdrDeviceListController(AuthorizationMixin, WebpageController):
|
class SdrDeviceListController(AuthorizationMixin, WebpageController):
|
||||||
@ -25,18 +22,22 @@ class SdrDeviceListController(AuthorizationMixin, WebpageController):
|
|||||||
|
|
||||||
def render_devices(self):
|
def render_devices(self):
|
||||||
def render_device(device_id, config):
|
def render_device(device_id, config):
|
||||||
|
# TODO: this only returns non-failed sources...
|
||||||
|
source = SdrService.getSource(device_id)
|
||||||
|
|
||||||
return """
|
return """
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<a href="{device_link}">
|
<a href="{device_link}">
|
||||||
<h3>{device_name}</h3>
|
<h3>{device_name}</h3>
|
||||||
</a>
|
</a>
|
||||||
<div>
|
<div>State: {state}</div>
|
||||||
some more device info here
|
<div>{num_profiles} profile(s)</div>
|
||||||
</div>
|
|
||||||
</li>
|
</li>
|
||||||
""".format(
|
""".format(
|
||||||
device_name=config["name"],
|
device_name=config["name"],
|
||||||
device_link="{}/{}".format(self.request.path, quote(device_id)),
|
device_link="{}/{}".format(self.request.path, quote(device_id)),
|
||||||
|
state="Unknown" if source is None else source.getState(),
|
||||||
|
num_profiles=len(config["profiles"]),
|
||||||
)
|
)
|
||||||
|
|
||||||
return """
|
return """
|
||||||
|
Loading…
Reference in New Issue
Block a user