這是我在使用{polished}and時遇到的一個復雜的邏輯執行{brochure}。當按照開發團隊給出的示例的相同順序將secure_ui/secure_server放入 a時,Shiny App 在基礎架構上的部署方式會發生變化。我不確定將 polsiehd 邏輯遷移到哪里。brochure::Page(){polished}{brochure}
差異
- 沒有 global.R 檔案
brochureApp() - 多次呼叫不同的 module_ui/server 函式,因為每個函式
brochure::page()都是它自己的閃亮會話 - 單頁 shinyApp 與真正的多頁 shinyApp
uj5u.com熱心網友回復:
當需要合并這兩個邏輯時,您必須:
- 移入
polished_config()--globals.R>golem::runApp()[啟動全域設定brochureApp()]
run_app <- function(
onStart = NULL,
options = list(),
enableBookmarking = NULL,
...
) {
# old 'globals.R' logic
polished_config(
app_name = "humblFinance",
api_key = "2JmavWZtcHBIifVl0FpPtczZjk7zfhvV6O"
)
with_golem_options(
app = brochureApp(
# Putting the resources here
golem_add_external_resources(),
page1(),
),
golem_opts = list(...)
)
}
- 包裝每個
brochure::page() ui/server with拋光的::secure_ui/server()`
# an example login page
login <- function(id = "login", href = "/login") {
page(
href = href,
ui = secure_ui(
mod_login_ui(id = id),
sign_in_page_ui = sign_in_custom()
),
server = secure_server(
function(input, output, session) {
mod_login_server(id = id)
}
)
)
}
筆記
sign_in_custom()是一個回傳自定義 UI 物件polished::sign_in_default()以創建個人業務網頁的函式。我建議包裝polished::sign_in_default()在自定義全域函式中,因為您需要在任何時候都定義它,brochure::page()因為您希望在polished身份驗證之后受到保護。
once you authenticate one page through polished, you will be able to access all other protected pages while you are still logged in. After loggign out and attempting to access any one of the protected pages will result in a custom login page
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/438754.html
