Skip to content

Commit 0b01e95

Browse files
authored
Add a data grid control and the infrastructure to support it (#4847)
* Initial layout * tabulator and react-data-grid * Implement sorting/filtering/row rendering * Switch to just AdazzleReactDataGrid * Merge data explorer config into original * Fix compilation of webview * Data Explorer coming up * Semi working grid * Use bootstrap to handle correct themeing * Fix styles and layout * Fixup themes for hover and fix title * Fix check datascience dependencies * Fix webpack for packaging * Fix hygiene * Add news entry * Fix webview compile error caused by hygiene changes * Put contributing back to what it was before. * Fix functional tests * Fix dispose to set disposed flag.
1 parent 0268ef4 commit 0b01e95

46 files changed

Lines changed: 14539 additions & 188 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscodeignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ typings.json
2929
vsc-extension-quickstart.md
3030
vscode-python-signing.*
3131
webpack.config.js
32-
webpack.datascience-ui.config.js
32+
webpack.datascience-*.config.js
3333

3434
.github/**
3535
.mocha-reporter/**

gulpfile.js

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -332,36 +332,38 @@ async function checkDatascienceDependencies() {
332332
if (modulesInPackageLock.some(dependency => dependency.indexOf('/') !== dependency.lastIndexOf('/'))) {
333333
throwAndLogError('Dependencies detected with more than one \'/\', please update this script.');
334334
}
335-
json.chunks[0].modules.forEach(m => {
336-
const name = m.name;
337-
if (!name.startsWith('./node_modules')) {
338-
return;
339-
}
340-
const nameWithoutNodeModules = name.substring('./node_modules'.length);
341-
let moduleName1 = nameWithoutNodeModules.split('/')[1];
342-
moduleName1 = moduleName1.endsWith('!.') ? moduleName1.substring(0, moduleName1.length - 2) : moduleName1;
343-
const moduleName2 = `${nameWithoutNodeModules.split('/')[1]}/${nameWithoutNodeModules.split('/')[2]}`;
344-
345-
const matchedModules = modulesInPackageLock.filter(dependency => dependency === moduleName2 || dependency === moduleName1);
346-
switch (matchedModules.length) {
347-
case 0:
348-
throwAndLogError(`Dependency not found in package-lock.json, Dependency = '${name}, ${moduleName1}, ${moduleName2}'`);
349-
break;
350-
case 1:
351-
break;
352-
default: {
353-
throwAndLogError(`Exact Dependency not found in package-lock.json, Dependency = '${name}'`);
335+
json.children.forEach(c => {
336+
c.chunks[0].modules.forEach(m => {
337+
const name = m.name;
338+
if (!name.startsWith('./node_modules')) {
339+
return;
340+
}
341+
const nameWithoutNodeModules = name.substring('./node_modules'.length);
342+
let moduleName1 = nameWithoutNodeModules.split('/')[1];
343+
moduleName1 = moduleName1.endsWith('!.') ? moduleName1.substring(0, moduleName1.length - 2) : moduleName1;
344+
const moduleName2 = `${nameWithoutNodeModules.split('/')[1]}/${nameWithoutNodeModules.split('/')[2]}`;
345+
346+
const matchedModules = modulesInPackageLock.filter(dependency => dependency === moduleName2 || dependency === moduleName1);
347+
switch (matchedModules.length) {
348+
case 0:
349+
throwAndLogError(`Dependency not found in package-lock.json, Dependency = '${name}, ${moduleName1}, ${moduleName2}'`);
350+
break;
351+
case 1:
352+
break;
353+
default: {
354+
throwAndLogError(`Exact Dependency not found in package-lock.json, Dependency = '${name}'`);
355+
}
354356
}
355-
}
356357

357-
const moduleName = matchedModules[0];
358-
if (existingModulesCopy.has(moduleName)) {
359-
existingModulesCopy.delete(moduleName);
360-
}
361-
if (existingModules.has(moduleName) || newModules.has(moduleName)) {
362-
return;
363-
}
364-
newModules.add(moduleName);
358+
const moduleName = matchedModules[0];
359+
if (existingModulesCopy.has(moduleName)) {
360+
existingModulesCopy.delete(moduleName);
361+
}
362+
if (existingModules.has(moduleName) || newModules.has(moduleName)) {
363+
return;
364+
}
365+
newModules.add(moduleName);
366+
});
365367
});
366368

367369
const errorMessages = [];

news/1 Enhancements/4675.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a data grid control and web view panel.

package-lock.json

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.datascience-ui.dependencies.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"bail",
2424
"base16",
2525
"bintrees",
26+
"bootstrap",
2627
"character-entities-legacy",
2728
"character-reference-invalid",
2829
"classnames",
@@ -66,6 +67,7 @@
6667
"extend",
6768
"fbjs",
6869
"flat",
70+
"immutable",
6971
"inherits",
7072
"is-alphabetical",
7173
"is-alphanumerical",
@@ -106,6 +108,8 @@
106108
"react-base16-styling",
107109
"react-codemirror",
108110
"react-color",
111+
"react-data-grid",
112+
"react-data-grid-addons",
109113
"react-dom",
110114
"react-hot-loader",
111115
"react-json-tree",

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,6 +2330,7 @@
23302330
"babel-plugin-inline-json-import": "^0.3.1",
23312331
"babel-plugin-transform-runtime": "^6.23.0",
23322332
"babel-polyfill": "^6.26.0",
2333+
"bootstrap": "^4.3.1",
23332334
"chai": "^4.1.2",
23342335
"chai-arrays": "^2.0.0",
23352336
"chai-as-promised": "^7.1.1",
@@ -2356,6 +2357,7 @@
23562357
"gulp-typescript": "^4.0.1",
23572358
"html-webpack-plugin": "^3.2.0",
23582359
"husky": "^1.1.2",
2360+
"immutable": "^4.0.0-rc.12",
23592361
"is-running": "^2.1.0",
23602362
"istanbul": "^0.4.5",
23612363
"jsdom": "^12.2.0",
@@ -2368,6 +2370,8 @@
23682370
"raw-loader": "^0.5.1",
23692371
"react": "^16.5.2",
23702372
"react-codemirror": "^1.0.0",
2373+
"react-data-grid": "^6.0.2-0",
2374+
"react-data-grid-addons": "^6.0.2-0",
23712375
"react-dev-utils": "^5.0.2",
23722376
"react-dom": "^16.5.2",
23732377
"react-json-tree": "^0.11.0",

package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
"LanguageService.lsFailedToExtract": "We encountered an issue extracting the Language Server. Reverting to the alternative, Jedi. Check the Python output panel for details.",
8686
"DataScience.unknownMimeTypeFormat": "Mime type {0} is not currently supported.",
8787
"DataScience.historyTitle": "Python Interactive",
88+
"DataScience.dataExplorerTitle": "Data Viewer",
8889
"DataScience.badWebPanelFormatString": "<html><body><h1>{0} is not a valid file name</h1></body></html>",
8990
"DataScience.sessionDisposed": "Cannot execute code, session has been disposed.",
9091
"DataScience.exportDialogTitle": "Export to Jupyter Notebook",

src/client/common/application/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ export interface IWebPanelProvider {
877877
* @param: mainScriptPath: full path in the output folder to the script
878878
* @return A IWebPanel that can be used to show html pages.
879879
*/
880-
create(listener: IWebPanelMessageListener, title: string, mainScriptPath: string, embeddedCss?: string, settings?: any): IWebPanel;
880+
create(viewColumn: ViewColumn, listener: IWebPanelMessageListener, title: string, mainScriptPath: string, embeddedCss?: string, settings?: any): IWebPanel;
881881
}
882882

