small ux improvements + pre select last used coffee

This commit is contained in:
friedemann.blume 2024-01-12 23:20:21 +01:00
parent 2b991c3ebf
commit baa9f89cea
1 changed files with 9 additions and 6 deletions

View File

@ -17,7 +17,9 @@ machines <- (read.csv(file = "./data/machines.csv", header = TRUE, sep = ",", ro
grinders <- (read.csv(file = "./data/grinders.csv", header = TRUE, sep = ",", row.names = 1)) grinders <- (read.csv(file = "./data/grinders.csv", header = TRUE, sep = ",", row.names = 1))
coffees <- (read.csv(file = "./data/coffees.csv", header = TRUE, sep = ",", row.names = 1)) coffees <- (read.csv(file = "./data/coffees.csv", header = TRUE, sep = ",", row.names = 1))
# get last used coffee
lastUsedParameters <- tail(brews, n=1)
lastUsedParameters$Alias
ui <- navbarPage("EpriLog", ui <- navbarPage("EpriLog",
tabPanel("Brews", tabPanel("Brews",
@ -29,8 +31,8 @@ ui <- navbarPage("EpriLog",
sidebarPanel( sidebarPanel(
h1('New Entry'), h1('New Entry'),
dateInput("date", "Date:"), #maybe better to automatically generate with time dateInput("date", "Date:"), #maybe better to automatically generate with time
selectInput("alias", "Whats the nick name of the coffee?", coffees$alias, multiple = FALSE), selectInput("alias", "Whats the nick name of the coffee?", choices = coffees$alias, multiple = FALSE, selected = lastUsedParameters$Alias),
selectInput("coffeeName", "Whats the name of the coffee?", coffees$coffeeName, multiple = FALSE), #selectInput("coffeeName", "Whats the name of the coffee?", coffees$coffeeName, multiple = FALSE),
# Grind Time # Grind Time
sliderInput("grindTime", "Ginding Time", value = 14, min = 0, max = 30), sliderInput("grindTime", "Ginding Time", value = 14, min = 0, max = 30),
# Grind Size # Grind Size
@ -56,7 +58,7 @@ ui <- navbarPage("EpriLog",
# Siebeinsatz # Siebeinsatz
numericInput("portaInsert", "Siever insert size", value = 12, min = 0, max = 100), numericInput("portaInsert", "Siever insert size", value = 12, min = 0, max = 100),
# Notes # Notes
textInput("notes", "Notes:", value = "Keine Notizen"), textInput("notes", "Notes:", value = "I´m satisfied with my coffee."),
# submit # submit
actionButton("createEntry", "Submit new entry!", icon("save")), actionButton("createEntry", "Submit new entry!", icon("save")),
) )
@ -99,7 +101,7 @@ server <- function(input, output, session){
brews, server = TRUE, brews, server = TRUE,
options = list(order = list(3, "desc"), options = list(order = list(3, "desc"),
list(scrollX = TRUE), list(scrollX = TRUE),
columnDefs = list(list(visible = FALSE, targets = c(1,2,3,10,11,12,13,14,15,16))) columnDefs = list(list(visible = FALSE, targets = c(1,2,3,5,10,11,12,13,14,15,16)))
)) ))
# Creating new brew record # Creating new brew record
@ -109,13 +111,14 @@ server <- function(input, output, session){
currentTime <- Sys.time() currentTime <- Sys.time()
# count up for new brew id # count up for new brew id
newID <- (runif(1, 1, 10000000000)) newID <- (runif(1, 1, 10000000000))
coffeeName <- "SEE_COFFEES_CSV"
# add new line entry to history # add new line entry to history
brews[nrow(brews) + 1, 1] <- newID brews[nrow(brews) + 1, 1] <- newID
brews[nrow(brews), 2] <- input$date brews[nrow(brews), 2] <- input$date
brews[nrow(brews), 3] <- currentTime brews[nrow(brews), 3] <- currentTime
brews[nrow(brews), 4] <- input$alias brews[nrow(brews), 4] <- input$alias
brews[nrow(brews), 5] <- input$coffeeName brews[nrow(brews), 5] <- coffeeName
brews[nrow(brews), 6] <- input$grindTime brews[nrow(brews), 6] <- input$grindTime
brews[nrow(brews), 7] <- input$grindSize brews[nrow(brews), 7] <- input$grindSize
brews[nrow(brews), 8] <- input$flowResult brews[nrow(brews), 8] <- input$flowResult