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)
library(jsonlite)
library(DT)
library(webshot)
library(knitr)
server <- function(input, output, session) {
......@@ -29,8 +30,10 @@ server <- function(input, output, session) {
lastCoConUT <<- inFile$name
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)){}
else{unixTime<<-coconut.df$timestamp}
......@@ -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
output$quest <- renderDataTable({
inFile <- input$quest
......@@ -119,20 +113,27 @@ server <- function(input, output, session) {
lastCoCoQuest <<- inFile$name
json_data_quest$unix_starttime <- as.numeric(json_data_quest$startTime)/1000
json_data_quest$unix_endtime <- as.numeric(json_data_quest$endTime)/1000
totalStarttime <<- anytime(json_data_quest$unix_starttime)
totalEndtime <<- anytime(json_data_quest$unix_endtime)
#json_data_quest$unix_starttime <- as.numeric(json_data_quest$startTime)/1000
#json_data_quest$unix_endtime <- as.numeric(json_data_quest$endTime)/1000
#totalStarttime <<- anytime(c(json_data_quest$unix_starttime))
#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
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))
together <<- c(tasks, endtimes)
print("together")
print(together)
all <- rbind(together)
#setting the table style
......@@ -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
output$totalStarttime <- renderText({
if (is.null(input$quest))
return(NULL)
else as.POSIXct(totalStarttime)
print(totalStarttime)
else {
format(totalStarttime, format="%d-%B-%Y %H:%M:%S")
}
})
#CONTROLLS PAGE
......@@ -267,15 +277,19 @@ server <- function(input, output, session) {
#DownloadButton
#TODO: MAKE IT WORK!
observeEvent(input$screenshot,{
webshot::install_phantomjs()
#webshot::install_phantomjs()
cdat <<- session$clientData
#print(cdat)
url <- paste0(cdat$url_protocol,"//",cdat$url_hostname,":", cdat$url_port, cdat$url_pathname,cdat$url_search)
url <- paste0(cdat$url_hostname,":", cdat$url_port,"/")
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(
# filename="dashboard.png",
#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