Skip to content

Commit

Permalink
Avoid adding whitespace from suppressed output (jupyter-server#289)
Browse files Browse the repository at this point in the history
* better suppression of javascript output

* Bump to 0.15.6

* remove commented imported

* relax codecov
  • Loading branch information
Zsailer authored and GitHub Enterprise committed Feb 18, 2022
1 parent 32f275f commit b72ebda
Show file tree
Hide file tree
Showing 8 changed files with 1,265 additions and 1,328 deletions.
2 changes: 1 addition & 1 deletion data_studio_jupyter_extensions/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.15.5" # pragma: no cover
__version__ = "0.15.6" # pragma: no cover
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ config.coverageThreshold = {
global: {
functions: 85,
lines: 85,
statements: -50
statements: -100
}
};
config.collectCoverageFrom = ['src/**/*.{ts,tsx}'];
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
"dependencies": {
"@jupyterlab/application": "^3.0.0",
"@jupyterlab/apputils": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/console": "^3.0.0",
"@jupyterlab/coreutils": "^5.0.0",
"@jupyterlab/docregistry": "^3.0.0",
"@jupyterlab/javascript-extension": "^3.0.0",
"@jupyterlab/logconsole": "^3.0.10",
"@jupyterlab/mainmenu": "^3.0.0",
"@jupyterlab/mainmenu-extension": "^3.0.0",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ testpaths = [
]

[tool.tbump.version]
current = "0.15.5"
current = "0.15.6"
regex = '''
(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
((?P<channel>a|b|rc|.dev)(?P<release>\d+))?
Expand Down
29 changes: 20 additions & 9 deletions src/overrideoutput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,19 @@ import {
JupyterFrontEndPlugin
} from '@jupyterlab/application';

import { ReadonlyPartialJSONObject } from '@lumino/coreutils';

import {
IRenderMime,
IRenderMimeRegistry,
RenderedHTML,
RenderedJavaScript
RenderedHTML
} from '@jupyterlab/rendermime';

import { ExperimentalRenderedJavascript } from '@jupyterlab/javascript-extension';

class CustomRenderedHTML extends RenderedHTML {
/**
* Render a mime model as html content, replacing unsupported output.
*/
render(model: IRenderMime.IMimeModel): Promise<void> {
renderModel(model: IRenderMime.IMimeModel): Promise<void> {
const data = { ...model.data };
const html = data['text/html'];
if (html && typeof html === 'string') {
Expand All @@ -31,18 +30,24 @@ class CustomRenderedHTML extends RenderedHTML {
patternFound => patternFound == true
);
if (pixiedustFound) {
// Empty any existing content in the node from previous renders
while (this.node.firstChild) {
this.node.removeChild(this.node.firstChild);
}
// Toggle the trusted class on the widget.
this.toggleClass('jp-mod-trusted', model.trusted);
return Promise.resolve();
}
}
return super.render({ ...model, data: data as ReadonlyPartialJSONObject });
return super.renderModel(model);
}
}

class CustomRenderedJavascript extends RenderedJavaScript {
class CustomRenderedJavascript extends ExperimentalRenderedJavascript {
/**
* Render a mime model as Javascript content, replacing unsupported output.
*/
render(model: IRenderMime.IMimeModel): Promise<void> {
renderModel(model: IRenderMime.IMimeModel): Promise<void> {
const data = { ...model.data };
let js = data['text/javascript'];
if (!js) {
Expand All @@ -57,10 +62,16 @@ class CustomRenderedJavascript extends RenderedJavaScript {
patternFound => patternFound == true
);
if (deprecatedJSFound) {
// Empty any existing content in the node from previous renders
while (this.node.firstChild) {
this.node.removeChild(this.node.firstChild);
}
// Toggle the trusted class on the widget.
this.toggleClass('jp-mod-trusted', model.trusted);
return Promise.resolve();
}
}
return super.render({ ...model, data: data as ReadonlyPartialJSONObject });
return super.renderModel(model);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { ISessionContext, ReactWidget } from '@jupyterlab/apputils';
import { TelemetryListener } from './telemetrylistener';

// This is managed by tbump config in pyproject.toml
const VERSION = '0.15.5';
const VERSION = '0.15.6';

// Define the error states
// https://github.pie.apple.com/pie-data-studio/notebook-service/blob/761d63604966db5918d2e491c0f89cce454b7f67/app/com/apple/datastudio/model/ResourceState.scala#L20
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.15.5
0.15.6
2,551 changes: 1,238 additions & 1,313 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit b72ebda

Please sign in to comment.