## ----install, eval = FALSE----------------------------------------------------
# if (!requireNamespace("BiocManager", quietly = TRUE))
#     install.packages("BiocManager")
# BiocManager::install("MagellanNTK")

## ----setup, message = FALSE---------------------------------------------------
library(MagellanNTK)

## ----keytermsOrganisation, results='markup', fig.cap="Key terms definition", echo=FALSE, fig.align='center', fig.wide = TRUE----
knitr::include_graphics("./figs/keytermsOrganisation.png", error = FALSE)

## ----LaunchDemoPipeline, eval = FALSE-----------------------------------------
# wf.path <- system.file('workflow/PipelineDemo', package = 'MagellanNTK')
# MagellanNTK(wf.path, 'PipelineDemo')

## ----configfolders, results='markup', fig.cap="Mandatory folders and files", echo=FALSE, out.width='40%', fig.align='center', fig.wide = TRUE----
knitr::include_graphics("./figs/configfolders.png", error = FALSE)

## ----PipelineNameconf---------------------------------------------------------
PipelineName_conf <- function(){
  MagellanNTK::Config(
    fullname = 'PipelineName',
    mode = 'pipeline',
    steps = c("Process1", "Process2"),
    mandatory = c(FALSE, TRUE)
  )
}

## ----PipelineNameui-----------------------------------------------------------
PipelineName_ui <- function(id){
  ns <- NS(id)
}

## ----PipelineNameserver-------------------------------------------------------
PipelineName_server <- function(id,
  dataIn = reactive({NULL}),
  steps.enabled = reactive({NULL}),
  remoteReset = reactive({0}),
  steps.status = reactive({NULL}),
  current.pos = reactive({1}),
  path = NULL
){
  widgets.default.values <- NULL
  rv.custom.default.values <- NULL
  
  moduleServer(id, function(input, output, session) {
    ns <- session$ns
    
    core.code <- MagellanNTK::Get_Workflow_Core_Code(
      name = id,
      w.names = names(widgets.default.values),
      rv.custom.names = names(rv.custom.default.values)
    )
    
    eval(str2expression(core.code))
    
    eval(parse(text = MagellanNTK::Module_Return_Func()))
  })
}

## ----PipelineNameDescriptionconf----------------------------------------------
PipelineName_Description_conf <- function(){
  MagellanNTK::Config(
    mode = 'process',
    fullname = 'PipelineName_Description',
  )
}

## ----PipelineNameDescriptionui------------------------------------------------
PipelineName_Description_ui <- function(id){
  ns <- NS(id)
}

## ----PipelineNameDescriptionserver--------------------------------------------
PipelineName_Description_server <- function(id,
  dataIn = reactive({NULL}),
  steps.enabled = reactive({NULL}),
  remoteReset = reactive({0}),
  steps.status = reactive({NULL}),
  current.pos = reactive({1}),
  path = NULL,
  btnEvents = reactive({NULL})
){

  widgets.default.values <- list()
  rv.custom.default.values <- list(
    history = MagellanNTK::InitializeHistory()
  )
  
  ###########################################################################-
  #
  #----------------------------MODULE SERVER----------------------------------
  #
  ###########################################################################-
  moduleServer(id, function(input, output, session) {
    ns <- session$ns
    
    core.code <- MagellanNTK::Get_Workflow_Core_Code(
      mode = 'process',
      name = id,
      w.names = names(widgets.default.values),
      rv.custom.names = names(rv.custom.default.values)
    )
    
    eval(str2expression(core.code))

    ###########################################################################-
    #
    #-----------------------------DESCRIPTION-----------------------------------
    #
    ###########################################################################-
    output$Description <- renderUI({
      
      file <- normalizePath(file.path(
        system.file('workflow', package = 'MagellanNTK'),
        unlist(strsplit(id, '_'))[1], 
        'md', 
        paste0(id, '.Rmd')))
      
      MagellanNTK::process_layout(session,
        ns = NS(id),
        sidebar = tagList(),
        content = tagList(
          if (file.exists(file))
            includeMarkdown(file)
          else
            p('No Description available')
        )
      )
    })
    
    observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
      req(grepl('Description', btnEvents()))
      
      req(dataIn())
      rv$dataIn <- dataIn()

      rv.custom$history <- Add2History(rv.custom$history, 'Description', 'Description', 'Initialization', '-')
      
      len <- length(rv$dataIn)
      rv$dataIn[[len]] <- SetHistory(rv$dataIn[[len]], rv.custom$history)
      
      dataOut$trigger <- MagellanNTK::Timestamp()
      dataOut$value <- rv$dataIn
      rv$steps.status['Description'] <- MagellanNTK::stepStatus$VALIDATED
    })
    
    eval(parse(text = MagellanNTK::Module_Return_Func()))
  }
  )
}

