1
0
mirror of https://github.com/kepler155c/opus synced 2024-12-28 17:40:26 +00:00

Reduce peripheral calls in Network app

Add a manual refresh button instead
This commit is contained in:
xAnavrins 2021-11-16 22:59:19 -05:00
parent ce6a741690
commit 7d9029c706

View File

@ -85,8 +85,14 @@ local page = UI.Page {
title = 'Ports', title = 'Ports',
event = 'ports_hide', event = 'ports_hide',
}, },
grid = UI.ScrollingGrid { menuBar = UI.MenuBar {
y = 2, y = 2,
buttons = {
{ text = 'Refresh', event = 'ports_update' },
}
},
grid = UI.ScrollingGrid {
y = 3,
columns = { columns = {
{ heading = 'Port', key = 'port' }, { heading = 'Port', key = 'port' },
{ heading = 'State', key = 'state' }, { heading = 'State', key = 'state' },
@ -214,11 +220,16 @@ function page:eventHandler(event)
self.ports.grid:update() self.ports.grid:update()
self.ports:show() self.ports:show()
self.portsHandler = Event.onInterval(3, function() -- self.portsHandler = Event.onInterval(3, function()
-- self.ports.grid:update()
-- self.ports.grid:draw()
-- self:sync()
-- end)
elseif event.type == 'ports_update' then
self.ports.grid:update() self.ports.grid:update()
self.ports.grid:draw() self.ports.grid:draw()
self:sync() self:sync()
end)
elseif event.type == 'ports_hide' then elseif event.type == 'ports_hide' then
Event.off(self.portsHandler) Event.off(self.portsHandler)