883883
// Wraps the vsls liveshare API

src/client/common/application/webPanel.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export class WebPanel implements IWebPanel {
2222
private rootPath: string;
2323

2424
constructor(
25+
viewColumn: ViewColumn,
2526
serviceContainer: IServiceContainer,
2627
listener: IWebPanelMessageListener,
2728
title: string,
@@ -35,7 +36,7 @@ export class WebPanel implements IWebPanel {
3536
this.panel = window.createWebviewPanel(
3637
title.toLowerCase().replace(' ', ''),
3738
title,
38-
{viewColumn: ViewColumn.Two, preserveFocus: true},
39+
{viewColumn , preserveFocus: true},
3940
{
4041
enableScripts: true,
4142
retainContextWhenHidden: true,

src/client/common/application/webPanelProvider.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// Licensed under the MIT License.
33
'use strict';
44
import { inject, injectable } from 'inversify';
5+
import { ViewColumn } from 'vscode';
56

67
import { IServiceContainer } from '../../ioc/types';
78
import { IWebPanel, IWebPanelMessageListener, IWebPanelProvider } from './types';
@@ -13,7 +14,7 @@ export class WebPanelProvider implements IWebPanelProvider {
1314
}
1415

1516
// tslint:disable-next-line:no-any
16-
public create(listener: IWebPanelMessageListener, title: string, mainScriptPath: string, embeddedCss?: string, settings?: any) : IWebPanel {
17-
return new WebPanel(this.serviceContainer, listener, title, mainScriptPath, embeddedCss, settings);
17+
public create(viewColumn: ViewColumn, listener: IWebPanelMessageListener, title: string, mainScriptPath: string, embeddedCss?: string, settings?: any) : IWebPanel {
18+
return new WebPanel(viewColumn, this.serviceContainer, listener, title, mainScriptPath, embeddedCss, settings);
1819
}
1920
}

0 commit comments

Comments
 (0)