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))
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",
tabPanel("Brews",
@ -29,8 +31,8 @@ ui <- navbarPage("EpriLog",
sidebarPanel(
h1('New Entry'),
dateInput("date", "Date:"), #maybe better to automatically generate with time
selectInput("alias", "Whats the nick name of the coffee?", coffees$alias, multiple = FALSE),
selectInput("coffeeName", "Whats the name of the coffee?", coffees$coffeeName, 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),
# Grind Time
sliderInput("grindTime", "Ginding Time", value = 14, min = 0, max = 30),
# Grind Size
@ -56,7 +58,7 @@ ui <- navbarPage("EpriLog",
# Siebeinsatz
numericInput("portaInsert", "Siever insert size", value = 12, min = 0, max = 100),
# Notes
textInput("notes", "Notes:", value = "Keine Notizen"),
textInput("notes", "Notes:", value = "I´m satisfied with my coffee."),
# submit
actionButton("createEntry", "Submit new entry!", icon("save")),
)
@ -99,7 +101,7 @@ server <- function(input, output, session){
brews, server = TRUE,
options = list(order = list(3, "desc"),
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
@ -109,13 +111,14 @@ server <- function(input, output, session){
currentTime <- Sys.time()
# count up for new brew id
newID <- (runif(1, 1, 10000000000))
coffeeName <- "SEE_COFFEES_CSV"
# add new line entry to history
brews[nrow(brews) + 1, 1] <- newID
brews[nrow(brews), 2] <- input$date
brews[nrow(brews), 3] <- currentTime
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), 7] <- input$grindSize
brews[nrow(brews), 8] <- input$flowResult