Skip to content

Commit 6768ed6

Browse files
authored
Merge branch 'dev' into refactor/merge-polling-socket-setup
2 parents b32e1df + 8ef4d27 commit 6768ed6

31 files changed

Lines changed: 1406 additions & 191 deletions

.github/workflows/deploy-docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
working-directory: ./website
2727
steps:
2828
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
29-
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
29+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020
3030
with:
3131
node-version: 24
3232
cache: npm

.github/workflows/process-changes.yml

Lines changed: 71 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- name: "Checkout Repository"
1414
uses: actions/checkout@v7.0.0
1515
- name: "Install Node"
16-
uses: actions/setup-node@v6.4.0
16+
uses: actions/setup-node@v7.0.0
1717
with:
1818
node-version: '24'
1919
- name: "Install Dependencies"
@@ -148,6 +148,76 @@ jobs:
148148
name: cypress-screenshots-visual
149149
path: cypress/screenshots
150150

151+
playwright-visual-regression-test-init:
152+
name: "Initialize Playwright Visual Regression Test"
153+
runs-on: ubuntu-latest
154+
needs: install-and-build
155+
steps:
156+
- name: "Checkout Repository"
157+
uses: actions/checkout@v7.0.0
158+
159+
- name: "Save current Head-Ref as PR-branch"
160+
shell: bash
161+
run: git checkout -B PR-HEAD
162+
163+
- uses: ./.github/actions/prepare
164+
with:
165+
usebasebranch: true
166+
loadprbuild: false
167+
168+
- name: "Checkout Playwright tests from Head-Ref"
169+
shell: bash
170+
run: |
171+
git checkout PR-HEAD -- ./playwright
172+
git checkout PR-HEAD -- ./example
173+
git checkout PR-HEAD -- ./package.json
174+
git checkout PR-HEAD -- ./playwright.config.js
175+
git checkout PR-HEAD -- ./playwright.init.config.js
176+
git checkout PR-HEAD -- ./playwright.visual.config.js
177+
178+
- name: "Install PR npm dependencies"
179+
run: ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install
180+
181+
- name: "Install Playwright Chromium"
182+
run: npx playwright install --with-deps chromium
183+
184+
- name: "Generate Playwright baseline screenshots"
185+
run: npm run test:pw:init
186+
187+
- uses: actions/upload-artifact@v7
188+
with:
189+
name: playwright-init-screenshots
190+
path: playwright/screenshots_init
191+
192+
playwright-visual-regression-test:
193+
name: "Playwright Visual Regression Test"
194+
runs-on: ubuntu-latest
195+
needs: playwright-visual-regression-test-init
196+
steps:
197+
- name: "Checkout Repository"
198+
uses: actions/checkout@v7.0.0
199+
200+
- uses: ./.github/actions/prepare
201+
202+
- name: "Install Playwright Chromium"
203+
run: npx playwright install --with-deps chromium
204+
205+
- uses: actions/download-artifact@v8
206+
with:
207+
name: playwright-init-screenshots
208+
path: playwright/screenshots_init
209+
210+
- name: "Run Playwright visual regression tests"
211+
run: npm run test:pw:visual
212+
213+
- uses: actions/upload-artifact@v7
214+
if: failure()
215+
with:
216+
name: playwright-screenshots-visual
217+
path: |
218+
playwright/test-results/
219+
playwright/playwright-report/
220+
151221
functional-test:
152222
name: "Functional Test (Websocket)"
153223
runs-on: ubuntu-latest

.github/workflows/pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
generate_release_notes: true
3939
- name: Set up Python
4040
if: ${{ steps.version.outputs.TAG_EXISTS == '0' }}
41-
uses: actions/setup-python@v6
41+
uses: actions/setup-python@v7
4242
with:
4343
python-version: '3.x'
4444
- name: Install dependencies

.github/workflows/python-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Checkout Repository
2020
uses: actions/checkout@v7.0.0
2121
- name: Set up Python
22-
uses: actions/setup-python@v6
22+
uses: actions/setup-python@v7
2323
with:
2424
python-version: ${{ matrix.python-version }}
2525
- name: Install package and test dependencies

.github/workflows/update-js-build-files.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
# see: https://stackoverflow.com/questions/57921401/push-to-origin-from-github-action/58393457#58393457
2323
# with:
2424
# token: ${{ secrets.PAT }}
25-
- uses: actions/setup-node@v6.4.0
25+
- uses: actions/setup-node@v7.0.0
2626
with:
2727
node-version: '24'
2828
- run: ELECTRON_SKIP_BINARY_DOWNLOAD=1 npm install

download.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ wget https://unpkg.com/jquery@3.1.1/dist/jquery.min.js -O py/static/js/jquery.mi
55
wget https://unpkg.com/bootstrap@3.3.7/dist/js/bootstrap.min.js -O py/static/js/bootstrap.min.js
66
wget https://unpkg.com/react@16.2.0/umd/react.production.min.js -O py/static/js/react-react.min.js
77
wget https://unpkg.com/react-dom@16.2.0/umd/react-dom.production.min.js -O py/static/js/react-dom.min.js
8-
wget "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_SVG" -O py/static/js/mathjax-MathJax.js
8+
wget "https://cdnjs.cloudflare.com/ajax/libs/mathjax/3.2.2/es5/tex-mml-svg.js" -O py/static/js/mathjax-tex-mml-svg.js
99
wget https://cdn.rawgit.com/plotly/plotly.js/master/dist/plotly.min.js -O py/static/js/plotly-plotly.min.js
1010
wget https://unpkg.com/sjcl@1.0.7/sjcl.js -O py/static/js/sjcl.js
1111
wget https://cdnjs.cloudflare.com/ajax/libs/react-modal/3.6.1/react-modal.min.js -o py/static/js/react-modal.min.js

js/panes/ImageComparePane.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,22 @@
77
*
88
*/
99

10-
import React from 'react';
10+
import React, { useEffect, useRef } from 'react';
1111

1212
import Pane from './Pane';
13+
import { typesetMathJax } from './utils/mathjaxHelpers';
1314

