Skip to content

Commit

Permalink
Hide ports if nothing exposed
Browse files Browse the repository at this point in the history
  • Loading branch information
lllllllillllllillll committed Jul 10, 2024
1 parent b4f2b1f commit c1d0a30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions controllers/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion views/partials/containerFull.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit c1d0a30

Please sign in to comment.