refactor: Remove redundant activity log display code from dashboard
This commit is contained in:
@@ -185,36 +185,6 @@ local function drawDashboard()
|
|||||||
logY = logY + 1
|
logY = logY + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
monitor.write("╔═══ ACTIVITY LOG ═══╗")
|
|
||||||
|
|
||||||
-- Calculate how many log lines we can show (huge vertical space!)
|
|
||||||
local maxLines = h - logY - 4
|
|
||||||
|
|
||||||
for i = 1, math.min(#activityLog, maxLines) do
|
|
||||||
local entry = activityLog[i]
|
|
||||||
monitor.setCursorPos(4, logY + 2 + i)
|
|
||||||
monitor.setBackgroundColor(colors.black)
|
|
||||||
|
|
||||||
monitor.setTextColor(colors.gray)
|
|
||||||
local time = os.date("%H:%M:%S", entry.time / 1000)
|
|
||||||
monitor.write("[" .. time .. "] ")
|
|
||||||
|
|
||||||
monitor.setTextColor(entry.color)
|
|
||||||
-- Truncate long messages to fit width
|
|
||||||
local maxTextWidth = w - 18
|
|
||||||
local text = entry.text
|
|
||||||
if #text > maxTextWidth then
|
|
||||||
text = text:sub(1, maxTextWidth - 3) .. "..."
|
|
||||||
end
|
|
||||||
monitor.write(text)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Footer
|
|
||||||
monitor.setBackgroundColor(colors.gray)
|
|
||||||
monitor.setCursorPos(1, h)
|
|
||||||
monitor.clearLine()
|
|
||||||
centerText(h, "Ctrl+T to terminate | Monitoring " .. STATUS_CHANNEL .. " & " .. COMMAND_CHANNEL, colors.white, colors.gray)
|
|
||||||
end
|
|
||||||
|
|
||||||
local function addLog(text, color)
|
local function addLog(text, color)
|
||||||
table.insert(activityLog, 1, {text = text, color = color or colors.white, time = os.epoch("utc")})
|
table.insert(activityLog, 1, {text = text, color = color or colors.white, time = os.epoch("utc")})
|
||||||
|
|||||||
Reference in New Issue
Block a user