1415
function ImageComparePane(props) {
1516
const { content, title, id } = props;
17+
const containerRef = useRef();
18+
19+
useEffect(() => {
20+
let cancelled = false;
21+
typesetMathJax(containerRef.current, () => cancelled);
22+
return () => {
23+
cancelled = true;
24+
};
25+
}, [content]);
1626

1727
// If content isn't an array, fallback
1828
if (!Array.isArray(content)) {
@@ -38,6 +48,7 @@ function ImageComparePane(props) {
3848
return (
3949
<Pane {...props} handleDownload={handleDownload}>
4050
<div
51+
ref={containerRef}
4152
style={{
4253
display: 'flex',
4354
flexDirection: 'row',

js/panes/ImagePane.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
1212
import ApiContext from '../api/ApiContext';
1313
import EventSystem from '../EventSystem';
1414
import Pane from './Pane';
15+
import { typesetMathJax } from './utils/mathjaxHelpers';
1516

1617
const DEFAULT_HEIGHT = 400;
1718
const DEFAULT_WIDTH = 300;
@@ -25,6 +26,7 @@ function ImagePane(props) {
2526
// --------------
2627
const paneRef = useRef();
2728
const imgRef = useRef();
29+
const captionRef = useRef();
2830
const mouseLocationRef = useRef({ x: null, y: null });
2931
const [view, setView] = useState({ scale: 1, tx: 0, ty: 0 });
3032
const [imgDim, setImgDim] = useState({ width: null, height: 0 });
@@ -147,7 +149,11 @@ function ImagePane(props) {
147149
const commitSliderSelection = (value) => {
148150
const idx = parseInt(value, 10);
149151
if (Number.isNaN(idx)) return;
150-
sendPaneMessage({ event_type: 'SliderMoved', index: idx, pane_data: false }, id, envID);
152+
sendPaneMessage(
153+
{ event_type: 'SliderMoved', index: idx, pane_data: false },
154+
id,
155+
envID
156+
);
151157
};
152158

153159
const finalizeSlider = (evt) => {
@@ -307,12 +313,20 @@ function ImagePane(props) {
307313
content = content[actualSelected];
308314
}
309315

316+
useEffect(() => {
317+
let cancelled = false;
318+
typesetMathJax(captionRef.current, () => cancelled);
319+
return () => {
320+
cancelled = true;
321+
};
322+
}, [content.caption]);
323+
310324
// add caption as widget
311325
if (content.caption) {
312326
widgets.splice(
313327
0,
314328
0,
315-
<span className="widget" key="img_caption">
329+
<span className="widget" key="img_caption" ref={captionRef}>
316330
{content.caption}
317331
</span>
318332
);

js/panes/PlotPane.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import React, { useContext, useEffect, useRef, useState } from 'react';
1111
const { usePrevious } = require('../util');
1212
import ApiContext from '../api/ApiContext';
1313
import Pane from './Pane';
14+
import { typesetMathJax } from './utils/mathjaxHelpers';
1415
const { sgg } = require('ml-savitzky-golay-generalized');
1516

1617
var PlotPane = (props) => {
@@ -20,6 +21,7 @@ var PlotPane = (props) => {
2021
// state variables
2122
// --------------
2223
const plotlyRef = useRef();
24+
const captionRef = useRef();
2325
const maxsmoothvalue = 100;
2426
const [smoothWidgetActive, setSmoothWidgetActive] = useState(false);
2527
const [smoothvalue, setSmoothValue] = useState(1);
@@ -41,6 +43,14 @@ var PlotPane = (props) => {
4143
}
4244
}, [selected]);
4345

46+
useEffect(() => {
47+
let cancelled = false;
48+
typesetMathJax(captionRef.current, () => cancelled);
49+
return () => {
50+
cancelled = true;
51+
};
52+
}, [content && content.caption]);
53+
4454
// private events
4555
// -------------
4656
const toggleSmoothWidget = () => {
@@ -327,7 +337,7 @@ var PlotPane = (props) => {
327337
var caption_widget = '';
328338
if (content && content.caption) {
329339
caption_widget = (
330-
<div className="widget plot-caption" key="plot_caption">
340+
<div className="widget plot-caption" key="plot_caption" ref={captionRef}>
331341
{content.caption}
332342
</div>
333343
);

js/panes/TextPane.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77
*
88
*/
99

10-
import React, { useContext, useEffect } from 'react';
10+
import React, { useContext, useEffect, useRef } from 'react';
1111
import ScrollToBottom from 'react-scroll-to-bottom';
1212

1313
import ApiContext from '../api/ApiContext';
1414
import EventSystem from '../EventSystem';
1515
import Pane from './Pane';
16+
import { typesetMathJax } from './utils/mathjaxHelpers';
1617

1718
function TextPane(props) {
1819
const { sendPaneMessage } = useContext(ApiContext);
1920
const { envID, id, content, isFocused } = props;
21+
const contentRef = useRef();
2022

2123
// private events
2224
// --------------
@@ -70,6 +72,14 @@ function TextPane(props) {
7072
};
7173
});
7274

75+
useEffect(() => {
76+
let cancelled = false;
77+
typesetMathJax(contentRef.current, () => cancelled);
78+
return () => {
79+
cancelled = true;
80+
};
81+
}, [content]);
82+
7383
// rendering
7484
// ---------
7585

@@ -88,7 +98,7 @@ function TextPane(props) {
8898
initialScrollBehavior={initialScrollBehavior}
8999
mode="bottom"
90100
>
91-
<div dangerouslySetInnerHTML={{ __html: content }} />
101+
<div ref={contentRef} dangerouslySetInnerHTML={{ __html: content }} />
92102
</ScrollToBottom>
93103
</Pane>
94104
);

0 commit comments

Comments
 (0)