## ----PipelineNameDescriptionserverdetail1, eval = FALSE-----------------------
#  widgets.default.values <- list()
# 
#   rv.custom.default.values <- list(
#     history = MagellanNTK::InitializeHistory()
#   )

## ----PipelineNameDescriptionserverdetail2, eval = FALSE-----------------------
#   moduleServer(id, function(input, output, session) {
#       ns <- session$ns
# 
#       core.code <- MagellanNTK::Get_Workflow_Core_Code(
#         mode = 'process',
#         name = id,
#         w.names = names(widgets.default.values),
#         rv.custom.names = names(rv.custom.default.values)
#       )
# 
#       eval(str2expression(core.code))
# 
#       [...]
# 
#       eval(parse(text = MagellanNTK::Module_Return_Func()))
#   }

## ----PipelineNameDescriptionserverdetail3, eval = FALSE-----------------------
#     output$Description <- renderUI({
# 
#       file <- normalizePath(file.path(
#         system.file('workflow', package = 'MagellanNTK'),
#         unlist(strsplit(id, '_'))[1],
#         'md',
#         paste0(id, '.Rmd')))
# 
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList(
#           if (file.exists(file))
#             includeMarkdown(file)
#           else
#             p('No Description available')
#         )
#       )
#     })

## ----PipelineNameDescriptionserverdetail4, eval = FALSE-----------------------
#   observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
#         req(grepl('Description', btnEvents()))
# 
#         req(dataIn())
#         rv$dataIn <- dataIn()
# 
#         rv.custom$history <- Add2History(rv.custom$history, 'Description', 'Description', 'Initialization', '-')
# 
#         len <- length(rv$dataIn)
#         rv$dataIn[[len]] <- SetHistory(rv$dataIn[[len]], rv.custom$history)
# 
#         dataOut$trigger <- MagellanNTK::Timestamp()
#         dataOut$value <- rv$dataIn
#         rv$steps.status['Description'] <- MagellanNTK::stepStatus$VALIDATED
#       })

## ----PipelineNameProcess1conf-------------------------------------------------
PipelineName_Process1_conf <- function(){
  MagellanNTK::Config(
    fullname = 'PipelineName_Process1',
    mode = 'process',
    steps = c('Sub-step 1'),
    mandatory = c(TRUE)
  )
}

## ----PipelineNameProcess1ui---------------------------------------------------
PipelineName_Process1_ui <- function(id){
  ns <- NS(id)
}

## ----PipelineNameProcess1server, eval = FALSE---------------------------------
# PipelineName_Process1_server <- function(id,
#   dataIn = reactive({NULL}),
#   steps.enabled = reactive({NULL}),
#   remoteReset = reactive({0}),
#   steps.status = reactive({NULL}),
#   current.pos = reactive({1}),
#   path = NULL,
#   btnEvents = reactive({NULL})
# ){
# 
#   widgets.default.values <- list()
#   rv.custom.default.values <- list(
#     history = MagellanNTK::InitializeHistory()
#   )
# 
#   ###########################################################################-
#   #
#   #----------------------------MODULE SERVER----------------------------------
#   #
#   ###########################################################################-
#   moduleServer(id, function(input, output, session) {
#     ns <- session$ns
# 
#     core.code <- MagellanNTK::Get_Workflow_Core_Code(
#       mode = 'process',
#       name = id,
#       w.names = names(widgets.default.values),
#       rv.custom.names = names(rv.custom.default.values)
#     )
# 
#     eval(str2expression(core.code))
# 
#     ###########################################################################-
#     #
#     #-----------------------------DESCRIPTION-----------------------------------
#     #
#     ###########################################################################-
#     output$Description <- renderUI({
# 
#       file <- normalizePath(file.path(
#         system.file('workflow', package = 'MagellanNTK'),
#         unlist(strsplit(id, '_'))[1],
#         'md',
#         paste0(id, '.Rmd')))
# 
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList(
#           if (file.exists(file))
#             includeMarkdown(file)
#           else
#             p('No Description available')
#         )
#       )
#     })
# 
#     observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
#       req(grepl('Description', btnEvents()))
# 
#       req(dataIn())
#       rv$dataIn <- dataIn()
# 
#       dataOut$trigger <- MagellanNTK::Timestamp()
#       dataOut$value <- NULL
#       rv$steps.status['Description'] <- MagellanNTK::stepStatus$VALIDATED
#     })
# 
#     ###########################################################################-
#     #
#     #------------------------------SUB-STEP 1-----------------------------------
#     #
#     ###########################################################################-
#     output$Substep1 <- renderUI({
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList()
#       )
#     })
# 
#     [...]
# 
#     observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE, {
#       req(grepl('Substep1', btnEvents()))
# 
#       rv.custom$history <- Add2History(rv.custom$history, 'Process1', 'Substep1', 'A', 'xxx')
#       len <- length(rv$dataIn)
#       rv$dataIn[[len]] <- SetHistory(rv$dataIn[[len]], rv.custom$history)
# 
#       dataOut$trigger <- MagellanNTK::Timestamp()
#       dataOut$value <- NULL
#       rv$steps.status['Substep1'] <- MagellanNTK::stepStatus$VALIDATED
#     })
# 
#     ###########################################################################-
#     #
#     #----------------------------------SAVE-------------------------------------
#     #
#     ###########################################################################-
#     output$Save <- renderUI({
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList()
#       )
#     })
# 
#     observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
#       req(grepl('Save', btnEvents()))
# 
#       dataOut$trigger <- MagellanNTK::Timestamp()
#       dataOut$value <- rv$dataIn
#       rv$steps.status['Save'] <- MagellanNTK::stepStatus$VALIDATED
#     })
# 
#     eval(parse(text = MagellanNTK::Module_Return_Func()))
#   }
#   )
# }

## ----PipelineNameProcess1serverdetail1, eval = FALSE--------------------------
#  widgets.default.values <- list()
# 
#   rv.custom.default.values <- list(
#     history = MagellanNTK::InitializeHistory()
#   )

## ----PipelineNameProcess1serverdetail2, eval = FALSE--------------------------
#   moduleServer(id, function(input, output, session) {
#       ns <- session$ns
# 
#       core.code <- MagellanNTK::Get_Workflow_Core_Code(
#         mode = 'process',
#         name = id,
#         w.names = names(widgets.default.values),
#         rv.custom.names = names(rv.custom.default.values)
#       )
# 
#       eval(str2expression(core.code))
# 
#       [...]
# 
#       eval(parse(text = MagellanNTK::Module_Return_Func()))
#   }

## ----PipelineNameProcess1serverdetail3, eval = FALSE--------------------------
#     output$Description <- renderUI({
# 
#       file <- normalizePath(file.path(
#         system.file('workflow', package = 'MagellanNTK'),
#         unlist(strsplit(id, '_'))[1],
#         'md',
#         paste0(id, '.Rmd')))
# 
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList(
#           if (file.exists(file))
#             includeMarkdown(file)
#           else
#             p('No Description available')
#         )
#       )
#     })
# 
#   observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
#         req(grepl('Description', btnEvents()))
# 
#         req(dataIn())
#         rv$dataIn <- dataIn()
# 
#         dataOut$trigger <- MagellanNTK::Timestamp()
#         dataOut$value <- NULL
#         rv$steps.status['Description'] <- MagellanNTK::stepStatus$VALIDATED
#       })

## ----PipelineNameProcess1serverdetail4, eval = FALSE--------------------------
#     output$Substep1 <- renderUI({
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList()
#       )
#     })
# 
#     [...]
# 
#     observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE, {
#       req(grepl('Substep1', btnEvents()))
# 
#       rv.custom$history <- Add2History(rv.custom$history, 'Process1', 'Substep1', 'A', 'xxx')
#       len <- length(rv$dataIn)
#       rv$dataIn[[len]] <- SetHistory(rv$dataIn[[len]], rv.custom$history)
# 
#       dataOut$trigger <- MagellanNTK::Timestamp()
#       dataOut$value <- NULL
#       rv$steps.status['Substep1'] <- MagellanNTK::stepStatus$VALIDATED
#     })

## ----PipelineNameProcess1serverdetail5, eval = FALSE--------------------------
#     output$Save <- renderUI({
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList()
#       )
#     })
# 
#     observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
#       req(grepl('Save', btnEvents()))
# 
#       dataOut$trigger <- MagellanNTK::Timestamp()
#       dataOut$value <- rv$dataIn
#       rv$steps.status['Save'] <- MagellanNTK::stepStatus$VALIDATED
#     })

## ----PipelineNameSaveconf-----------------------------------------------------
PipelineName_Save_conf <- function(){
  MagellanNTK::Config(
    mode = 'process',
    fullname = 'PipelineName_Save',
  )
}

## ----PipelineNameSaveui-------------------------------------------------------
PipelineName_Save_ui <- function(id){
  ns <- NS(id)
}

## ----PipelineNameSaveserver---------------------------------------------------
PipelineName_Save_server <- function(id,
  dataIn = reactive({NULL}),
  steps.enabled = reactive({NULL}),
  remoteReset = reactive({0}),
  steps.status = reactive({NULL}),
  current.pos = reactive({1}),
  path = NULL,
  btnEvents = reactive({NULL})
){

  widgets.default.values <- list()
  rv.custom.default.values <- list()
  
  ###########################################################################-
  #
  #----------------------------MODULE SERVER----------------------------------
  #
  ###########################################################################-
  moduleServer(id, function(input, output, session) {
    ns <- session$ns
    
    core.code <- MagellanNTK::Get_Workflow_Core_Code(
      mode = 'process',
      name = id,
      w.names = names(widgets.default.values),
      rv.custom.names = names(rv.custom.default.values)
    )
    
    eval(str2expression(core.code))

    ###########################################################################-
    #
    #----------------------------------SAVE-------------------------------------
    #
    ###########################################################################-
    output$Save <- renderUI({
      
      file <- normalizePath(file.path(
        system.file('workflow', package = 'MagellanNTK'),
        unlist(strsplit(id, '_'))[1], 
        'md', 
        paste0(id, '.Rmd')))
      
      MagellanNTK::process_layout(session,
        ns = NS(id),
        sidebar = tagList(),
        content = tagList(
          if (file.exists(file))
            includeMarkdown(file)
          else
            p('No Description available')
        )
      )
    })
    
    observeEvent(req(dataIn()), {
      rv$dataIn <- dataIn()
    })
    
    observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
      req(grepl('Save', btnEvents()))
      
      dataOut$trigger <- MagellanNTK::Timestamp()
      dataOut$value <- rv$dataIn
      rv$steps.status['Save'] <- MagellanNTK::stepStatus$VALIDATED
    })
    
    eval(parse(text = MagellanNTK::Module_Return_Func()))
  }
  )
}

## ----PipelineNameSaveserverdetail1--------------------------------------------
 widgets.default.values <- list()

  rv.custom.default.values <- list()

## ----PipelineNameSaveserverdetail2, eval = FALSE------------------------------
#   moduleServer(id, function(input, output, session) {
#       ns <- session$ns
# 
#       core.code <- MagellanNTK::Get_Workflow_Core_Code(
#         mode = 'process',
#         name = id,
#         w.names = names(widgets.default.values),
#         rv.custom.names = names(rv.custom.default.values)
#       )
# 
#       eval(str2expression(core.code))
# 
#       [...]
# 
#       eval(parse(text = MagellanNTK::Module_Return_Func()))
#   }

## ----PipelineNameSaveserverdetail3, eval = FALSE------------------------------
#     output$Save <- renderUI({
# 
#       file <- normalizePath(file.path(
#         system.file('workflow', package = 'MagellanNTK'),
#         unlist(strsplit(id, '_'))[1],
#         'md',
#         paste0(id, '.Rmd')))
# 
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList(
#           if (file.exists(file))
#             includeMarkdown(file)
#           else
#             p('No Description available')
#         )
#       )
#     })

## ----PipelineNameSaveserverdetail4, eval = FALSE------------------------------
#   observeEvent(req(dataIn()), {
#       rv$dataIn <- dataIn()
#     })

## ----PipelineNameSaveserverdetail5, eval = FALSE------------------------------
#   observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
#         req(grepl('Save', btnEvents()))
# 
#         dataOut$trigger <- MagellanNTK::Timestamp()
#         dataOut$value <- rv$dataIn
#         rv$steps.status['Save'] <- MagellanNTK::stepStatus$VALIDATED
#       })

## ----PipelineNameConvertconf--------------------------------------------------
PipelineName_Convert_conf <- function(){
  MagellanNTK::Config(
    mode = 'process',
    fullname = 'PipelineName_Convert',
    steps = c('Convert sub-step 1'),
    mandatory = c(TRUE)
  )
}

## ----PipelineNameConvertui----------------------------------------------------
PipelineName_Convert_ui <- function(id){
  ns <- NS(id)
}

## ----PipelineNameConvertserver, eval = FALSE----------------------------------
# PipelineName_Convert_server <- function(id,
#   dataIn = reactive({NULL}),
#   steps.enabled = reactive({NULL}),
#   remoteReset = reactive({0}),
#   steps.status = reactive({NULL}),
#   current.pos = reactive({1}),
#   path = NULL,
#   btnEvents = reactive({NULL})
# ){
# 
#   widgets.default.values <- list()
#   rv.custom.default.values <- list(
#     history = MagellanNTK::InitializeHistory()
#   )
# 
#   ###########################################################################-
#   #
#   #----------------------------MODULE SERVER----------------------------------
#   #
#   ###########################################################################-
#   moduleServer(id, function(input, output, session) {
#     ns <- session$ns
# 
#     core.code <- MagellanNTK::Get_Workflow_Core_Code(
#       mode = 'process',
#       name = id,
#       w.names = names(widgets.default.values),
#       rv.custom.names = names(rv.custom.default.values)
#     )
# 
#     eval(str2expression(core.code))
# 
#     ###########################################################################-
#     #
#     #-----------------------------DESCRIPTION-----------------------------------
#     #
#     ###########################################################################-
#     output$Description <- renderUI({
# 
#       file <- normalizePath(file.path(
#         system.file('workflow', package = 'MagellanNTK'),
#         unlist(strsplit(id, '_'))[1],
#         'md',
#         paste0(id, '.Rmd')))
# 
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList(
#           if (file.exists(file))
#             includeMarkdown(file)
#           else
#             p('No Description available')
#         )
#       )
#     })
# 
#     observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
#       req(grepl('Description', btnEvents()))
# 
#       req(dataIn())
#       rv$dataIn <- dataIn()
# 
#       dataOut$trigger <- MagellanNTK::Timestamp()
#       dataOut$value <- rv$dataIn
#       rv$steps.status['Description'] <- MagellanNTK::stepStatus$VALIDATED
#     })
# 
#     ###########################################################################-
#     #
#     #------------------------------SUB-STEP 1-----------------------------------
#     #
#     ###########################################################################-
#     output$Convertsubstep1 <- renderUI({
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList()
#       )
#     })
# 
#     [...]
# 
#     observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE, {
#       req(grepl('Convertsubstep1', btnEvents()))
# 
#       rv.custom$history <- Add2History(rv.custom$history, 'Convert', 'Convertsubstep1', 'A', 'xxx')
#       len <- length(rv$dataIn)
#       rv$dataIn[[len]] <- SetHistory(rv$dataIn[[len]], rv.custom$history)
# 
#       dataOut$trigger <- MagellanNTK::Timestamp()
#       dataOut$value <- NULL
#       rv$steps.status['Convertsubstep1'] <- MagellanNTK::stepStatus$VALIDATED
#     })
# 
#     ###########################################################################-
#     #
#     #----------------------------------SAVE-------------------------------------
#     #
#     ###########################################################################-
#     output$Save <- renderUI({
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList()
#       )
#     })
# 
#     observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
#       req(grepl('Save', btnEvents()))
# 
#       dataOut$trigger <- MagellanNTK::Timestamp()
#       dataOut$value <- rv$dataIn
#       rv$steps.status['Save'] <- MagellanNTK::stepStatus$VALIDATED
#     })
# 
#     eval(parse(text = MagellanNTK::Module_Return_Func()))
#   }
#   )
# }

## ----PipelineNameConvertserverdetail1-----------------------------------------
widgets.default.values <- list()

rv.custom.default.values <- list()

## ----PipelineNameConvertserverdetail2, eval = FALSE---------------------------
# moduleServer(id, function(input, output, session) {
#       ns <- session$ns
# 
#       core.code <- MagellanNTK::Get_Workflow_Core_Code(
#         mode = 'process',
#         name = id,
#         w.names = names(widgets.default.values),
#         rv.custom.names = names(rv.custom.default.values)
#       )
# 
#       eval(str2expression(core.code))
# 
#       [...]
# 
#       eval(parse(text = MagellanNTK::Module_Return_Func()))
#   }

## ----PipelineNameConvertserverdetail3, eval = FALSE---------------------------
#     output$Description <- renderUI({
# 
#       file <- normalizePath(file.path(
#         system.file('workflow', package = 'MagellanNTK'),
#         unlist(strsplit(id, '_'))[1],
#         'md',
#         paste0(id, '.Rmd')))
# 
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList(
#           if (file.exists(file))
#             includeMarkdown(file)
#           else
#             p('No Description available')
#         )
#       )
#     })
# 
#   observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
#         req(grepl('Description', btnEvents()))
# 
#         req(dataIn())
#         rv$dataIn <- dataIn()
# 
#         dataOut$trigger <- MagellanNTK::Timestamp()
#         dataOut$value <- rv$dataIn
#         rv$steps.status['Description'] <- MagellanNTK::stepStatus$VALIDATED
#       })

## ----PipelineNameConvertserverdetail4, eval = FALSE---------------------------
#     output$Convertsubstep1 <- renderUI({
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList()
#       )
#     })
# 
#     [...]
# 
#     observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE, {
#       req(grepl('Convertsubstep1', btnEvents()))
# 
#       rv.custom$history <- Add2History(rv.custom$history, 'Convert', 'Convertsubstep1', 'A', 'xxx')
#       len <- length(rv$dataIn)
#       rv$dataIn[[len]] <- SetHistory(rv$dataIn[[len]], rv.custom$history)
# 
#       dataOut$trigger <- MagellanNTK::Timestamp()
#       dataOut$value <- NULL
#       rv$steps.status['Convertsubstep1'] <- MagellanNTK::stepStatus$VALIDATED
#     })

## ----PipelineNameConvertserverdetail5, eval = FALSE---------------------------
#     output$Save <- renderUI({
#       MagellanNTK::process_layout(session,
#         ns = NS(id),
#         sidebar = tagList(),
#         content = tagList()
#       )
#     })
# 
#     observeEvent(req(btnEvents()), ignoreInit = TRUE, ignoreNULL = TRUE,{
#       req(grepl('Save', btnEvents()))
# 
#       dataOut$trigger <- MagellanNTK::Timestamp()
#       dataOut$value <- rv$dataIn
#       rv$steps.status['Save'] <- MagellanNTK::stepStatus$VALIDATED
#     })

## ----LaunchPipeline, eval = FALSE---------------------------------------------
# wf.path <- system.file('workflow/PipelineName', package = 'PackageName')
# MagellanNTK(wf.path, 'PipelineName')

## ----LaunchProcess, eval = FALSE----------------------------------------------
# wf.path <- system.file('workflow/PipelineName', package = 'PackageName')
# MagellanNTK(wf.path, 'PipelineName_ProcessName')

## ----LaunchPipelineCustom, eval = FALSE---------------------------------------
# PackageApp <- function(wf.name) {
#   wf.path <- system.file(paste0("workflow/", wf.path), package = "PackageName")
#   MagellanNTK::MagellanNTK(workflow.path = wf.path,
#                            workflow.name = wf.name)
# }
# 
# PackageApp(wf.name = "PipelineName")

## ----sessioninfo--------------------------------------------------------------
sessionInfo()

