Skip to content

Commit

Permalink
Fjernet abonnement V1
Browse files Browse the repository at this point in the history
  • Loading branch information
Stein-Kato committed Jan 8, 2025
1 parent 3c94fa3 commit 3e5cff8
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 111 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Imports:
shiny,
shinyalert
Remotes:
Rapporteket/rapbase
Rapporteket/rapbase@main
License: GPL-3
Encoding: UTF-8
LazyData: true
Expand Down
1 change: 0 additions & 1 deletion R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,5 @@ app_server <- function(input, output, session) {
plots_server("plots")
samlerapport_server("samlerapport")
abonnement_server("abonnement")
abonnement_v2_server("abonnementV2")
utsending_server("utsending")
}
8 changes: 2 additions & 6 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,9 @@ app_ui <- function() {
samlerapport_ui("samlerapport")
),
shiny::tabPanel(
"Abonnement",
abonnement_ui("abonnement")
),
shiny::tabPanel(
shiny::span("Abonnement v2",
shiny::span("Abonnement",
title = "Bestill tilsending av rapporter p\u00e5 e-post"),
abonnement_v2_ui("abonnementV2")
abonnement_ui("abonnement")
),
shiny::tabPanel(
"Utsending",
Expand Down
77 changes: 25 additions & 52 deletions R/mod_abonnement.R
Original file line number Diff line number Diff line change
@@ -1,72 +1,45 @@
#' Shiny module providing GUI and server logic for the subscription tab
#' Shiny module providing GUI and server logic for the subscription v2 tab
#'
#' @param id Character string module namespace
NULL

abonnement_ui <- function(id) {
ns <- shiny::NS(id)

shiny::sidebarLayout(
shiny::sidebarPanel(
width = 3,
shiny::selectInput(
ns("subscriptionRep"), "Rapport:",
c("Samlerapport1", "Samlerapport2")
),
shiny::selectInput(
ns("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(
ns("subscribe"), "Bestill",
icon = shiny::icon("paper-plane")
)
rapbase::autoReportInput("testSubscription")
),
shiny::mainPanel(
shiny::uiOutput(ns("subscriptionContent"))
rapbase::autoReportUI("testSubscription")
)
)
}

abonnement_server <- function(id) {
shiny::moduleServer(
id,
function(input, output, session) {
ns <- session$ns

# Abonnement
## rekative verdier for aa holde rede paa endringer som skjer mens
## applikasjonen kjorer
subscription <- shiny::reactiveValues(
tab = rapbase::makeAutoReportTab(session, type = "subscription")
)

Check warning on line 19 in R/mod_abonnement.R

View workflow job for this annotation

GitHub Actions / lint

file=R/mod_abonnement.R,line=19,col=1,[trailing_whitespace_linter] Trailing whitespace is superfluous.

## lag tabell over gjeldende status for abonnement
output$activeSubscriptions <- DT::renderDataTable(
subscription$tab, server = FALSE, escape = FALSE, selection = "none",
options = list(dom = "tp", ordning = FALSE,
columnDefs = list(list(visible = FALSE, targets = 6))),
rownames = FALSE
## nye abonnement

Check warning on line 21 in R/mod_abonnement.R

View workflow job for this annotation

GitHub Actions / lint

file=R/mod_abonnement.R,line=21,col=6,[indentation_linter] Indentation should be 2 spaces but is 6 spaces.
## Objects currently shared among subscription and dispathcment
orgs <- list(Sykehus1 = 1234,
Sykehus2 = 4321)
reports <- list(

Check warning on line 25 in R/mod_abonnement.R

View workflow job for this annotation

GitHub Actions / lint

file=R/mod_abonnement.R,line=25,col=6,[indentation_linter] Indentation should be 2 spaces but is 6 spaces.
Samlerapport1 = list(
synopsis = "Automatisk samlerapport1",
fun = "samlerapport1Fun",
paramNames = c("p1", "p2"),
paramValues = c("Alder", 1)
),
Samlerapport2 = list(
synopsis = "Automatisk samlerapport2",
fun = "samlerapport2Fun",
paramNames = c("p1", "p2"),
paramValues = c("BMI", 1)
)
)

## lag side som viser status for abonnement, ogsaa naar det ikke finnes noen
output$subscriptionContent <- shiny::renderUI({
userFullName <- rapbase::getUserFullName(session)
if (length(subscription$tab) == 0) {
shiny::p(paste("Ingen aktive abonnement for", userFullName))
} else {
shiny::tagList(
shiny::p(paste0("Aktive abonnement som sendes per epost til ",
userFullName, ":")),
DT::dataTableOutput(ns("activeSubscriptions"))
)
}
})
}
## Subscription

Check warning on line 40 in R/mod_abonnement.R

View workflow job for this annotation

GitHub Actions / lint

file=R/mod_abonnement.R,line=40,col=6,[indentation_linter] Indentation should be 2 spaces but is 6 spaces.
rapbase::autoReportServer(
id = "testSubscription", registryName = "rapRegTemplate",
type = "subscription", reports = reports, orgs = orgs, freq = "quarter"
)
}

Check warning on line 45 in R/mod_abonnement.R

View workflow job for this annotation

GitHub Actions / lint

file=R/mod_abonnement.R,line=45,col=2,[trailing_blank_lines_linter] Missing terminal newline.
51 changes: 0 additions & 51 deletions R/mod_abonnementV2.R

This file was deleted.

0 comments on commit 3e5cff8

Please sign in to comment.