bug fixes and add config page content

This commit is contained in:
friedemann.blume 2024-01-12 21:18:29 +01:00
parent abdaedb63a
commit 62d449510b
3 changed files with 50 additions and 13 deletions

View File

@ -45,13 +45,15 @@ VOLUME [ "/data/" ]
# r packages
RUN R -e 'install.packages("shiny")'
RUN R -e 'install.packages("DT")'
# copy the app directory into the image
COPY ./eprilog.r /
# copy status docker files
COPY ./.status-docker_dockerfile /app/.status-docker
COPY ./.status-docker_dockerfile /.status-docker
WORKDIR /

View File

@ -3,8 +3,8 @@ services:
eprilog:
image: git.nucleolus.xyz/fblume/eprilog/eprilog:latest
container_name: eprilog
port:
3839:3839/tcp
ports:
- 3839:3839/tcp
volumes:
- ./data:/data
restart: unless-stopped

View File

@ -3,14 +3,23 @@
#################
require(shiny)
require(DT)
# preperation:
# Get the status if r shiny is running in docker or not
readRenviron("./.status-docker")
statusDocker <- Sys.getenv("statusDockerENV")
# loading data from csv files
brews <- (read.csv(file = "./data/brews.csv", header = TRUE, sep = ",", row.names = 1))
machines <- read.csv(file = "./data/machines.csv")
grinders <- read.csv(file = "./data/grinders.csv")
coffees <- read.csv(file = "./data/coffees.csv")
ui <- navbarPage("EpriLog",
tabPanel("Eprilog",
tabPanel("Brews",
sidebarLayout(
mainPanel(
h1('Brew History'),
@ -46,21 +55,36 @@ 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 = "Keine Notizen"),
# submit
actionButton("createEntry", "Submit new entry!", icon("save")),
)
)
),
tabPanel("Configuration",
sidebarLayout(
mainPanel(
h1('Add Coffees'),
h3('coming soon!')
)
h1('Already available Coffees'),
DT::dataTableOutput('coffees')
),
sidebarPanel(
h2('Add New Coffees'),
textInput("brandName", "Brand Name", value = ""),
textInput("coffeeName", "Coffee Name", value = ""),
textInput("alias", "Nick Name", value = ""),
dateInput("expDate", "Expiration Date"),
numericInput("arabicaPercentage", "Arabica Percentage", value = "50"),
numericInput("robustaPercentage", "Robusta Percentage", value = "50"),
numericInput("sourPercentage", "Sourness Percentage", value = "50"),
numericInput("strongnessPercentage", "Strongness Percentage", value = "50"),
numericInput("roastDarknessPercentage", "Roast Darkness Percentage", value = 50),
textInput("originCountry", "Origin County of the Coffee", value = "Coffee World"),
)
)
))
server <- function(input, output){
server <- function(input, output, session){
# loading data from csv files
brews <- (read.csv(file = "./data/brews.csv", header = TRUE, sep = ",", row.names = 1))
@ -72,9 +96,19 @@ server <- function(input, output){
output$history = DT::renderDataTable(
brews, server = TRUE,
options = list(order = list(3, "desc"),
columnDefs = list(list(visible = FALSE, targets = c(1,2,10,11,12,13,14,15,16)))
list(scrollX = TRUE),
columnDefs = list(list(visible = FALSE, targets = c(1,2,3,10,11,12,13,14,15,16)))
))
output$coffees = DT::renderDataTable(
coffees, server = TRUE,
options = list(scrollX = TRUE)
#colnames = c("ID", "Brand Name", "Coffee Name", )
#options = list(order = list(3, "desc")
#columnDefs = list(list(visible = FALSE, targets = c(1,2,10,11,12,13,14,15,16)))
)
# insert new entry
observeEvent(input$createEntry, {
@ -125,6 +159,7 @@ server <- function(input, output){
# save changes to .csv file
write.csv(brews, file = "./data/brews.csv")
session$reload()
})
}