From 87fe9d4c65faa3bb261a143fde8cab9883a1291b Mon Sep 17 00:00:00 2001 From: lllllllillllllillll Date: Thu, 27 Jun 2024 23:33:30 -0700 Subject: [PATCH] App icons are now determined by service label. --- CHANGELOG.md | 2 ++ controllers/dashboard.js | 14 ++++++-------- router/index.js | 9 +++++++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a7292c..fd7789e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ * Removed 'SECRET' environment variable. * New - Custom container links. * 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 * Converted JS template literals into HTML. diff --git a/controllers/dashboard.js b/controllers/dashboard.js index ad1a57f..2adde95 100644 --- a/controllers/dashboard.js +++ b/controllers/dashboard.js @@ -268,6 +268,8 @@ async function createCard (details) { let state = details.state; 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'}}); if (!links) { links = { value: 'localhost' }; } @@ -294,7 +296,7 @@ async function createCard (details) { card = card.replace(/AppName/g, details.name); 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(/StateColor/g, state_color); card = card.replace(/AppLink/g, links.value); @@ -406,7 +408,7 @@ export const Stats = async (req, res) => { break; } let info = `
-
`; +
`; res.send(info); } @@ -421,7 +423,7 @@ export async function addAlert (session, type, message) {   ${message} - + `; } @@ -467,11 +469,7 @@ export const Chart = async (req, res) => { stats[name].ramArray = stats[name].ramArray.slice(-15); let chart = ` ` res.send(chart); } \ No newline at end of file diff --git a/router/index.js b/router/index.js index 59f4d4a..2549aae 100644 --- a/router/index.js +++ b/router/index.js @@ -26,8 +26,13 @@ router.post("/uninstall", adminOnly, Uninstall); // Search (testing) router.post("/search", function (req, res) { - console.log(req.body); - console.log(req.header('hx-current-url')); + let path = req.header('hx-current-url'); + // http://localhost:8000/dashboard + let search_from = path.split("/").pop(); + // dashboard + if (search_from == "dashboard") { + DashboardAction(req, res); + } }); // Routes