Beispiel #1
0
export function loadNotebook(state, action) {
  const { data } = action;
  const fetchedNotebook = commutable.fromJS(data);
  return Object.assign({}, state, {
    notebook: fetchedNotebook,
  });
}
Beispiel #2
0
 return (subject) => {
   const data = commutable.fromJS(nbData);
   subject.next({
     type: constants.SET_NOTEBOOK,
     data,
   });
 };
Beispiel #3
0
 it('converts a JSON notebook to our commutable notebook and puts in state', () => {
   const initialState = {
     app: null,
     document: initialDocument,
   };
   const data = fromJS(dummyJSON);
   const state = reducers(initialState, { type: constants.SET_NOTEBOOK, data });
   expect(state.document.getIn(['notebook', 'nbformat'])).to.equal(4);
 });
Beispiel #4
0
 fs.readFile(filename, {}, (err, data) => {
   if (err) {
     reject(err);
     console.warn('Filename not resolved, launching an empty Notebook.');
     launchNewNotebook('python3');
   } else {
     resolve(launch(fromJS(JSON.parse(data)), filename));
   }
 });
Beispiel #5
0
 it('converts a JSON notebook to our commutable notebook and puts in state', () => {
   const state = setNotebook({}, { data: fromJS(dummyJSON) });
   expect(state.notebook.get('nbformat')).to.equal(4);
 });
Beispiel #6
0
 it('converts a JSON notebook to our commutable notebook and puts in state', () => {
   const state = reducers({}, { type: constants.SET_NOTEBOOK, data: fromJS(dummyJSON) });
   expect(state.document.notebook.get('nbformat')).to.equal(4);
 });
Beispiel #7
0
const NotebookPreview = (props) => {
  const nb = props.notebook;
  const notebook = Immutable.Map.isMap(nb) ? nb : commutable.fromJS(nb);
  return <Notebook notebook={notebook} />;
};