New MongoQueryTab and component running nteract

This commit is contained in:
Laurent Nguyen
2020-12-02 14:22:02 +01:00
parent 84b6075ee8
commit 0c80c45e22
10 changed files with 306 additions and 46 deletions

View File

@@ -0,0 +1,43 @@
import * as React from "react";
import { ReactAdapter } from "../../../Bindings/ReactBindingHandler";
import {
NotebookComponentBootstrapper,
NotebookComponentBootstrapperOptions
} from "../NotebookComponent/NotebookComponentBootstrapper";
import MongoQueryComponent from "../MongoQueryComponent/MongoQueryComponent";
import { actions, createContentRef, createKernelRef, KernelRef } from "@nteract/core";
import { Provider } from "react-redux";
export class MongoQueryComponentAdapter extends NotebookComponentBootstrapper implements ReactAdapter {
public parameters: unknown;
private kernelRef: KernelRef;
constructor(options: NotebookComponentBootstrapperOptions) {
super(options);
if (!this.contentRef) {
this.contentRef = createContentRef();
this.kernelRef = createKernelRef();
// Request fetching notebook content
this.getStore().dispatch(
actions.fetchContent({
filepath: "mongo.ipynb",
params: {},
kernelRef: this.kernelRef,
contentRef: this.contentRef
})
);
}
}
public renderComponent(): JSX.Element {
console.log("Rendering from adapter");
return (
<Provider store={this.getStore()}>
<MongoQueryComponent contentRef={this.contentRef} kernelRef={this.kernelRef} />;
</Provider>
);
}
}