add profile list to the device page
This commit is contained in:
parent
e0b289b6a5
commit
2b1dc76e48
@ -103,6 +103,11 @@ table.bookmarks .frequency {
|
|||||||
background: initial;
|
background: initial;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sdr-device-list .sdr-profile-list {
|
||||||
|
max-height: 20rem;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.removable-group.removable {
|
.removable-group.removable {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -23,6 +23,16 @@ class SdrDeviceListController(AuthorizationMixin, WebpageController):
|
|||||||
return variables
|
return variables
|
||||||
|
|
||||||
def render_devices(self):
|
def render_devices(self):
|
||||||
|
def render_profile(profile_id, profile):
|
||||||
|
return """
|
||||||
|
<li class="list-group-item">
|
||||||
|
<a href="{profile_link}">{profile_name}</a>
|
||||||
|
</li>
|
||||||
|
""".format(
|
||||||
|
profile_name=profile["name"],
|
||||||
|
profile_link="{}/{}".format(self.request.path, quote(profile_id)),
|
||||||
|
)
|
||||||
|
|
||||||
def render_device(device_id, config):
|
def render_device(device_id, config):
|
||||||
# TODO: this only returns non-failed sources...
|
# TODO: this only returns non-failed sources...
|
||||||
source = SdrService.getSource(device_id)
|
source = SdrService.getSource(device_id)
|
||||||
@ -47,12 +57,19 @@ class SdrDeviceListController(AuthorizationMixin, WebpageController):
|
|||||||
|
|
||||||
return """
|
return """
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-6">
|
||||||
<a href="{device_link}">
|
<a href="{device_link}">
|
||||||
<h3>{device_name}</h3>
|
<h3>{device_name}</h3>
|
||||||
</a>
|
</a>
|
||||||
<div>State: {state}</div>
|
<div>State: {state}</div>
|
||||||
<div>{num_profiles} profile(s)</div>
|
<div>{num_profiles} profile(s)</div>
|
||||||
{additional_info}
|
{additional_info}
|
||||||
|
</div>
|
||||||
|
<ul class="col-6 list-group list-group-flush sdr-profile-list">
|
||||||
|
{profiles}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</li>
|
</li>
|
||||||
""".format(
|
""".format(
|
||||||
device_name=config["name"],
|
device_name=config["name"],
|
||||||
@ -60,10 +77,11 @@ class SdrDeviceListController(AuthorizationMixin, WebpageController):
|
|||||||
state="Unknown" if source is None else source.getState(),
|
state="Unknown" if source is None else source.getState(),
|
||||||
num_profiles=len(config["profiles"]),
|
num_profiles=len(config["profiles"]),
|
||||||
additional_info=additional_info,
|
additional_info=additional_info,
|
||||||
|
profiles="".join(render_profile(p_id, p) for p_id, p in config["profiles"].items())
|
||||||
)
|
)
|
||||||
|
|
||||||
return """
|
return """
|
||||||
<ul class="row list-group list-group-flush sdr-device-list">
|
<ul class="list-group list-group-flush sdr-device-list">
|
||||||
{devices}
|
{devices}
|
||||||
</ul>
|
</ul>
|
||||||
""".format(
|
""".format(
|
||||||
|
Loading…
Reference in New Issue
Block a user