Split monolithic datalab.js into smaller files #1318
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some minor changes, otherwise LGTM.
sources/web/datalab/static/page.js
Outdated
window.dataLayer.push(event); | ||
} | ||
|
||
function toggleSidebar() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think toggleSidebar
, showHelp
(and the following markup snippet), and lines 197-227 should move into notebook-app.js.
Should this file be called app-bar.js? It consists mostly of the common app bar scripts, like the About, restarting and managing VM, sign in/out.. etc. Common code like the xhr function should perhaps stay in datalab.js.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I renamed page.js to appbar.js and moved some common functions back into datalab.js.
As discussed offline, I will leave toggleSidebar and showHelp here for now, until we can figure out a cleaner detangling of appbar and notebook-app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I'm actually surprised this seems to be the only place we got things tangled up, given we've been editing this massive file for a long time now.
@@ -0,0 +1,93 @@ | |||
function shouldShimWebsockets() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use two space tabs for this file for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
The code that has been pulled out of datalab.js into other files has not been changed in any way other than whitespace changes.