Skip to content

Commit

Permalink
Adopt new mimetype schema
Browse files Browse the repository at this point in the history
  • Loading branch information
gnestor committed Mar 5, 2017
1 parent 05a5440 commit 39a6ef1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions labextension/src/doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export class DocWidget extends Widget {
if (this.isAttached) {
const content = this._context.model.toString();
try {
const { resources: [ props ] } = JSON.parse(content);
ReactDOM.render(<JSONTable {...props} />, this.node);
const { data, schema } = JSON.parse(content);
ReactDOM.render(<JSONTable data={data} schema={schema} />, this.node);
} catch (error) {
const ErrorDisplay = props => (
<div
Expand Down
7 changes: 4 additions & 3 deletions labextension/src/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@ export class OutputWidget extends Widget {
* A render function given the widget's DOM node.
*/
_render() {
const { resources: [ props ] } = this._data.get(this._mimeType);
const { data, schema } = this._data.get(this._mimeType);
// const metadata = this._metadata.get(this._mimeType);
if (props) ReactDOM.render(<JSONTable {...props} />, this.node);
// if (data)
ReactDOM.render(<JSONTable data={data} schema={schema} />, this.node);
this._data.set(
'text/html',
ReactDOMServer.renderToStaticMarkup(<JSONTable {...props} />)
ReactDOMServer.renderToStaticMarkup(<JSONTable data={data} schema={schema} />)
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions nbextension/src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ const CLASS_NAME = 'output_JSONTable rendered_html';
/**
* Render data to the output area
*/
function render(data, node) {
const { resources: [ props ] } = data;
ReactDOM.render(<JSONTable {...props} />, node);
function render(json, node) {
const { data, schema } = json;
ReactDOM.render(<JSONTable data={data} schema={schema} />, node);
}

/**
Expand Down

0 comments on commit 39a6ef1

Please sign in to comment.