Skip to content

Commit 4e55cf7

Browse files
author
Fred Wu
committed
increase time out for large data, POSIXlt/POSIXct date time column support
1 parent 77054c6 commit 4e55cf7

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

R/session/vsc.R

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ get_column_def <- function(name, field, value) {
8282
if (is.null(attr(value, "class"))) {
8383
filter <- "agNumberColumnFilter"
8484
}
85-
} else if (inherits(value, "Date")) {
85+
} else if (inherits(value, "Date")
86+
|| inherits(value, "POSIXlt")
87+
|| inherits(value, "POSIXct")) {
8688
type <- "dateColumn"
8789
filter <- "agDateColumnFilter"
8890
} else if (is.logical(value)) {
@@ -181,7 +183,9 @@ dataview_table <- local({
181183
if (!is.null(fd$type) && !is.null(fd$filter)) {
182184
op <- fd$type
183185
raw <- if (fd$filterType == "date") fd$dateFrom else fd$filter
184-
lit <- if (inherits(dt1[[col_name]], "Date")) {
186+
lit <- if (inherits(dt1[[col_name]], "Date")
187+
|| inherits(dt1[[col_name]], "POSIXlt")
188+
|| inherits(dt1[[col_name]], "POSIXct")) {
185189
sprintf('as.Date("%s")', raw)
186190
} else if (is.numeric(dt1[[col_name]])) {
187191
as.numeric(raw)
@@ -205,7 +209,10 @@ dataview_table <- local({
205209
blank = sprintf('is.na(%s) | %s == ""', col_name, col_name),
206210
notBlank = sprintf('!is.na(%s) & %s != ""', col_name, col_name),
207211
inRange = {
208-
hi <- if (inherits(dt1[[col_name]], "Date") && !is.null(fd$dateTo)) {
212+
hi <- if ((inherits(dt1[[col_name]], "Date")
213+
|| inherits(dt1[[col_name]], "POSIXlt")
214+
|| inherits(dt1[[col_name]], "POSIXct"))
215+
&& !is.null(fd$dateTo)) {
209216
sprintf('as.Date("%s")', fd$dateTo)
210217
} else {
211218
as.numeric(fd$filterTo)

src/session.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ export async function showDataView(source: string, type: string, title: string,
428428

429429
// Set a timeout for the entire operation
430430
const timeoutPromise = new Promise((_, reject) => {
431-
setTimeout(() => reject(new Error('Operation timed out')), 60000); // 60 second timeout
431+
setTimeout(() => reject(new Error('Operation timed out')), 120000); // 120 second timeout
432432
});
433433

434434
const requestPromise = sessionRequest(server, {
@@ -635,8 +635,6 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
635635
const displayDataSource = {
636636
rowCount: undefined,
637637
getRows(params) {
638-
console.log("Getting rows:", params.startRow, "to", params.endRow,
639-
"Sort:", JSON.stringify(params.sortModel));
640638
641639
const msg = {
642640
command: 'fetchRows',
@@ -650,7 +648,6 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
650648
const handler = event => {
651649
const m = event.data;
652650
if (m.command === 'fetchedRows' && m.requestId === msg.requestId) {
653-
console.log('Received rows:', m.rows.length, 'First few row IDs:', m.rows.slice(0, 3).map(r => r.x1));
654651
655652
displayDataSource._TotalRows = m.totalRows;
656653
displayDataSource._TotalUnfiltered = m.totalUnfiltered;
@@ -662,7 +659,6 @@ export async function getTableHtml(webview: Webview, file: string): Promise<stri
662659
if (totalRows <= params.endRow) {
663660
lastRow = totalRows;
664661
}
665-
console.log('Success callback with lastRow:', lastRow, 'totalRows:', totalRows);
666662
params.successCallback(m.rows, lastRow);
667663
window.removeEventListener('message', handler);
668664
}

0 commit comments

Comments
 (0)