App icons are now determined by service label.

This commit is contained in:
lllllllillllllillll 2024-06-27 23:33:30 -07:00
parent 31f5230f50
commit 87fe9d4c65
3 changed files with 15 additions and 10 deletions

View File

@ -16,6 +16,8 @@
* Removed 'SECRET' environment variable. * Removed 'SECRET' environment variable.
* New - Custom container links. * New - Custom container links.
* Fixed issue updating view permission. * Fixed issue updating view permission.
* Fixed issue viewing container logs.
* App icons are now determined by service label instead of image name.
## v0.60 (June 9th 2024) - Permissions system and import templates ## v0.60 (June 9th 2024) - Permissions system and import templates
* Converted JS template literals into HTML. * Converted JS template literals into HTML.

View File

@ -268,6 +268,8 @@ async function createCard (details) {
let state = details.state; let state = details.state;
let card = readFileSync('./views/partials/containerFull.html', 'utf8'); let card = readFileSync('./views/partials/containerFull.html', 'utf8');
let app_icon = (details.labels['com.docker.compose.service']);
let links = await ServerSettings.findOne({ where: {key: 'links'}}); let links = await ServerSettings.findOne({ where: {key: 'links'}});
if (!links) { links = { value: 'localhost' }; } if (!links) { links = { value: 'localhost' }; }
@ -294,7 +296,7 @@ async function createCard (details) {
card = card.replace(/AppName/g, details.name); card = card.replace(/AppName/g, details.name);
card = card.replace(/AppShortName/g, shortname); card = card.replace(/AppShortName/g, shortname);
card = card.replace(/AppIcon/g, details.service); card = card.replace(/AppIcon/g, app_icon);
card = card.replace(/AppState/g, state); card = card.replace(/AppState/g, state);
card = card.replace(/StateColor/g, state_color); card = card.replace(/StateColor/g, state_color);
card = card.replace(/AppLink/g, links.value); card = card.replace(/AppLink/g, links.value);
@ -406,7 +408,7 @@ export const Stats = async (req, res) => {
break; break;
} }
let info = `<div class="font-weight-medium"> <label class="cpu-text mb-1">${name} ${value}%</label></div> let info = `<div class="font-weight-medium"> <label class="cpu-text mb-1">${name} ${value}%</label></div>
<div class="cpu-bar meter animate ${color}"> <span style="width:${value}%"><span></span></span> </div>`; <div class="cpu-bar meter animate ${color}"><span style="width:${value}%"><span></span></span></div>`;
res.send(info); res.send(info);
} }
@ -421,7 +423,7 @@ export async function addAlert (session, type, message) {
  ${message}   ${message}
</div> </div>
</div> </div>
<button class="btn-close" data-hx-post="/dashboard/alert" data-hx-trigger="click" data-hx-target="#alert" data-hx-swap="outerHTML" style="padding-top: 0.5rem;" ></button> <button class="btn-close" data-hx-post="/dashboard/alert" data-hx-trigger="click" data-hx-target="#alert" data-hx-swap="outerHTML" style="padding-top: 0.5rem;"></button>
</div>`; </div>`;
} }
@ -467,11 +469,7 @@ export const Chart = async (req, res) => {
stats[name].ramArray = stats[name].ramArray.slice(-15); stats[name].ramArray = stats[name].ramArray.slice(-15);
let chart = ` let chart = `
<script> <script>
${name}chart.updateSeries([{ ${name}chart.updateSeries([{data: [${stats[name].cpuArray}]}, {data: [${stats[name].ramArray}]}])
data: [${stats[name].cpuArray}]
}, {
data: [${stats[name].ramArray}]
}])
</script>` </script>`
res.send(chart); res.send(chart);
} }

View File

@ -26,8 +26,13 @@ router.post("/uninstall", adminOnly, Uninstall);
// Search (testing) // Search (testing)
router.post("/search", function (req, res) { router.post("/search", function (req, res) {
console.log(req.body); let path = req.header('hx-current-url');
console.log(req.header('hx-current-url')); // http://localhost:8000/dashboard
let search_from = path.split("/").pop();
// dashboard
if (search_from == "dashboard") {
DashboardAction(req, res);
}
}); });
// Routes // Routes