1+ /* eslint-disable prefer-const */
12// Function for cell on going activity
23function cellActivity ( type , message ) {
34 if ( type === "loading" ) {
45 document . getElementById ( "play" ) . style . display = "none" ;
56 document . getElementById ( "activity-loader" ) . style . display = "block" ;
6- document . getElementById ( `#cell-output-${ window . current_cell } ` ) . innerHTML =
7- "" ;
7+ document . getElementById ( `out_${ window . current_cell } ` ) . innerHTML = "" ;
88 } else if ( type === "success" ) {
99 document . getElementById ( "play" ) . style . display = "block" ;
1010 document . getElementById ( "activity-loader" ) . style . display = "none" ;
11- document . getElementById (
12- `#cell-output-${ window . current_cell } `
13- ) . innerHTML = message ;
14- document . getElementById ( `#cell-output-${ window . current_cell } ` ) . style . color =
15- "white" ;
11+ document . getElementById ( `out_${ window . current_cell } ` ) . innerHTML = message ;
12+ document . getElementById ( `out_${ window . current_cell } ` ) . style . color = "white" ;
1613 } else {
1714 document . getElementById ( "play" ) . style . display = "block" ;
1815 document . getElementById ( "activity-loader" ) . style . display = "none" ;
19- document . getElementById (
20- `#cell-output-${ window . current_cell } `
21- ) . innerHTML = message ;
22- document . getElementById ( `#cell-output-${ window . current_cell } ` ) . style . color =
23- "red" ;
16+ document . getElementById ( `out_${ window . current_cell } ` ) . innerHTML = message ;
17+ document . getElementById ( `out_${ window . current_cell } ` ) . style . color = "red" ;
2418 }
2519}
2620/* eslint-disable no-eval */
@@ -196,6 +190,7 @@ const load_package = async (array, callback) => {
196190} ;
197191
198192export const load_notebook = ( dispatch ) => {
193+ let fileName = null ;
199194 const { files } = document . getElementById ( "import-notebook-file" ) ;
200195 let json_content = null ;
201196 if ( files . length > 0 ) {
@@ -207,21 +202,23 @@ export const load_notebook = (dispatch) => {
207202 dispatch ( { type : "LOAD_NOTE" , payload : json } ) ;
208203 } ;
209204 reader . readAsText ( content ) ;
205+ fileName = content . name ;
210206 }
207+ return fileName ;
211208} ;
212209/**
213210 * Returns the id of the current cell's output div
214211 */
215212function this_div ( ) {
216- const id = `#cell-output- ${ window . current_cell } ` ;
217- const rand_div_name = `random_div_# ${ id } ` ;
213+ const id = `out_ ${ window . current_cell } ` ;
214+ const rand_div_name = `random_div_${ id } ` ;
218215 const html = `
219216 <div class="col-md-1"></div>
220217 <div class="col-md-9" id=${ rand_div_name } >
221218 </div>
222219 <div class="col-md-2"></div>
223220 ` ;
224- document . getElementById ( id ) . append ( html ) ;
221+ document . getElementById ( id ) . innerHTML += html ;
225222 return rand_div_name ;
226223}
227224
@@ -232,13 +229,14 @@ function this_div() {
232229 */
233230// eslint-disable-next-line no-unused-vars
234231function viz ( name , callback ) {
235- console . log ( name ) ;
236232 // utility function to enabling ploting
237233 // create the ploting div needed
238-
239- const id = `#cell-output-${ window . current_cell } ` ;
240- console . log ( document . getElementById ( id ) ) ;
241- document . getElementById ( id ) . append ( `<div>ddl;</div>` ) ;
234+ // eslint-disable-next-line prefer-const
235+ let id = `out_${ window . current_cell } ` ;
236+ document . getElementById ( id ) . innerHTML += `<div id=${ name } ></div>` ;
237+ // eslint-disable-next-line no-unused-vars
238+ let cb = callback ( name ) ;
239+ console . log ( cb ) ;
242240 // eslint-disable-next-line no-unused-vars
243241}
244242/**
@@ -266,8 +264,10 @@ async function load_csv(path) {
266264 * @param {* } args
267265 */
268266function forLoop_log ( args ) {
269- const id = `#cell-output-${ window . current_cell } ` ;
270- document . getElementById ( id ) . append ( `${ args } <br />` ) ;
267+ let id = `out_${ window . current_cell } ` ;
268+ let logs = document . createElement ( "p" ) ;
269+ logs . append ( `${ args } ` ) ;
270+ document . getElementById ( id ) . append ( logs ) ;
271271}
272272
273273console . forlog = forLoop_log ;
0 commit comments