Hide ports if nothing exposed

This commit is contained in:
lllllllillllllillll 2024-07-10 00:43:30 -07:00
parent b4f2b1f64f
commit c1d0a306a8
2 changed files with 8 additions and 3 deletions

View File

@ -386,11 +386,16 @@ async function createCard (details) {
card = card.replace(/AppState/g, state);
card = card.replace(/StateColor/g, state_color);
card = card.replace(/AppLink/g, links.value);
card = card.replace(/ExternalPort/g, details.external_port);
card = card.replace(/InternalPort/g, details.internal_port);
card = card.replace(/ChartName/g, details.name.replace(/-/g, ''));
card = card.replace(/AppNameState/g, `${details.name}State`);
card = card.replace(/data-trigger=""/, trigger);
// Show nothing if there are no ports exposed
if ((details.external_port == 0) && (details.internal_port == 0)) {
card = card.replace(/AppPorts/g, '');
} else {
card = card.replace(/AppPorts/g, `${details.external_port}:${details.internal_port}`);
}
return card;
}

View File

@ -5,7 +5,7 @@
<img width="100px" src="https://raw.githubusercontent.com/lllllllillllllillll/DweebUI-Icons/main/AppIcon.png" onerror="this.onerror=null;this.src='https://raw.githubusercontent.com/lllllllillllllillll/DweebUI-Icons/main/docker.png';"></img>
</div>
<div class="d-flex align-items-center">
<div class="subheader text-yellow">ExternalPort:InternalPort</div>
<div class="subheader text-yellow">AppPorts</div>
<div class="ms-auto lh-1">
<div class="card-actions btn-actions">
<button class="btn-action" title="Start" data-hx-post="/container/start" data-hx-trigger="mousedown" data-hx-target="#AppNameState" name="AppName" id="AppID" hx-swap="innerHTML">