#403 started work on guide searching

This commit is contained in:
Mikayla Fischler 2024-06-06 23:05:22 -04:00
parent b457edbc71
commit e88e1afcc4
2 changed files with 32 additions and 18 deletions

View File

@ -6,6 +6,7 @@
-- local log = require("scada-common.log") -- local log = require("scada-common.log")
local iocontrol = require("pocket.iocontrol") local iocontrol = require("pocket.iocontrol")
local TextField = require("graphics.elements.form.text_field")
local docs = require("pocket.ui.docs") local docs = require("pocket.ui.docs")
local style = require("pocket.ui.style") local style = require("pocket.ui.style")
@ -46,9 +47,10 @@ local function new_view(root)
local list = { local list = {
{ label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(iocontrol.APP_ID.ROOT) end }, { label = " # ", tall = true, color = core.cpair(colors.black, colors.green), callback = function () db.nav.open_app(iocontrol.APP_ID.ROOT) end },
{ label = "Use", color = core.cpair(colors.black, colors.purple), callback = function () app.switcher(2) end }, { label = "\x14_?", color = core.cpair(colors.black, colors.cyan), callback = function () app.switcher(2) end },
{ label = "UIs", color = core.cpair(colors.black, colors.blue), callback = function () app.switcher(3) end }, -- { label = "Use", color = core.cpair(colors.black, colors.purple), callback = function () app.switcher(2) end },
{ label = "FPs", color = core.cpair(colors.black, colors.lightGray), callback = function () app.switcher(4) end } -- { label = "UIs", color = core.cpair(colors.black, colors.blue), callback = function () app.switcher(3) end },
-- { label = "FPs", color = core.cpair(colors.black, colors.lightGray), callback = function () app.switcher(4) end }
} }
app.set_sidebar(list) app.set_sidebar(list)
@ -58,17 +60,19 @@ local function new_view(root)
local p_width = page_div.get_width() - 2 local p_width = page_div.get_width() - 2
local main_page = app.new_page(nil, 1) local main_page = app.new_page(nil, 1)
local use_page = app.new_page(main_page, 2) local search_page = app.new_page(main_page, 2)
local uis_page = app.new_page(main_page, 3) local use_page = app.new_page(main_page, 3)
local fps_page = app.new_page(main_page, 4) local uis_page = app.new_page(main_page, 4)
local gls_page = app.new_page(main_page, 5) local fps_page = app.new_page(main_page, 5)
local gls_page = app.new_page(main_page, 6)
local home = Div{parent=page_div,x=2,width=p_width} local home = Div{parent=page_div,x=2,width=p_width}
local search = Div{parent=page_div,x=2}
local use = Div{parent=page_div,x=2,width=p_width} local use = Div{parent=page_div,x=2,width=p_width}
local uis = Div{parent=page_div,x=2,width=p_width} local uis = Div{parent=page_div,x=2,width=p_width}
local fps = Div{parent=page_div,x=2,width=p_width} local fps = Div{parent=page_div,x=2,width=p_width}
local gls = Div{parent=page_div,x=2} local gls = Div{parent=page_div,x=2}
local panes = { home, use, uis, fps, gls } local panes = { home, search, use, uis, fps, gls }
local doc_map = {} local doc_map = {}
local search_map = {} local search_map = {}
@ -83,6 +87,16 @@ local function new_view(root)
PushButton{parent=home,text="Front Panels >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=fps_page.nav_to} PushButton{parent=home,text="Front Panels >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=fps_page.nav_to}
PushButton{parent=home,text="Glossary >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=gls_page.nav_to} PushButton{parent=home,text="Glossary >",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=gls_page.nav_to}
TextBox{parent=search,y=1,text="Search",height=1,alignment=ALIGN.CENTER}
PushButton{parent=search,x=2,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=main_page.nav_to}
TextField{parent=search,x=1,y=3,width=18,fg_bg=cpair(colors.white,colors.gray)}
PushButton{parent=search,x=20,y=3,text="GO",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=function()end}
local search_results = ListBox{parent=search,x=1,y=5,scroll_height=100,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)}
TextBox{parent=search_results,text="Click 'GO' to search..."}
TextBox{parent=use,y=1,text="System Usage",height=1,alignment=ALIGN.CENTER} TextBox{parent=use,y=1,text="System Usage",height=1,alignment=ALIGN.CENTER}
PushButton{parent=use,x=2,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=main_page.nav_to} PushButton{parent=use,x=2,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=main_page.nav_to}

View File

@ -20,19 +20,19 @@ return function (data, base_page, title, items, scroll_height)
local app, page_div, panes, doc_map, search_map, btn_fg_bg, btn_active = table.unpack(data) local app, page_div, panes, doc_map, search_map, btn_fg_bg, btn_active = table.unpack(data)
local section_page = app.new_page(base_page, #panes + 1) local section_page = app.new_page(base_page, #panes + 1)
local gls_term_div = Div{parent=page_div,x=2} local section_div = Div{parent=page_div,x=2}
table.insert(panes, gls_term_div) table.insert(panes, section_div)
TextBox{parent=gls_term_div,y=1,text=title,height=1,alignment=ALIGN.CENTER} TextBox{parent=section_div,y=1,text=title,height=1,alignment=ALIGN.CENTER}
PushButton{parent=gls_term_div,x=3,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=base_page.nav_to} PushButton{parent=section_div,x=3,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=base_page.nav_to}
local gls_term_view_page = app.new_page(section_page, #panes + 1) local gls_term_view_page = app.new_page(section_page, #panes + 1)
local gls_term_view_div = Div{parent=page_div,x=2} local section_view_div = Div{parent=page_div,x=2}
table.insert(panes, gls_term_view_div) table.insert(panes, section_view_div)
TextBox{parent=gls_term_view_div,y=1,text=title,height=1,alignment=ALIGN.CENTER} TextBox{parent=section_view_div,y=1,text=title,height=1,alignment=ALIGN.CENTER}
PushButton{parent=gls_term_view_div,x=3,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=section_page.nav_to} PushButton{parent=section_view_div,x=3,y=1,text="<",fg_bg=btn_fg_bg,active_fg_bg=btn_active,callback=section_page.nav_to}
local name_list = ListBox{parent=gls_term_div,x=1,y=3,scroll_height=30,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)} local name_list = ListBox{parent=section_div,x=1,y=3,scroll_height=30,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)}
local def_list = ListBox{parent=gls_term_view_div,x=1,y=3,scroll_height=scroll_height,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)} local def_list = ListBox{parent=section_view_div,x=1,y=3,scroll_height=scroll_height,nav_fg_bg=cpair(colors.lightGray,colors.gray),nav_active=cpair(colors.white,colors.gray)}
local _end = nil local _end = nil