Commit d7cd6dba authored by Conor Anderson's avatar Conor Anderson

Some more tweaks

parent 4d6d849e
......@@ -5,6 +5,8 @@ services:
conjuntool:
build: ./shiny
restart: always
volumes:
- /home/conor/git/R/conjuntool/shiny/local_settings.R:/srv/shiny-server/app/local_settings.R:ro
cjtplumb:
build: ./plumber
......
......@@ -352,23 +352,6 @@ shinyServer(function(input, output, session) {
}
)
output$download_debug_meta <- downloadHandler(
filename = "file_metadata.rds", content = function(file) {
lim <- switch(input$period_limits,
none = "none",
hind = "hind",
fore = "fore",
"none")
meta <- get_metadata(choices = get_choices_anoms(),
coords = get_coords(input$anom_city_in),
baseline = (if (lim == "fore") NULL else input$baseline_in[1]:input$baseline_in[2]),
projection = (if (lim == "hind") NULL else input$projection_in[1]:input$projection_in[2]),
model = input$mod_filter_in,
scenario = input$scen_filter_in,
ensemble = input$run_filter_in)
saveRDS(meta, file)
}
)
## ----------------------------------- ##
......@@ -388,7 +371,8 @@ shinyServer(function(input, output, session) {
key <- paste(file, input$year_in_2[1], input$year_in_2[2], sep = "_")
r <- POST(URLencode(paste0(plumber_address, "/mapseries?key=", key)),
config = list(add_headers(accept = "application/json")))
config = list(add_headers(accept = "application/octet-stream")),
authenticate(plumber_user, plumber_password))
stop_for_status(r)
map_data <- unserialize(content(r))
......@@ -457,47 +441,4 @@ shinyServer(function(input, output, session) {
}
)
### Resample Data (WIP)
# output$resample_map <- renderLeaflet({
# leaflet() %>%
# addProviderTiles("CartoDB.Positron")%>%
# setView(lng = -4, lat= 52.54, zoom = 7)
# })
#
# #Show popup on click
# observeEvent(input$resample_map_click, {
# click <- input$resample_map_click
# proxy <- leafletProxy("resample_map")
# if (input$Lat1 == -999 && input$Lon1 == -999) {
# message("First Step")
# updateNumericInput(session, "Lat1", "Lat1", value = click$lat); updateNumericInput(session, "Lon1", "Lon1", value = click$lng)
# message("Gets here")
# text <- paste("Lattitude ", click$lat, "Longtitude ", click$lng)
# proxy %>% addMarkers(click$lng, click$lat, text)
# }
# else if(input$Lat1 != -999 && input$Lon1 != -999 && (input$Lat2 == -999 || input$Lon2 == -999)) {
# updateNumericInput(session, "Lat2", value = click$lat)
# updateNumericInput(session, "Lon2", value = click$lng)
# text <- paste("Lattitude ", click$lat, "Longtitude ", click$lng)
# proxy %>% addMarkers(click$lng, click$lat, text) %>% addRectangles(click$lng, click$lat, input$Lon1, input$Lat1)
# }
# else {
# updateNumericInput(session, "Lat1", value = -999)
# updateNumericInput(session, "Lat2", value = -999)
# updateNumericInput(session, "Lon1", value = -999)
# updateNumericInput(session, "Lon2", value = -999)
# proxy %>% clearMarkers() %>% clearShapes()
# }
# })
output$source <- renderUI({
desc <- system("git log devel -n 20 --format='%cd %s' --date=short", intern = TRUE)
commits <- system("git log devel -n 20 --format='%h'", intern = TRUE)
changes <- paste0(desc, " (",
sprintf('<a href="https://gitlab.com/ConorIA/conjuntool/commit/%s" target="_blank">%s</a>', commits, commits),
") <br>")
HTML(changes)
})
})
......@@ -3,9 +3,15 @@ library("shinydashboard")
library("leaflet")
library("lubridate")
library("plotly")
library("httr")
source(dir("modules", full.names = TRUE))
r <- GET("https://gitlab.com/api/v4/projects/4693398/repository/commits",
config = list(add_headers(accept = "application/json")))
stop_for_status(r)
commits <- jsonlite::fromJSON(rawToChar(r$content))
dashboardPage(
dashboardHeader(title = "Conjuntool"),
dashboardSidebar(
......@@ -14,7 +20,6 @@ dashboardPage(
menuItem("GCM Plots", tabName = "plot", icon = icon("line-chart")),
menuItem("GCM Anomalies", tabName = "anomalies", icon = icon("thermometer-three-quarters")),
menuItem("Overlay Map", tabName = "map", icon = icon("globe")),
#menuItem("Resample", tabName = "resample", icon = icon("edit"))
menuItem("Source Code", tabName = "source", icon = icon("git"))
)
),
......@@ -26,10 +31,8 @@ dashboardPage(
fluidRow(
box(width = 12,
includeHTML("include/fontawesome5.html"),
withMathJax(includeMarkdown("../README.md")),
HTML(paste("<p align=\"right\">You are using <i>Conjuntool</i> as of git commit sha:",
system('git rev-parse --short --verify HEAD', intern = T),
"</p>"))
withMathJax(includeMarkdown("README.md")),
HTML(paste("<p align=\"right\">You are using <i>Conjuntool</i> as of git commit sha:", commits$short_id[1]))
)
)
), # End README
......@@ -119,9 +122,7 @@ dashboardPage(
br(),
conditionalPanel("output.anoms_out",
downloadButton("download_data", "Download this table"),
downloadButton("download_anom_ts", "Download full timeseries"),
downloadButton("download_debug_meta", "Download file metadata (for debugging)")
)
downloadButton("download_anom_ts", "Download full timeseries") )
)
)
), # End tab 2
......@@ -148,43 +149,23 @@ dashboardPage(
)
), # End tab 3
# # Tab 4
# tabItem(tabName = "resample",
# fluidRow(
# box(
# width = 12,
# leafletOutput("resample_map")
# )
# ),
# fluidRow(
# box(
# width = 12,
# title = "Manual Coordinates",
# collapsible = TRUE,
# collapsed = TRUE,
# column(
# width = 6,
# numericInput("Lat1", "Latitide Bound 1", value = -999, width = -999),
# numericInput("Lon1", "Longitude Bound 1", value = -999, width = -999)
# ),
# column(
# width = 6,
# numericInput("Lat2", "Latitude Bount 2", value = -999, width = -999),
# numericInput("Lon2", "Longitude Bound 2", value = -999, width = -999)
# )
# )
# )
# ), # End tab 4
# Tab 5
# Tab 4
tabItem(tabName = "source",
fluidRow(
box(width = 12,
includeMarkdown("include/source.md"),
uiOutput("source")
HTML(
paste0(
"<ul>",
paste0(
"<li>",
sprintf('<a href="https://gitlab.com/ConorIA/conjuntool/commit/%s" target="_blank">%s</a>: %s',
commits$short_id, commits$short_id, gsub("\\n", "", commits$message)), collapse = "</li>"),
"</li></ul>")
)
)
)
) # End tab 5
) # End tab 4
) # End tabItems
) # End dashboardBody
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment