diff --git a/app/profil_module.R b/app/profil_module.R
index e53f77f..49e98b9 100644
--- a/app/profil_module.R
+++ b/app/profil_module.R
@@ -16,6 +16,11 @@ profilUI <- function(id) {
Shiny.onInputChange("token", token);
}
);'),
+ tags$script('Shiny.addCustomMessageHandler("profileActiveTabHandler",
+ function(arg) {
+ Shiny.onInputChange("profileActiveTab", 1);
+ }
+);'),
tags$style(HTML("
@@ -93,13 +98,21 @@ profilServer <- function(input, output,session) {
observe({
session$sendCustomMessage(type='tokenHandlerAccess',(session$clientData)$url_hash)
+
})
output$profileData<-renderUI({
-
+ activeTab=input$profileActiveTab
+ session$clientData$url_hash
+ print(activeTab)
+ if(length(activeTab)==0 || is.null(activeTab) || activeTab!=1){
+ shinyjs::runjs('Shiny.onInputChange("profileActiveTab", 1);')
+ }
+ else if(activeTab==1){
+
r<-httr::GET("http://localhost:8080/api/profile",add_headers(Authorization=paste("Bearer",input$token,sep=" ")))
if(r$status_code==200){
@@ -132,6 +145,9 @@ profilServer <- function(input, output,session) {
}
+ # shinyjs::runjs('Shiny.onInputChange("profileActiveTab", 1);')
+ }
+
})
output$btnEditProfile<-renderUI({
@@ -148,6 +164,8 @@ profilServer <- function(input, output,session) {
output$afterLogin<-renderUI({
if(!is.null(input$token) & length(input$token)>0 ){
+
+
@@ -160,7 +178,7 @@ profilServer <- function(input, output,session) {
tabsetPanel(type = "tabs",
tabPanel("Dane profilowe", tags$div(uiOutput("profileData")
)%>% tagAppendAttributes(class = 'content-wrapper')),
- tabPanel("Zakladka 2", tags$div(plotlyOutput("plot2",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
+ tabPanel("Historia pomiarów",value='profileTabs', tags$div(DT::dataTableOutput("historyTable",height = "auto"))%>% tagAppendAttributes(id="profileTabs",class = 'content-wrapper')),
tabPanel("Zakladka 3", tags$div(plotlyOutput("plot3",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
tabPanel("Zakladka 4", tags$div(plotlyOutput("plot4",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper')),
tabPanel("Zakladka 5", tags$div(DT::dataTableOutput("table1",height = "auto"))%>% tagAppendAttributes(class = 'content-wrapper'))
@@ -174,27 +192,61 @@ profilServer <- function(input, output,session) {
})
+ observeEvent(input$profileTabs, {
+ shinyjs::runjs(' window.location.reload();')})
+
output$plot1 <- renderPlotly({
+
g<-ggplot(mpg) +
geom_point(mapping = aes(x = displ, y = hwy))
gg<-ggplotly(g)
+
+
gg
})
- output$plot2 <- renderPlotly({
+ output$historyTable <- DT::renderDataTable({
+ activeTab = input$profileActiveTab
+ session$clientData$url_hash
+ print(activeTab)
+ if(activeTab!=2){
+ shinyjs::runjs('Shiny.onInputChange("profileActiveTab", 2);') }
+ else{
+ r<-httr::GET("http://localhost:8080/api/prediction/usersPredictions/ind",add_headers(Authorization=paste("Bearer",input$token,sep=" ")),encode = 'json')
- g<-ggplot(data = mpg, mapping = aes(x = cty, y = hwy)) +
- geom_jitter()
+ # print(typeof(do.call(c,(content(r)$predictions))))
+ # v<-do.call(c,(content(r)$predictions))
- gg<-ggplotly(g)
+ df_historyTable<-as.data.frame(do.call(rbind, (content(r)$predictions)))
+
+ # print(typeof(df_historyTable))
+ # print(df_historyTable)
+ df_historyTable<-df_historyTable %>%
+ select(name,resultValue,localDateTime) %>%
+ mutate(Akcja="TODO")%>%
+ rename(
+ Nazwa = name,
+ Wynik = resultValue,
+ Data = localDateTime
+ )
- gg
+ df_historyTable$Nazwa<-do.call(c, df_historyTable$Nazwa)
+ df_historyTable$Wynik<-do.call(c, df_historyTable$Wynik)
+ df_historyTable$Data<-do.call(c, df_historyTable$Data)
+ print(df_historyTable)
+ print(df_historyTable$Nazwa)
- })
+ # as.character(df_historyTable$Nazwa)
+ # as.numeric(df_historyTable$Wynik)
+ # as.Date(df_historyTable$Data)
+
+ DT::datatable(df_historyTable,options = list(scrollX = TRUE,language=pl))}
+
+ })
output$plot3 <- renderPlotly({
@@ -204,6 +256,8 @@ profilServer <- function(input, output,session) {
gg<-ggplotly(g)
+
+
gg
})
diff --git a/app/www/style.css b/app/www/style.css
index 7448ecc..7d1fa78 100644
--- a/app/www/style.css
+++ b/app/www/style.css
@@ -366,16 +366,29 @@ margin:0;
}
+table.dataTable{
+
+}
+
+table.dataTable td{
+ color: white;
+ text-shadow: 1px 0 0.5px black, -1px 0 0.5px black, 0 1px 0.5px black, 0 -1px 0.5px black;
+ font-family: 'Fjalla One';
+ text-align:center!important;
+}
+
table.dataTable tr:nth-child(even){
- background-color:#C7F9CC!important;
+ background-color:#00A896!important;
}
table.dataTable tr:nth-child(odd){
- background-color:#A7D7AC !important;
+ background-color:#00c7b2 !important;
}
table.dataTable th{
background-color:white !important;
+ text-align:center!important;
+ #color:#028090;
}
.datatables .dataTables_wrapper .dataTables_paginate a{
border:none;
diff --git a/backend/src/backend.iml b/backend/src/backend.iml
deleted file mode 100644
index 9c6817c..0000000
--- a/backend/src/backend.iml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/backend/src/main/java/project/services/GeneratorDTO.java b/backend/src/main/java/project/services/GeneratorDTO.java
index edd035c..2483271 100644
--- a/backend/src/main/java/project/services/GeneratorDTO.java
+++ b/backend/src/main/java/project/services/GeneratorDTO.java
@@ -27,7 +27,11 @@ public class GeneratorDTO implements Serializable {
List predictionList){
List predictionDTOS = new ArrayList<>();
for (Prediction prediction:predictionList) {
- predictionDTOS.add(new PredictionDTO(prediction));
+ PredictionDTO predictionDTO = new PredictionDTO();
+ predictionDTO.setName(prediction.getName());
+ predictionDTO.setLocalDateTime(prediction.getLocalDateTime());
+ predictionDTO.setResultValue(prediction.getResultValue());
+ predictionDTOS.add(predictionDTO);
}
return predictionDTOS;