From 2b1dc76e4826764cc2d6f3589c3abf6ea8b9557e Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Tue, 2 Mar 2021 20:28:49 +0100 Subject: [PATCH] add profile list to the device page --- htdocs/css/admin.css | 5 +++++ owrx/controllers/settings/sdr.py | 32 +++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/htdocs/css/admin.css b/htdocs/css/admin.css index 73acdbb..019be64 100644 --- a/htdocs/css/admin.css +++ b/htdocs/css/admin.css @@ -103,6 +103,11 @@ table.bookmarks .frequency { background: initial; } +.sdr-device-list .sdr-profile-list { + max-height: 20rem; + overflow-y: auto; +} + .removable-group.removable { display: flex; flex-direction: row; diff --git a/owrx/controllers/settings/sdr.py b/owrx/controllers/settings/sdr.py index a776419..88e1d31 100644 --- a/owrx/controllers/settings/sdr.py +++ b/owrx/controllers/settings/sdr.py @@ -23,6 +23,16 @@ class SdrDeviceListController(AuthorizationMixin, WebpageController): return variables def render_devices(self): + def render_profile(profile_id, profile): + return """ +
  • + {profile_name} +
  • + """.format( + profile_name=profile["name"], + profile_link="{}/{}".format(self.request.path, quote(profile_id)), + ) + def render_device(device_id, config): # TODO: this only returns non-failed sources... source = SdrService.getSource(device_id) @@ -47,12 +57,19 @@ class SdrDeviceListController(AuthorizationMixin, WebpageController): return """
  • - -

    {device_name}

    -
    -
    State: {state}
    -
    {num_profiles} profile(s)
    - {additional_info} +
    +
    + +

    {device_name}

    +
    +
    State: {state}
    +
    {num_profiles} profile(s)
    + {additional_info} +
    +
      + {profiles} +
    +
  • """.format( device_name=config["name"], @@ -60,10 +77,11 @@ class SdrDeviceListController(AuthorizationMixin, WebpageController): state="Unknown" if source is None else source.getState(), num_profiles=len(config["profiles"]), additional_info=additional_info, + profiles="".join(render_profile(p_id, p) for p_id, p in config["profiles"].items()) ) return """ -