Skip to content

Commit 9780251

Browse files
authored
Rename DataTool to DataExplorer (#244)
1 parent 42f679a commit 9780251

File tree

7 files changed

+40
-40
lines changed

7 files changed

+40
-40
lines changed

crates/amalthea/src/comm/data_tool_comm.rs renamed to crates/amalthea/src/comm/data_explorer_comm.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*--------------------------------------------------------------------------------------------*/
44

55
//
6-
// AUTO-GENERATED from data_tool.json; do not edit.
6+
// AUTO-GENERATED from data_explorer.json; do not edit.
77
//
88

99
use serde::Deserialize;
@@ -29,10 +29,10 @@ pub struct TableSchema {
2929
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
3030
pub struct TableData {
3131
/// The columns of data
32-
pub columns: Vec<ColumnFormattedData>,
32+
pub columns: Vec<Vec<String>>,
3333

3434
/// Zero or more arrays of row labels
35-
pub row_labels: Option<Vec<ColumnFormattedData>>,
35+
pub row_labels: Option<Vec<Vec<String>>>,
3636
}
3737

3838
/// The result of applying filters to a table
@@ -331,11 +331,11 @@ pub struct GetColumnProfileParams {
331331
}
332332

333333
/**
334-
* Backend RPC request types for the data_tool comm
334+
* Backend RPC request types for the data_explorer comm
335335
*/
336336
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
337337
#[serde(tag = "method", content = "params")]
338-
pub enum DataToolBackendRequest {
338+
pub enum DataExplorerBackendRequest {
339339
/// Request schema
340340
///
341341
/// Request full schema for a table-like object
@@ -375,11 +375,11 @@ pub enum DataToolBackendRequest {
375375
}
376376

377377
/**
378-
* Backend RPC Reply types for the data_tool comm
378+
* Backend RPC Reply types for the data_explorer comm
379379
*/
380380
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
381381
#[serde(tag = "method", content = "result")]
382-
pub enum DataToolBackendReply {
382+
pub enum DataExplorerBackendReply {
383383
/// The schema for a table-like object
384384
GetSchemaReply(TableSchema),
385385

crates/amalthea/src/comm/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
pub mod base_comm;
99
pub mod comm_channel;
1010
pub mod comm_manager;
11-
pub mod data_tool_comm;
11+
pub mod data_explorer_comm;
1212
pub mod event;
1313
pub mod help_comm;
1414
pub mod plot_comm;

crates/ark/src/data_viewer/mod.rs renamed to crates/ark/src/data_explorer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
//
66
//
77

8-
pub mod r_data_tool;
8+
pub mod r_data_explorer;

crates/ark/src/data_viewer/r_data_tool.rs renamed to crates/ark/src/data_explorer/r_data_explorer.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
use std::cmp;
99

1010
use amalthea::comm::comm_channel::CommMsg;
11-
use amalthea::comm::data_tool_comm::ColumnSchema;
12-
use amalthea::comm::data_tool_comm::ColumnSchemaTypeDisplay;
13-
use amalthea::comm::data_tool_comm::DataToolBackendReply;
14-
use amalthea::comm::data_tool_comm::DataToolBackendRequest;
15-
use amalthea::comm::data_tool_comm::GetColumnProfileParams;
16-
use amalthea::comm::data_tool_comm::GetDataValuesParams;
17-
use amalthea::comm::data_tool_comm::GetSchemaParams;
18-
use amalthea::comm::data_tool_comm::SetColumnFiltersParams;
19-
use amalthea::comm::data_tool_comm::SetSortColumnsParams;
20-
use amalthea::comm::data_tool_comm::TableData;
21-
use amalthea::comm::data_tool_comm::TableSchema;
11+
use amalthea::comm::data_explorer_comm::ColumnSchema;
12+
use amalthea::comm::data_explorer_comm::ColumnSchemaTypeDisplay;
13+
use amalthea::comm::data_explorer_comm::DataExplorerBackendReply;
14+
use amalthea::comm::data_explorer_comm::DataExplorerBackendRequest;
15+
use amalthea::comm::data_explorer_comm::GetColumnProfileParams;
16+
use amalthea::comm::data_explorer_comm::GetDataValuesParams;
17+
use amalthea::comm::data_explorer_comm::GetSchemaParams;
18+
use amalthea::comm::data_explorer_comm::SetColumnFiltersParams;
19+
use amalthea::comm::data_explorer_comm::SetSortColumnsParams;
20+
use amalthea::comm::data_explorer_comm::TableData;
21+
use amalthea::comm::data_explorer_comm::TableSchema;
2222
use amalthea::comm::event::CommManagerEvent;
2323
use amalthea::socket::comm::CommInitiator;
2424
use amalthea::socket::comm::CommSocket;
@@ -45,7 +45,7 @@ use crate::r_task;
4545
use crate::thread::RThreadSafe;
4646
use crate::variables::variable::WorkspaceVariableDisplayType;
4747

48-
pub struct RDataTool {
48+
pub struct RDataExplorer {
4949
title: String,
5050
table: RThreadSafe<RObject>,
5151
comm: CommSocket,
@@ -57,7 +57,7 @@ struct Metadata {
5757
title: String,
5858
}
5959

60-
impl RDataTool {
60+
impl RDataExplorer {
6161
pub fn start(
6262
title: String,
6363
data: RObject,
@@ -68,7 +68,7 @@ impl RDataTool {
6868
let comm = CommSocket::new(
6969
CommInitiator::BackEnd,
7070
id.clone(),
71-
String::from("positron.dataTool"),
71+
String::from("positron.dataExplorer"),
7272
);
7373

7474
// To be able to `Send` the `data` to the thread to be owned by the data
@@ -136,50 +136,50 @@ impl RDataTool {
136136
}
137137
}
138138

139-
fn handle_rpc(&self, req: DataToolBackendRequest) -> anyhow::Result<DataToolBackendReply> {
139+
fn handle_rpc(&self, req: DataExplorerBackendRequest) -> anyhow::Result<DataExplorerBackendReply> {
140140
match req {
141-
DataToolBackendRequest::GetSchema(GetSchemaParams {
141+
DataExplorerBackendRequest::GetSchema(GetSchemaParams {
142142
start_index,
143143
num_columns,
144144
}) => {
145145
// TODO: Support for data frames with over 2B rows
146146
// TODO: Check bounds
147147
r_task(|| self.r_get_schema(start_index as i32, num_columns as i32))
148148
},
149-
DataToolBackendRequest::GetDataValues(GetDataValuesParams {
149+
DataExplorerBackendRequest::GetDataValues(GetDataValuesParams {
150150
row_start_index,
151151
num_rows,
152152
column_indices,
153153
}) => {
154154
// Fetch stringified data values and return
155155
r_task(|| self.r_get_data_values(row_start_index, num_rows, column_indices))
156156
},
157-
DataToolBackendRequest::SetSortColumns(SetSortColumnsParams { sort_keys: _ }) => {
157+
DataExplorerBackendRequest::SetSortColumns(SetSortColumnsParams { sort_keys: _ }) => {
158158
bail!("Data Viewer: Not yet implemented")
159159
},
160-
DataToolBackendRequest::SetColumnFilters(SetColumnFiltersParams { filters: _ }) => {
160+
DataExplorerBackendRequest::SetColumnFilters(SetColumnFiltersParams { filters: _ }) => {
161161
bail!("Data Viewer: Not yet implemented")
162162
},
163-
DataToolBackendRequest::GetColumnProfile(GetColumnProfileParams {
163+
DataExplorerBackendRequest::GetColumnProfile(GetColumnProfileParams {
164164
profile_type: _,
165165
column_index: _,
166166
}) => {
167167
bail!("Data Viewer: Not yet implemented")
168168
},
169-
DataToolBackendRequest::GetState => {
169+
DataExplorerBackendRequest::GetState => {
170170
bail!("Data Viewer: Not yet implemented")
171171
},
172172
}
173173
}
174174
}
175175

176176
// Methods that must be run on the main R thread
177-
impl RDataTool {
177+
impl RDataExplorer {
178178
fn r_get_schema(
179179
&self,
180180
start_index: i32,
181181
num_columns: i32,
182-
) -> anyhow::Result<DataToolBackendReply> {
182+
) -> anyhow::Result<DataExplorerBackendReply> {
183183
unsafe {
184184
let table = self.table.get().clone();
185185
let object = *table;
@@ -233,7 +233,7 @@ impl RDataTool {
233233
total_num_columns: total_num_columns as i64,
234234
};
235235

236-
Ok(DataToolBackendReply::GetSchemaReply(response))
236+
Ok(DataExplorerBackendReply::GetSchemaReply(response))
237237
}
238238
}
239239

@@ -242,7 +242,7 @@ impl RDataTool {
242242
row_start_index: i64,
243243
num_rows: i64,
244244
column_indices: Vec<i64>,
245-
) -> anyhow::Result<DataToolBackendReply> {
245+
) -> anyhow::Result<DataExplorerBackendReply> {
246246
unsafe {
247247
let table = self.table.get().clone();
248248
let object = *table;
@@ -297,7 +297,7 @@ impl RDataTool {
297297
row_labels: Some(vec![row_labels]),
298298
};
299299

300-
Ok(DataToolBackendReply::GetDataValuesReply(response))
300+
Ok(DataExplorerBackendReply::GetDataValuesReply(response))
301301
}
302302
}
303303
}
@@ -373,7 +373,7 @@ pub unsafe extern "C" fn ps_view_data_frame(x: SEXP, title: SEXP) -> anyhow::Res
373373
let main = RMain::get();
374374
let comm_manager_tx = main.get_comm_manager_tx().clone();
375375

376-
RDataTool::start(title, x, comm_manager_tx)?;
376+
RDataExplorer::start(title, x, comm_manager_tx)?;
377377

378378
Ok(R_NilValue)
379379
}

crates/ark/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub mod browser;
99
pub mod connections;
1010
pub mod control;
1111
pub mod dap;
12-
pub mod data_viewer;
12+
pub mod data_explorer;
1313
pub mod errors;
1414
pub mod help;
1515
pub mod help_proxy;

crates/ark/src/modules/positron/r_data_viewer.R renamed to crates/ark/src/modules/positron/r_data_explorer.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# r_data_viewer.R
2+
# r_data_explorer.R
33
#
44
# Copyright (C) 2023-2024 Posit Software, PBC. All rights reserved.
55
#

crates/ark/src/variables/r_variables.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use log::error;
3737
use log::warn;
3838
use stdext::spawn;
3939

40-
use crate::data_viewer::r_data_tool::RDataTool;
40+
use crate::data_explorer::r_data_explorer::RDataExplorer;
4141
use crate::lsp::events::EVENTS;
4242
use crate::r_task;
4343
use crate::thread::RThreadSafe;
@@ -326,7 +326,7 @@ impl RVariables {
326326
let env = self.env.get().clone();
327327
let data = PositronVariable::resolve_data_object(env, &path)?;
328328
let name = unsafe { path.get_unchecked(path.len() - 1) };
329-
RDataTool::start(name.clone(), data, self.comm_manager_tx.clone())?;
329+
RDataExplorer::start(name.clone(), data, self.comm_manager_tx.clone())?;
330330
Ok(())
331331
})
332332
}

0 commit comments

Comments
 (0)