mirror of
https://github.com/johrpan/ubigen.git
synced 2025-10-26 19:57:24 +01:00
Hide API docs by default
This commit is contained in:
parent
4f5183aa10
commit
401e327fdc
2 changed files with 29 additions and 12 deletions
23
R/app.R
23
R/app.R
|
|
@ -4,15 +4,21 @@
|
||||||
#' @param port The port to serve the application on.
|
#' @param port The port to serve the application on.
|
||||||
#' @param custom_dataset This allows to set a custom dataset (return value of
|
#' @param custom_dataset This allows to set a custom dataset (return value of
|
||||||
#' [analyze()]) as the default dataset of the UI.
|
#' [analyze()]) as the default dataset of the UI.
|
||||||
|
#' @param show_api_docs Whether to show the API documentation. Use [run_api()]
|
||||||
|
#' to actually serve the API.
|
||||||
#'
|
#'
|
||||||
#' @seealso [app()] for retrieving a Shiny app object.
|
#' @seealso [app()] for retrieving a Shiny app object.
|
||||||
#'
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
run_app <- function(host = "127.0.0.1",
|
run_app <- function(host = "127.0.0.1",
|
||||||
port = 3464,
|
port = 3464,
|
||||||
custom_dataset = NULL) {
|
custom_dataset = NULL,
|
||||||
|
show_api_docs = FALSE) {
|
||||||
runApp(
|
runApp(
|
||||||
app(custom_dataset = custom_dataset),
|
app(
|
||||||
|
custom_dataset = custom_dataset,
|
||||||
|
show_api_docs = show_api_docs
|
||||||
|
),
|
||||||
host = host,
|
host = host,
|
||||||
port = port
|
port = port
|
||||||
)
|
)
|
||||||
|
|
@ -22,14 +28,21 @@ run_app <- function(host = "127.0.0.1",
|
||||||
#'
|
#'
|
||||||
#' @param custom_dataset This allows to set a custom dataset (return value of
|
#' @param custom_dataset This allows to set a custom dataset (return value of
|
||||||
#' [analyze()]) as the default dataset of the UI.
|
#' [analyze()]) as the default dataset of the UI.
|
||||||
|
#' @param show_api_docs Whether to show the API documentation. Use [run_api()]
|
||||||
|
#' to actually serve the API.
|
||||||
#'
|
#'
|
||||||
#' @seealso [run_app()] for immediately running the application.
|
#' @seealso [run_app()] for immediately running the application.
|
||||||
#'
|
#'
|
||||||
#' @export
|
#' @export
|
||||||
app <- function(custom_dataset = NULL) {
|
app <- function(custom_dataset = NULL, show_api_docs = FALSE) {
|
||||||
shinyApp(
|
shinyApp(
|
||||||
ui(custom_dataset = custom_dataset),
|
ui(
|
||||||
server(custom_dataset = custom_dataset)
|
custom_dataset = custom_dataset,
|
||||||
|
show_api_docs = show_api_docs
|
||||||
|
),
|
||||||
|
server(
|
||||||
|
custom_dataset = custom_dataset
|
||||||
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
18
R/ui.R
18
R/ui.R
|
|
@ -1,6 +1,6 @@
|
||||||
#' Function for creating the main user interface.
|
#' Function for creating the main user interface.
|
||||||
#' @noRd
|
#' @noRd
|
||||||
ui <- function(custom_dataset = NULL) {
|
ui <- function(custom_dataset = NULL, show_api_docs = FALSE) {
|
||||||
div(
|
div(
|
||||||
custom_css(),
|
custom_css(),
|
||||||
rclipboard::rclipboardSetup(),
|
rclipboard::rclipboardSetup(),
|
||||||
|
|
@ -305,13 +305,17 @@ ui <- function(custom_dataset = NULL) {
|
||||||
includeMarkdown(system.file("content", "help.md", package = "ubigen"))
|
includeMarkdown(system.file("content", "help.md", package = "ubigen"))
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
tabPanel(
|
if (show_api_docs) {
|
||||||
title = "API access",
|
tabPanel(
|
||||||
div(
|
title = "API access",
|
||||||
class = "container",
|
div(
|
||||||
includeMarkdown(system.file("content", "api.md", package = "ubigen"))
|
class = "container",
|
||||||
|
includeMarkdown(
|
||||||
|
system.file("content", "api.md", package = "ubigen")
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue