Skip to content

Commit

Permalink
Merge pull request #779 from MetaCell/feature/iframe-throttling-fix-r…
Browse files Browse the repository at this point in the history
…ebase

Cherry picked iframe visibility changes after rebase
  • Loading branch information
ddelpiano authored Jan 24, 2024
2 parents 038eb64 + e96c366 commit 178d32f
Show file tree
Hide file tree
Showing 9 changed files with 1,386 additions and 1,162 deletions.
5 changes: 0 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM node:14 as jsbuild

ENV FOLDER=netpyne
RUN echo "no-cache 2023-7-14"

WORKDIR $FOLDER/webapp
COPY webapp/package.json .
Expand All @@ -12,10 +11,6 @@ RUN yarn install --network-timeout 1000000000
COPY webapp .
RUN yarn build-dev

RUN rm -Rf node_modules/*



###
FROM jupyter/base-notebook:hub-1.5.0
ENV NB_UID=jovyan
Expand Down
2 changes: 1 addition & 1 deletion k8s/cf_values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ hub:
c.Spawner.notebook_dir = '/opt/workspace'
c.Spawner.default_url = '/geppetto'
spawner: >-
c.Spawner.args = ["--library=netpyne_ui"]
c.Spawner.args = ["--library=netpyne_ui", "--NotebookApp.default_url=/geppetto"]
singleuser:
storage:
type: none
Expand Down
2 changes: 1 addition & 1 deletion tests/frontend/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "NetPyNe UI tests",
"license": "unlicensed",
"scripts": {
"test": "jest --verbose",
"test": "jest --verbose Tut#1_smoke && jest --verbose ExperimentManager_Tut#1",
"EEG_Dipole_test": "jest --verbose EEG_and_Dipole_Tut#1 ",
"Experiment_Manager_test": "jest --verbose ExperimentManager_Tut#1 ",
"Tutorial_1_test":"jest --verbose Tut#1_smoke ",
Expand Down
1 change: 1 addition & 0 deletions utilities/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def main(netpyne_branch, workspace_branch, geppetto_branch=None, skipNpm=False,
_ = config['NotebookApp']['tornado_settings']
except KeyError:
config['NotebookApp']['tornado_settings'] = {}
config['NotebookApp']['tornado_settings']['headers'] = { 'Content-Security-Policy': "frame-ancestors 'self' http: https: http://localhost:8081 *" }
config['NotebookApp']['tornado_settings']['gzip'] = True
f.seek(0)
json.dump(config, f, indent=4, sort_keys=True)
Expand Down
2 changes: 1 addition & 1 deletion webapp/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ require('./css/flexlayout.less');
require('./css/tree.less');

ReactDOM.render(
<div>
<div id="iframefix">
<MuiThemeProvider theme={theme}>
<Provider store={store}>
<LoadingSpinner />
Expand Down
10 changes: 6 additions & 4 deletions webapp/components/general/NetPyNEPythonConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,19 @@ export class NetPyNEPythonConsole extends Component {
return currentNotebookValues ;
}

componentDidUpdate (prevProps) {
document.getElementById('pythonConsoleFrame').parentElement.parentElement.style.display = 'block';
}

shouldComponentUpdate (nextProps) {
if (this.props.extensionLoaded !== nextProps.extensionLoaded) {
return true;
}

if (nextProps.notebookVisible)
{
var iframeWindow = this.container.contentWindow;
iframeWindow.onblur = this.handleIframeBlur ;
iframeWindow.onfocus = this.handleIframeFocus ;
}
return false;
return true;
}

handleIframeBlur = (event) => {
Expand Down
17 changes: 17 additions & 0 deletions webapp/test-frame/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html>
<head>
<title>IFrame NePyNE-UI</title>
</head>
<body>

<h2>IFrame NePyNE-UI</h2>

<!-- IFrame element -->
<iframe src="http://localhost:8081" width="1200" height="1200">
<!-- Alternative content for browsers that do not support iframes -->
<p>Your browser does not support iframes.</p>
</iframe>

</body>
</html>
1 change: 0 additions & 1 deletion webapp/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ extended.devServer = {
port: 8081,
inline: true,
publicPath: '/geppetto/build',

proxy: [
{
path: '/',
Expand Down
2,508 changes: 1,359 additions & 1,149 deletions webapp/yarn.lock

Large diffs are not rendered by default.

0 comments on commit 178d32f

Please sign in to comment.