#556 WIP dynamic tank views in unit app
This commit is contained in:
@@ -9,6 +9,7 @@ local pocket = require("pocket.pocket")
|
||||
|
||||
local style = require("pocket.ui.style")
|
||||
|
||||
local dyn_tank = require("pocket.ui.pages.dynamic_tank")
|
||||
local boiler = require("pocket.ui.pages.unit_boiler")
|
||||
local reactor = require("pocket.ui.pages.unit_reactor")
|
||||
local turbine = require("pocket.ui.pages.unit_turbine")
|
||||
@@ -92,6 +93,10 @@ local function new_view(root)
|
||||
table.insert(list, { label = "T-" .. i, color = core.cpair(colors.black, colors.lightGray), callback = nav_links[id].turbine[i] })
|
||||
end
|
||||
|
||||
if #unit.tank_data_tbl > 0 then
|
||||
table.insert(list, { label = "DYN", color = core.cpair(colors.black, colors.lightGray), callback = nav_links[id].d_tank })
|
||||
end
|
||||
|
||||
app.set_sidebar(list)
|
||||
end
|
||||
|
||||
@@ -363,6 +368,15 @@ local function new_view(root)
|
||||
|
||||
--#endregion
|
||||
|
||||
--#region Dynamic Tank Tab
|
||||
|
||||
if #unit.tank_data_tbl > 0 then
|
||||
local tank_pane = Div{parent=page_div}
|
||||
nav_links[i].d_tank = dyn_tank(app, u_page, panes, tank_pane, 1, unit.tank_ps_tbl[1], update)
|
||||
end
|
||||
|
||||
--#endregion
|
||||
|
||||
util.nop()
|
||||
end
|
||||
|
||||
|
||||
48
pocket/ui/pages/dynamic_tank.lua
Normal file
48
pocket/ui/pages/dynamic_tank.lua
Normal file
@@ -0,0 +1,48 @@
|
||||
local util = require("scada-common.util")
|
||||
|
||||
local iocontrol = require("pocket.iocontrol")
|
||||
|
||||
local style = require("pocket.ui.style")
|
||||
|
||||
local core = require("graphics.core")
|
||||
|
||||
local Div = require("graphics.elements.Div")
|
||||
local TextBox = require("graphics.elements.TextBox")
|
||||
|
||||
local PushButton = require("graphics.elements.controls.PushButton")
|
||||
|
||||
local DataIndicator = require("graphics.elements.indicators.DataIndicator")
|
||||
local IconIndicator = require("graphics.elements.indicators.IconIndicator")
|
||||
local StateIndicator = require("graphics.elements.indicators.StateIndicator")
|
||||
local VerticalBar = require("graphics.elements.indicators.VerticalBar")
|
||||
|
||||
local ALIGN = core.ALIGN
|
||||
local cpair = core.cpair
|
||||
|
||||
local label = style.label
|
||||
local lu_col = style.label_unit_pair
|
||||
local text_fg = style.text_fg
|
||||
local tri_ind_s = style.icon_states.tri_ind_s
|
||||
local red_ind_s = style.icon_states.red_ind_s
|
||||
local yel_ind_s = style.icon_states.yel_ind_s
|
||||
|
||||
-- create a dynamic tank view for the unit or facility app
|
||||
---@param app pocket_app
|
||||
---@param page nav_tree_page
|
||||
---@param panes Div[]
|
||||
---@param tank_pane Div
|
||||
---@param ps psil
|
||||
---@param update function
|
||||
return function (app, page, panes, tank_pane, u_id, ps, update)
|
||||
local db = iocontrol.get_db()
|
||||
|
||||
local tank_div = Div{parent=tank_pane,x=2,width=tank_pane.get_width()-2}
|
||||
table.insert(panes, tank_div)
|
||||
|
||||
local tank_page = app.new_page(page, #panes)
|
||||
tank_page.tasks = { update }
|
||||
|
||||
TextBox{parent=tank_div,y=1,text="Dyn Tank",width=9}
|
||||
local status = StateIndicator{parent=tank_div,x=10,y=1,states=style.dtank.states,value=1,min_width=12}
|
||||
status.register(ps, "DynamicTankStateStatus", status.update)
|
||||
end
|
||||
@@ -184,6 +184,36 @@ style.turbine = {
|
||||
}
|
||||
}
|
||||
|
||||
style.dtank = {
|
||||
-- dynamic tank states
|
||||
states = {
|
||||
{
|
||||
color = cpair(colors.black, colors.yellow),
|
||||
text = "OFF-LINE"
|
||||
},
|
||||
{
|
||||
color = cpair(colors.black, colors.orange),
|
||||
text = "NOT FORMED"
|
||||
},
|
||||
{
|
||||
color = cpair(colors.black, colors.orange),
|
||||
text = "RTU FAULT"
|
||||
},
|
||||
{
|
||||
color = cpair(colors.black, colors.green),
|
||||
text = "ONLINE"
|
||||
},
|
||||
{
|
||||
color = cpair(colors.black, colors.yellow),
|
||||
text = "LOW FILL"
|
||||
},
|
||||
{
|
||||
color = cpair(colors.black, colors.green),
|
||||
text = "FILLED"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
style.imatrix = {
|
||||
-- induction matrix states
|
||||
states = {
|
||||
@@ -210,7 +240,7 @@ style.imatrix = {
|
||||
{
|
||||
color = cpair(colors.black, colors.yellow),
|
||||
text = "HIGH CHARGE"
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user