-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from HenriKajasilta/rotation
Rotation feature added - first version
- Loading branch information
Showing
10 changed files
with
181 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ Imports: | |
callr, | ||
config (>= 0.3.1), | ||
DT (>= 0.25), | ||
ggplot2, | ||
glue, | ||
golem (>= 0.3.1), | ||
htmlwidgets, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#' rotation_cycle UI Function | ||
#' | ||
#' @description A shiny Module. | ||
#' | ||
#' @param id,input,output,session Internal parameters for {shiny}. | ||
#' | ||
#' @noRd | ||
#' | ||
#' @importFrom shiny NS tagList | ||
mod_rotation_cycle_ui <- function(id){ | ||
ns <- NS(id) | ||
tagList( | ||
# Header for rotation cycle | ||
h5(textOutput("rotation_cycle_title")), | ||
#plotOutput(ns("rotation_cycle")) | ||
verbatimTextOutput(ns("rotation_cycle")) | ||
) | ||
} | ||
|
||
#' rotation_cycle Server Functions | ||
#' | ||
#' @noRd | ||
#' | ||
#' @import ggplot2 | ||
mod_rotation_cycle_server <- function(id, rotation, site, block){ # site needs to be added at some point | ||
|
||
stopifnot(is.reactive(rotation)) | ||
stopifnot(is.reactive(site)) | ||
stopifnot(is.reactive(block)) | ||
|
||
moduleServer( id, function(input, output, session){ | ||
ns <- session$ns | ||
|
||
if (dp()) message("Check the crop rotation options") | ||
rotation_status <- reactiveVal(FALSE) | ||
|
||
if (!isTruthy(site())) { return() } | ||
rotation <- read_json_file(site(), block())$rotation | ||
# Rotation status based on if there is rotation information on json -file | ||
rotation_status <- ifelse(length(rotation) != 0, TRUE, FALSE) | ||
|
||
if( length(rotation) != 0 ){ | ||
output$rotation_cycle <- renderText({ | ||
result <- paste("Rotation info") | ||
}) | ||
|
||
} else { | ||
output$rotation_cycle <- renderText({ | ||
result <- paste("Rotation information not added for this block") | ||
}) | ||
if (dp()) message("Crop rotation information not found from this site and block") | ||
} | ||
|
||
# Return true/false value | ||
return(rotation_status) | ||
|
||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.