fix pack 2

This commit is contained in:
Rafał Piskorski 2021-01-22 13:42:15 +01:00
parent b2ba30db92
commit 96c515b662
5 changed files with 73 additions and 65 deletions

View File

@ -6,6 +6,7 @@ library(plotly)
library(DT) library(DT)
library(shinyjs) library(shinyjs)
library(leaflet) library(leaflet)
library(tidyverse)
#source(".R/home_module.R",encoding="utf-8") #source(".R/home_module.R",encoding="utf-8")
#source(".R/about_module.R",encoding="utf-8") #source(".R/about_module.R",encoding="utf-8")
@ -161,7 +162,7 @@ server <- shinyServer(function(input, output, session){
inlineCSS(list(.clicked = "background-color: #008375 !important")), inlineCSS(list(.clicked = "background-color: #008375 !important")),
column(12, column(12,
navbarPage("", navbarPage("",
tabPanel(a("TakeCareApp",id='takeCareApp',class = "tab-link", href = route_link("home"))), tabPanel(a("TakeCareApp",id='takeCareApp',class = "tab-link", href = route_link("/home"))),
tabPanel(a("Firmy",id="tab1",class = "tab-link", href = route_link("firms"))), tabPanel(a("Firmy",id="tab1",class = "tab-link", href = route_link("firms"))),
tabPanel(a("O nas",id="tab2",class = "tab-link", href = route_link("about"))), tabPanel(a("O nas",id="tab2",class = "tab-link", href = route_link("about"))),
tabPanel(a("Zaloguj",id="tab3",class="tab-link", href = route_link("login"))), tabPanel(a("Zaloguj",id="tab3",class="tab-link", href = route_link("login"))),

View File

@ -6,6 +6,18 @@ library(DT)
calculatorUI <- function(id){ calculatorUI <- function(id){
ns <- NS(id) ns <- NS(id)
uiOutput("calculatorPage")
}
calculatorServer <- function(input, output, session) {
calculatorRV <-reactiveValues(value=NULL)
calculatorTV <-reactiveValues(value=NULL)
output$calculatorPage<-renderUI({
if(get_page()=="calculator"){
fluidPage( fluidPage(
@ -48,12 +60,11 @@ calculatorUI <- function(id){
) )
} }
calculatorServer <- function(input, output, session) {
calculatorRV <-reactiveValues(value=NULL) })
calculatorTV <-reactiveValues(value=NULL)
output$report <- downloadHandler( output$report <- downloadHandler(

View File

@ -85,7 +85,7 @@ loginServer <- function(input, output,session) {
output$loginErr<-renderUI({ output$loginErr<-renderUI({
if (isCorrect()==TRUE){ if (isCorrect()==TRUE){
p("OK",style="color:white;text-align:center;")
}else{ }else{
p("Uzytkownik nie istnieje lub wprowadzono bledne dane",style="color:yellow;text-align:center;") p("Uzytkownik nie istnieje lub wprowadzono bledne dane",style="color:yellow;text-align:center;")
} }

View File

@ -121,10 +121,13 @@ profilServer <- function(input, output,session) {
personalDataVector <- reactiveVal() personalDataVector <- reactiveVal()
historyDataVector <- reactiveVal() historyDataVector <- reactiveVal()
activeTab<-reactiveVal()
downloadPersonalData<-reactive({ downloadPersonalData<-reactive({
r<-httr::GET("http://localhost:8080/api/profile",add_headers(Authorization=paste("Bearer",input$token,sep=" "))) r<-httr::GET("http://localhost:8080/api/profile",add_headers(Authorization=paste("Bearer",input$token,sep=" ")))
print("Reactive data")
r r
@ -133,6 +136,7 @@ profilServer <- function(input, output,session) {
downloadHistoryData<-reactive({ downloadHistoryData<-reactive({
r<-httr::GET("http://localhost:8080/api/prediction/usersPredictions/ind",add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json') r<-httr::GET("http://localhost:8080/api/prediction/usersPredictions/ind",add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json')
print("Reactive hist")
r r
@ -140,29 +144,25 @@ profilServer <- function(input, output,session) {
observe({ observe({
currPage = get_page() currPage = get_page()
if(currPage=="profile" | currPage=="calculator" | currPage=="iota"){ if(currPage=="profil" | currPage=="calculator" | currPage=="iota"){
if(currPage=="profile"){
run = paste('Shiny.onInputChange("pagePROFILE","',timestamp(),'");',sep="")
shinyjs::runjs(run)
}
else{
shinyjs::runjs('Shiny.onInputChange("profileTabs", "");')
}
session$sendCustomMessage(type='tokenHandlerAccess',(session$clientData)$url_hash) session$sendCustomMessage(type='tokenHandlerAccess',(session$clientData)$url_hash)
} }
}) })
observeEvent(input$profileTabs,{ observeEvent(input$profileTabs,{
if(input$profileTabs=="data"){ if(input$profileTabs=="data"){
personalDataVector(downloadPersonalData()) personalDataVector(downloadPersonalData())
}else if(input$profileTabs=="history"){ }else if(input$profileTabs=="history"){
historyDataVector(downloadHistoryData()) historyDataVector(downloadHistoryData())
} }
@ -246,6 +246,7 @@ profilServer <- function(input, output,session) {
output$afterLogin<-renderUI({ output$afterLogin<-renderUI({
if(get_page()=="profil"){
if(!is.null(input$auth) & length(input$auth)>0 ){ if(!is.null(input$auth) & length(input$auth)>0 ){
fluidRow( fluidRow(
@ -262,6 +263,7 @@ profilServer <- function(input, output,session) {
}else{ }else{
} }
}
}) })
@ -308,16 +310,16 @@ profilServer <- function(input, output,session) {
df_historyTable<-df_historyTable %>% df_historyTable<-df_historyTable %>%
mutate(Akcja=historyTableButtons)%>% mutate(Akcja=historyTableButtons)%>%
select(name,resultValue,localDateTime,Akcja) %>% select(name,resultValue,localDateTime,Akcja) %>%
mutate(localDateTime = (str_replace(strptime(str_replace(localDateTime,"T"," "),"%Y-%m-%d %H:%M:%S")," CET","")))%>%
rename( rename(
Nazwa = name, Nazwa = name,
Wynik = resultValue, Wynik = resultValue,
Data = localDateTime Data = localDateTime
) )
df_historyTable$Nazwa<-do.call(c, df_historyTable$Nazwa) df_historyTable$Nazwa<-do.call(c, df_historyTable$Nazwa)
df_historyTable$Wynik<-do.call(c, df_historyTable$Wynik) df_historyTable$Wynik<-do.call(c, df_historyTable$Wynik)
df_historyTable$Data<-do.call(c, df_historyTable$Data)
DT::datatable(df_historyTable,selection="none",options = list(scrollX = TRUE,language=pl))} DT::datatable(df_historyTable,selection="none",options = list(scrollX = TRUE,language=pl))}
# } # }

View File

@ -60,13 +60,7 @@ public class UserController {
HttpServletResponse httpServletResponse){ HttpServletResponse httpServletResponse){
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
try {
String jsonString = mapper.writeValueAsString(personalProfileDTO);
System.out.println(jsonString);
}catch(Exception e){
e.printStackTrace();
}
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();