Commit bfebfa33 authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl

trying fixing date issues. working in showing starttime. NOT working in actual data.

parent 5222ef3d
...@@ -3,6 +3,7 @@ library(shiny) ...@@ -3,6 +3,7 @@ library(shiny)
library(jsonlite) library(jsonlite)
library(DT) library(DT)
library(webshot) library(webshot)
library(knitr)
server <- function(input, output, session) { server <- function(input, output, session) {
...@@ -29,8 +30,10 @@ server <- function(input, output, session) { ...@@ -29,8 +30,10 @@ server <- function(input, output, session) {
lastCoConUT <<- inFile$name lastCoConUT <<- inFile$name
print("coconut:") print("coconut:")
print(coconut.df)
#coconut.df$timestamp <- format(coconut.df$timestamp, format="%d-%B-%Y %H:%M:%S")
print(coconut.df$timestamp)
if(is.null(coconut.df$timestamp)){} if(is.null(coconut.df$timestamp)){}
else{unixTime<<-coconut.df$timestamp} else{unixTime<<-coconut.df$timestamp}
...@@ -99,15 +102,6 @@ server <- function(input, output, session) { ...@@ -99,15 +102,6 @@ server <- function(input, output, session) {
) )
}) })
#last cocoquest_name
output$lastLoadedQuest <- renderText({
if (is.null(input$quest))
return(NULL)
else lastCoCoQuest
})
#CoCoQuest Data import #CoCoQuest Data import
output$quest <- renderDataTable({ output$quest <- renderDataTable({
inFile <- input$quest inFile <- input$quest
...@@ -119,20 +113,27 @@ server <- function(input, output, session) { ...@@ -119,20 +113,27 @@ server <- function(input, output, session) {
lastCoCoQuest <<- inFile$name lastCoCoQuest <<- inFile$name
json_data_quest$unix_starttime <- as.numeric(json_data_quest$startTime)/1000 #json_data_quest$unix_starttime <- as.numeric(json_data_quest$startTime)/1000
json_data_quest$unix_endtime <- as.numeric(json_data_quest$endTime)/1000 #json_data_quest$unix_endtime <- as.numeric(json_data_quest$endTime)/1000
totalStarttime <<- anytime(json_data_quest$unix_starttime) #totalStarttime <<- anytime(c(json_data_quest$unix_starttime))
totalEndtime <<- anytime(json_data_quest$unix_endtime) #totalEndtime <<- anytime(json_data_quest$unix_endtime)
#json_data_quest$unix_starttime <- format(json_data_quest$unix_starttime, format="%d-%B-%Y %H:%M:%S")
#unix parsed #unix parsed
dat <- do.call(rbind, json_data_quest$tasks$data) dat <- do.call(rbind, json_data_quest$tasks$data)
endtimes <<- c(anytime(dat$endtime/1000)) endtimes <<- c(anytime(dat$endtime))
#endtimes <<- format(dat$endtime, format="%d-%B-%Y %H:%M:%S")
print("endtime quest")
print(endtimes)
tasks <- rep(1:length(json_data_quest$tasks$data), sapply(json_data_quest$tasks$data, nrow)) tasks <- rep(1:length(json_data_quest$tasks$data), sapply(json_data_quest$tasks$data, nrow))
together <<- c(tasks, endtimes) together <<- c(tasks, endtimes)
print("together")
print(together)
all <- rbind(together) all <- rbind(together)
#setting the table style #setting the table style
...@@ -145,13 +146,22 @@ server <- function(input, output, session) { ...@@ -145,13 +146,22 @@ server <- function(input, output, session) {
) )
) )
}) })
#last cocoquest_name
output$lastLoadedQuest <- renderText({
if (is.null(input$quest))
return(NULL)
else lastCoCoQuest
})
#cocoQuest Starttime #cocoQuest Starttime
output$totalStarttime <- renderText({ output$totalStarttime <- renderText({
if (is.null(input$quest)) if (is.null(input$quest))
return(NULL) return(NULL)
else as.POSIXct(totalStarttime) else {
print(totalStarttime) format(totalStarttime, format="%d-%B-%Y %H:%M:%S")
}
}) })
#CONTROLLS PAGE #CONTROLLS PAGE
...@@ -267,15 +277,19 @@ server <- function(input, output, session) { ...@@ -267,15 +277,19 @@ server <- function(input, output, session) {
#DownloadButton #DownloadButton
#TODO: MAKE IT WORK! #TODO: MAKE IT WORK!
observeEvent(input$screenshot,{ observeEvent(input$screenshot,{
webshot::install_phantomjs() #webshot::install_phantomjs()
cdat <<- session$clientData cdat <<- session$clientData
#print(cdat) url <- paste0(cdat$url_hostname,":", cdat$url_port,"/")
url <- paste0(cdat$url_protocol,"//",cdat$url_hostname,":", cdat$url_port, cdat$url_pathname,cdat$url_search)
print(url) print(url)
webshot::webshot(url, "webshot.png") #URL <- "http://rstudio.github.io/leaflet/"
#appshot("cocoVisR/", file = "dashboard.png", port = getOption("shiny.port"), envvars = NULL)
#webshot(URL, "dashboard.png",delay = 5.0)
#knit("dashboard.png")
port <- cdat$url_port
#webshot(url, "dashboard.png", delay = 20.0) # does NOT WORK
}) })
# url <- paste0(cdat$url_protocol,"//",cdat$url_hostname,":", cdat$url_port, cdat$url_pathname,cdat$url_search)
#output$downButton <- downloadHandler( #output$downButton <- downloadHandler(
# filename="dashboard.png", # filename="dashboard.png",
#content=function(file){ #content=function(file){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment