Skip to content

Commit 844c655

Browse files
#183 wired stats update for arrow data display
+ some data view JS methods reorg for readablity
1 parent 18dc13a commit 844c655

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

web/scripts/data.view.js

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ window.addEventListener('message', event => {
2929
logMessage(`data size in bytes: ${viewData.byteLength.toLocaleString()}`);
3030
// update data viewer
3131
viewer.load(viewData.buffer);
32+
updateStats();
3233
if (toggleConfig) {
3334
// show viewer toggles on the 1st run
3435
viewer.toggleConfig();
@@ -66,36 +67,6 @@ window.addEventListener('WebComponentsReady', event => {
6667
// initialize data view on content loaded
6768
document.addEventListener('DOMContentLoaded', event => initializeDataView());
6869

69-
/**
70-
* Loads raw data source content on view data source button click.
71-
*/
72-
function viewDataSource() {
73-
vscode.postMessage({
74-
command: 'loadView',
75-
viewName: 'vscode.open',
76-
uri: `${dataUrl}`
77-
});
78-
}
79-
80-
/**
81-
* Loads initial data view info.
82-
* @param data Data info with data url, views, etc.
83-
*/
84-
function loadDataInfo(data) {
85-
// initialize data view vars
86-
dataUrl = data.uri;
87-
dataFileName = data.fileName;
88-
dataTable = data.table;
89-
dataViews = data.views;
90-
viewConfig = data.config;
91-
theme = data.theme;
92-
logLevel = data.logLevel;
93-
logMessage(`loadDataInfo()\n\n data url: ${dataUrl}\n data table: ${dataTable}`);
94-
95-
// update view config
96-
restoreConfig(viewConfig);
97-
}
98-
9970
/**
10071
* Initializes data view UI elements,
10172
* updates view state, config, and
@@ -161,6 +132,26 @@ function updateStats() {
161132
});
162133
} // end of updateStats()
163134

135+
/**
136+
* Loads initial data view info.
137+
* @param data Data info with data url, views, etc.
138+
*/
139+
function loadDataInfo(data) {
140+
// initialize data view vars
141+
dataUrl = data.uri;
142+
dataFileName = data.fileName;
143+
dataTable = data.table;
144+
dataViews = data.views;
145+
viewConfig = data.config;
146+
theme = data.theme;
147+
logLevel = data.logLevel;
148+
149+
logMessage(`loadDataInfo()\n\n data url: ${dataUrl}\n data table: ${dataTable}`);
150+
151+
// update view config
152+
restoreConfig(viewConfig);
153+
}
154+
164155
/**
165156
* Restores data view config on new data view load or new view config load.
166157
* @param viewConfig Data view config to restore.
@@ -397,6 +388,20 @@ function getData(fileName, data, schema = {}) {
397388
return tableData;
398389
} // end of getData()
399390

391+
392+
/*--------------------- Data View toolbar action handlers ----------------------*/
393+
394+
/**
395+
* Loads raw data source content on view data source button click.
396+
*/
397+
function viewDataSource() {
398+
vscode.postMessage({
399+
command: 'loadView',
400+
viewName: 'vscode.open',
401+
uri: `${dataUrl}`
402+
});
403+
}
404+
400405
/**
401406
* Saves data view config, and filtered json or csv data.
402407
*/

0 commit comments

Comments
 (0)