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 # r packages
RUN R -e 'install.packages("shiny")' RUN R -e 'install.packages("shiny")'
RUN R -e 'install.packages("DT")'
# copy the app directory into the image # copy the app directory into the image
COPY ./eprilog.r / COPY ./eprilog.r /
# copy status docker files # copy status docker files
COPY ./.status-docker_dockerfile /app/.status-docker COPY ./.status-docker_dockerfile /.status-docker
WORKDIR / WORKDIR /

View File

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

View File

@ -3,14 +3,23 @@
################# #################
require(shiny) require(shiny)
require(DT)
# preperation: # preperation:
# Get the status if r shiny is running in docker or not # Get the status if r shiny is running in docker or not
readRenviron("./.status-docker") readRenviron("./.status-docker")
statusDocker <- Sys.getenv("statusDockerENV") 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", ui <- navbarPage("EpriLog",
tabPanel("Eprilog", tabPanel("Brews",
sidebarLayout( sidebarLayout(
mainPanel( mainPanel(
h1('Brew History'), h1('Brew History'),
@ -46,21 +55,36 @@ 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 = "Keine Notizen"),
# submit # submit
actionButton("createEntry", "Submit new entry!", icon("save")), actionButton("createEntry", "Submit new entry!", icon("save")),
) )
) )
), ),
tabPanel("Configuration", tabPanel("Configuration",
sidebarLayout(
mainPanel( mainPanel(
h1('Add Coffees'), h1('Already available Coffees'),
h3('coming soon!') 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 # loading data from csv files
brews <- (read.csv(file = "./data/brews.csv", header = TRUE, sep = ",", row.names = 1)) 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( output$history = DT::renderDataTable(
brews, server = TRUE, brews, server = TRUE,
options = list(order = list(3, "desc"), 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 # insert new entry
observeEvent(input$createEntry, { observeEvent(input$createEntry, {
@ -125,6 +159,7 @@ server <- function(input, output){
# save changes to .csv file # save changes to .csv file
write.csv(brews, file = "./data/brews.csv") write.csv(brews, file = "./data/brews.csv")
session$reload()
}) })
} }