Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aktiver feiling av github action ved lint-feil #49

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: false
LINTR_ERROR_ON_LINT: true
12 changes: 9 additions & 3 deletions R/MakeHist.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ makeHist <- function(df, var, bins, makeTable = FALSE) {

x <- df[[var]]
bins <- seq(min(x), max(x), length.out = bins + 1)
t <- graphics::hist(x, breaks = bins, col = "#154ba2", border = "white",
main = paste("Fordeling av", var), xlab = var,
ylab = "Antall")
t <- graphics::hist(
x,
breaks = bins,
col = "#154ba2",
border = "white",
main = paste("Fordeling av", var),
xlab = var,
ylab = "Antall"
)
if (makeTable) {
data.frame(GruppeMin = t$breaks[seq_len(length(t$mids))],
GruppeMax = t$breaks[2:(length(t$mids) + 1)], Antall = t$counts)
Expand Down
42 changes: 23 additions & 19 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ app_server <- function(input, output, session) {
regData <- getFakeRegData()

# Brukerinformasjon i menylinja (navbar)
output$appUserName <-
shiny::renderText(
paste(rapbase::getUserFullName(session),
rapbase::getUserRole(session), sep = ", "))
output$appUserName <- shiny::renderText(
paste(rapbase::getUserFullName(session),
rapbase::getUserRole(session), sep = ", ")
)
output$appOrgName <- shiny::renderText(rapbase::getUserReshId(session))
userInfo <-
rapbase::howWeDealWithPersonalData(session, callerPkg = "rapRegTemplate")
shiny::observeEvent(input$userInfo, {
shinyalert::shinyalert("Dette vet Rapporteket om deg:", userInfo,
type = "", imageUrl = "rap/logo.svg",
closeOnEsc = TRUE, closeOnClickOutside = TRUE,
html = TRUE, confirmButtonText = rapbase::noOptOutOk())
type = "", imageUrl = "rap/logo.svg",
closeOnEsc = TRUE, closeOnClickOutside = TRUE,
html = TRUE, confirmButtonText = rapbase::noOptOutOk())
})

# Veiledning
Expand All @@ -38,9 +38,9 @@ app_server <- function(input, output, session) {

# Figur og tabell
# Figur
output$distPlot <- shiny::renderPlot({
output$distPlot <- shiny::renderPlot({
makeHist(df = regData, var = input$var, bins = input$bins)
})
})

# Tabell
output$distTable <- shiny::renderTable({
Expand Down Expand Up @@ -83,7 +83,8 @@ app_server <- function(input, output, session) {
## rekative verdier for aa holde rede paa endringer som skjer mens
## applikasjonen kjorer
subscription <- shiny::reactiveValues(
tab = rapbase::makeAutoReportTab(session, type = "subscription"))
tab = rapbase::makeAutoReportTab(session, type = "subscription")
)

## lag tabell over gjeldende status for abonnement
output$activeSubscriptions <- DT::renderDataTable(
Expand Down Expand Up @@ -158,7 +159,8 @@ app_server <- function(input, output, session) {
interval <- strsplit(input$dispatchmentFreq, "-")[[1]][2]
intervalName <- strsplit(input$dispatchmentFreq, "-")[[1]][1]
runDayOfYear <- rapbase::makeRunDayOfYearSequence(
interval = interval)
interval = interval
)

email <- dispatchment$email
organization <- rapbase::getUserReshId(session)
Expand Down Expand Up @@ -193,19 +195,21 @@ app_server <- function(input, output, session) {
shiny::selectInput(
"dispatchmentRep", "Rapport:",
c("Automatisk samlerapport1", "Automatisk samlerapport2"),
selected = dispatchment$report)
selected = dispatchment$report
)
})

## ui: velg frekvens
output$freq <- shiny::renderUI({
shiny::selectInput(
"dispatchmentFreq", "Frekvens:",
list("\u00C5rlig" = "\u00C5rlig-year",
Kvartalsvis = "Kvartalsvis-quarter",
Maanedlig = "M\u00E5nedlig-month",
Ukentlig = "Ukentlig-week",
Daglig = "Daglig-DSTday"),
selected = dispatchment$freq)
Kvartalsvis = "Kvartalsvis-quarter",
Maanedlig = "M\u00E5nedlig-month",
Ukentlig = "Ukentlig-week",
Daglig = "Daglig-DSTday"),
selected = dispatchment$freq
)
})

## ui: legg til gyldig- og slett epost
Expand Down Expand Up @@ -240,8 +244,8 @@ app_server <- function(input, output, session) {

## lag tabell over gjeldende status for utsending
output$activeDispatchments <- DT::renderDataTable(
dispatchment$tab, server = FALSE, escape = FALSE, selection = "none",
options = list(dom = "tp", ordering = FALSE), rownames = FALSE
dispatchment$tab, server = FALSE, escape = FALSE, selection = "none",
options = list(dom = "tp", ordering = FALSE), rownames = FALSE
)


Expand Down
220 changes: 122 additions & 98 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,98 +10,121 @@ app_ui <- function() {

shiny::tagList(
shiny::navbarPage(
title = shiny::div(shiny::a(shiny::includeHTML(system.file("www/logo.svg",
package = "rapbase"))),
regTitle),
title = shiny::div(
shiny::a(shiny::includeHTML(
system.file("www/logo.svg", package = "rapbase")
)
),
regTitle
),
windowTitle = regTitle,
theme = "rap/bootstrap.css",
id = "tabs",

shiny::tabPanel("Veiledning",
shiny::mainPanel(width = 12,
shiny::htmlOutput("veiledning", inline = TRUE),
rapbase::appNavbarUserWidget(
user = shiny::uiOutput("appUserName"),
organization = shiny::uiOutput("appOrgName"),
addUserInfo = TRUE)
)
shiny::tabPanel(
"Veiledning",
shiny::mainPanel(
width = 12,
shiny::htmlOutput("veiledning", inline = TRUE),
rapbase::appNavbarUserWidget(
user = shiny::uiOutput("appUserName"),
organization = shiny::uiOutput("appOrgName"),
addUserInfo = TRUE
)
)
),
shiny::tabPanel("Figur og tabell"
,
shiny::sidebarLayout(
shiny::sidebarPanel(width = 3,
shiny::selectInput(inputId = "var",
label = "Variabel:",
c("mpg", "disp", "hp", "drat", "wt", "qsec")),
shiny::sliderInput(inputId = "bins",
label = "Antall grupper:",
min = 1,
max = 10,
value = 5)
),
shiny::mainPanel(
shiny::tabsetPanel(
shiny::tabPanel("Figur", shiny::plotOutput("distPlot")),
shiny::tabPanel("Tabell", shiny::tableOutput("distTable"))
)
)
)
shiny::tabPanel(
"Figur og tabell",
shiny::sidebarLayout(
shiny::sidebarPanel(
width = 3,
shiny::selectInput(
inputId = "var",
label = "Variabel:",
c("mpg", "disp", "hp", "drat", "wt", "qsec")
),
shiny::sliderInput(
inputId = "bins",
label = "Antall grupper:",
min = 1,
max = 10,
value = 5
)
),
shiny::mainPanel(
shiny::tabsetPanel(
shiny::tabPanel("Figur", shiny::plotOutput("distPlot")),
shiny::tabPanel("Tabell", shiny::tableOutput("distTable"))
)
)
)
),
shiny::tabPanel("Samlerapport"
,
shiny::tabPanel("Fordeling av mpg",
shiny::sidebarLayout(
shiny::sidebarPanel(
width = 3,
shiny::selectInput(
inputId = "varS",
label = "Variabel:",
c("mpg", "disp", "hp", "drat", "wt", "qsec")),
shiny::sliderInput(
inputId = "binsS",
label = "Antall grupper:",
min = 1,
max = 10,
value = 5),
shiny::selectInput(
inputId = "formatS",
label = "Velg format for nedlasting:",
choices = list(PDF = "pdf", HTML = "html")
),
shiny::downloadButton(
outputId = "downloadSamlerapport",
label = "Last ned!")
),
shiny::mainPanel(
shiny::uiOutput("samlerapport")
)
)
)
shiny::tabPanel(
"Samlerapport",
shiny::tabPanel(
"Fordeling av mpg",
shiny::sidebarLayout(
shiny::sidebarPanel(
width = 3,
shiny::selectInput(
inputId = "varS",
label = "Variabel:",
c("mpg", "disp", "hp", "drat", "wt", "qsec")
),
shiny::sliderInput(
inputId = "binsS",
label = "Antall grupper:",
min = 1,
max = 10,
value = 5
),
shiny::selectInput(
inputId = "formatS",
label = "Velg format for nedlasting:",
choices = list(PDF = "pdf", HTML = "html")
),
shiny::downloadButton(
outputId = "downloadSamlerapport",
label = "Last ned!"
)
),
shiny::mainPanel(
shiny::uiOutput("samlerapport")
)
)
)
),
shiny::tabPanel("Abonnement"
,
shiny::sidebarLayout(
shiny::sidebarPanel(width = 3,
shiny::selectInput("subscriptionRep", "Rapport:",
c("Samlerapport1", "Samlerapport2")),
shiny::selectInput("subscriptionFreq", "Frekvens:",
list("\u212brlig" = "\u212brlig-year",
Kvartalsvis = "Kvartalsvis-quarter",
"M\u00e5nedlig" = "M\u00e5nedlig-month",
Ukentlig = "Ukentlig-week",
Daglig = "Daglig-DSTday"),
selected = "M\u00e5nedlig-month"),
shiny::actionButton("subscribe", "Bestill",
icon = shiny::icon("paper-plane"))
),
shiny::mainPanel(
shiny::uiOutput("subscriptionContent")
)
)
shiny::tabPanel(
"Abonnement",
shiny::sidebarLayout(
shiny::sidebarPanel(
width = 3,
shiny::selectInput(
"subscriptionRep", "Rapport:",
c("Samlerapport1", "Samlerapport2")
),
shiny::selectInput(
"subscriptionFreq", "Frekvens:",
list("\u212brlig" = "\u212brlig-year",
Kvartalsvis = "Kvartalsvis-quarter",
"M\u00e5nedlig" = "M\u00e5nedlig-month",
Ukentlig = "Ukentlig-week",
Daglig = "Daglig-DSTday"),
selected = "M\u00e5nedlig-month"
),
shiny::actionButton(
"subscribe", "Bestill",
icon = shiny::icon("paper-plane")
)
),
shiny::mainPanel(
shiny::uiOutput("subscriptionContent")
)
)
),
shiny::tabPanel(
shiny::span("Abonnement v2",
title="Bestill tilsending av rapporter p\u00e5 e-post"),
title = "Bestill tilsending av rapporter p\u00e5 e-post"),
shiny::sidebarLayout(
shiny::sidebarPanel(
rapbase::autoReportInput("testSubscription")
Expand All @@ -111,22 +134,23 @@ app_ui <- function() {
)
)
),
shiny::tabPanel("Utsending"
,
shiny::sidebarLayout(
shiny::sidebarPanel(width = 3,
shiny::uiOutput("report"),
shiny::uiOutput("freq"),
shiny::textInput("email", "Epostmottakere:"),
shiny::uiOutput("editEmail"),
shiny::htmlOutput("recipients"),
shiny::tags$hr(),
shiny::uiOutput("makeDispatchment")
),
shiny::mainPanel(
shiny::uiOutput("dispatchmentContent")
)
)
shiny::tabPanel(
"Utsending",
shiny::sidebarLayout(
shiny::sidebarPanel(
width = 3,
shiny::uiOutput("report"),
shiny::uiOutput("freq"),
shiny::textInput("email", "Epostmottakere:"),
shiny::uiOutput("editEmail"),
shiny::htmlOutput("recipients"),
shiny::tags$hr(),
shiny::uiOutput("makeDispatchment")
),
shiny::mainPanel(
shiny::uiOutput("dispatchmentContent")
)
)
)

) # navbarPage
Expand Down
Loading