Skip to content

Commit 5607776

Browse files
committed
update inout for version, test version in yml
1 parent d4274ff commit 5607776

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

.github/workflows/gh-pages.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ jobs:
142142
- name: Find All Files Matching VERSION
143143
id: find_files
144144
run: |
145-
VERSION=$VERSION
145+
VERSION=${{env.VERSION}}
146146
files=($(ls ./*${VERSION}* 2>/dev/null || echo ""))
147147
if [ ${#files[@]} -eq 0 ]; then
148-
echo "Error: No files found matching VERSION $VERSION"
148+
echo "Error: No files found matching VERSION ${VERSION}"
149149
exit 1
150150
fi
151151
"file=${files[@]}" >> $GITHUB_ENV

src/component/TransferFunc.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { MathJax, MathJaxContext } from 'better-react-mathjax';
55
import Plot from 'react-plotly.js'; // Import Plotly component
66
import * as TransferFuncVar from './TransferFuncVar.js';
77
import HomeIcon from "@material-ui/icons/Home";
8+
import packagejson from '../../package.json';
89

910
class TransferFunc extends Component {
1011
constructor(props) {
@@ -13,6 +14,7 @@ class TransferFunc extends Component {
1314
A: TransferFuncVar.A,
1415
B: TransferFuncVar.B,
1516
C: TransferFuncVar.C,
17+
version: packagejson.version,
1618
token: '',
1719
errorA: false,
1820
errorB: false,
@@ -25,7 +27,7 @@ class TransferFunc extends Component {
2527
// Validation function
2628
validateInputs = () => {
2729
let valid = true;
28-
const { A, B, C, token } = this.state;
30+
const { A, B, C, token, version } = this.state;
2931

3032
if (!A || isNaN(A)) {
3133
this.setState({ errorA: true });
@@ -48,6 +50,13 @@ class TransferFunc extends Component {
4850
this.setState({ errorC: false });
4951
}
5052

53+
if (!version) {
54+
this.setState({ errorVersion: true });
55+
valid = false;
56+
} else {
57+
this.setState({ errorVersion: false });
58+
}
59+
5160
if (!token) {
5261
this.setState({ errorToken: true });
5362
valid = false;
@@ -154,7 +163,7 @@ export const C = ${C};
154163
};
155164

156165
render() {
157-
const { A, B, C, token, errorA, errorB, errorC, errorToken, loading } = this.state;
166+
const { A, B, C, token, version, errorA, errorB, errorC, errorToken, errorVersion, loading } = this.state;
158167

159168
// Generate FC values and PO values
160169
const FCValues = Array.from({ length: 1000 }, (_, i) => Math.pow(10, -3 + (i * 6) / 999)); // From 1e-3 to 1e3
@@ -209,6 +218,7 @@ export const C = ${C};
209218
{ label: 'Value for B', value: B, error: errorB, onChange: (e) => this.setState({ B: e.target.value }) },
210219
{ label: 'Value for C', value: C, error: errorC, onChange: (e) => this.setState({ C: e.target.value }) },
211220
{ label: 'GitHub Token', value: token, error: errorToken, type: 'password', onChange: (e) => this.setState({ token: e.target.value }) },
221+
{ label: 'Version', value: version, error: errorVersion, type: 'text', onChange: (e) => this.setState({ version: e.target.value }) }
212222
].map(({ label, value, error, type = 'number', onChange }, index) => (
213223
<TextField
214224
key={index}

0 commit comments

Comments
 (0)