Skip to content

Commit c2b708b

Browse files
author
Stefania
committed
fixed extrafiles field, updated deps, minor fixes demo
1 parent 625aae0 commit c2b708b

File tree

4 files changed

+108
-95
lines changed

4 files changed

+108
-95
lines changed

demo/app.jsx

+25-22
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,13 @@ class App extends React.Component {
7373
uploadError: '',
7474
downloadStatus: '',
7575
downloadError: '',
76+
serialInput: '',
7677
supportedBoards: []
7778
};
7879
this.handleOpen = this.handleOpen.bind(this);
7980
this.handleClose = this.handleClose.bind(this);
8081
this.handleSend = this.handleSend.bind(this);
82+
this.handleChangeSerial = this.handleChangeSerial.bind(this);
8183
this.showError = this.showError.bind(this);
8284
this.clearError = this.clearError.bind(this);
8385
}
@@ -148,36 +150,37 @@ class App extends React.Component {
148150
this.setState({ serialPortOpen: null });
149151
}
150152

153+
handleChangeSerial(e) {
154+
this.setState({ serialInput: e.target.value });
155+
}
156+
151157
handleSend(e) {
152158
e.preventDefault();
153159
const serialInput = document.getElementById('serial-input');
154-
const sendData = `${serialInput.value}\n`;
160+
const sendData = `${this.state.serialInput}\n`;
155161
daemon.writeSerial(this.state.serialPortOpen, sendData);
156162
serialInput.focus();
157-
serialInput.value = '';
163+
this.setState({ serialInput: '' });
158164
}
159165

160166
render() {
161-
const listSerialDevices = this.state.serialDevices.map((device, i) =>
162-
<li key={i}>
163-
{device.Name} - IsOpen: <span className={device.IsOpen ? 'open' : 'closed'}>
164-
{device.IsOpen ? 'true' : 'false'}
165-
</span> - <a href="#" onClick={(e) => this.handleOpen(e, device.Name)}>
167+
const listSerialDevices = this.state.serialDevices.map((device, i) => <li key={i}>
168+
{device.Name} - IsOpen: <span className={device.IsOpen ? 'open' : 'closed'}>
169+
{device.IsOpen ? 'true' : 'false'}
170+
</span> - <a href="#" onClick={(e) => this.handleOpen(e, device.Name)}>
166171
open
167-
</a> - <a href="#" onClick={(e) => this.handleClose(e, device.Name)}>
172+
</a> - <a href="#" onClick={(e) => this.handleClose(e, device.Name)}>
168173
close
169-
</a>
170-
</li>);
174+
</a>
175+
</li>);
171176

172-
const listNetworkDevices = this.state.networkDevices.map((device, i) =>
173-
<li key={i}>
174-
{device.Name}
175-
</li>);
177+
const listNetworkDevices = this.state.networkDevices.map((device, i) => <li key={i}>
178+
{device.Name}
179+
</li>);
176180

177-
const supportedBoards = this.state.supportedBoards.map((board, i) =>
178-
<li key={i}>
179-
{ board }
180-
</li>);
181+
const supportedBoards = this.state.supportedBoards.map((board, i) => <li key={i}>
182+
{ board }
183+
</li>);
181184

182185
let uploadClass;
183186
if (this.state.uploadStatus === daemon.UPLOAD_DONE) {
@@ -241,8 +244,8 @@ class App extends React.Component {
241244
</div>
242245

243246
{
244-
this.state.supportedBoards.length ?
245-
<div className="section">
247+
this.state.supportedBoards.length
248+
? <div className="section">
246249
<h2>Supported boards</h2>
247250

248251
<ul>
@@ -256,11 +259,11 @@ class App extends React.Component {
256259
<h2>Serial Monitor</h2>
257260

258261
<form onSubmit={this.handleSend}>
259-
<input id="serial-input" />
262+
<input id="serial-input" value={this.state.serialInput} onChange={this.handleChangeSerial}/>
260263
<input type="submit" value="Send" />
261264
</form>
262265

263-
<textarea id="serial-textarea" value={ this.state.serialMonitorContent }/>
266+
<textarea id="serial-textarea" value={ this.state.serialMonitorContent } readOnly/>
264267
</div>
265268

266269
<div className="section">

package-lock.json

+79-69
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
"babel-preset-react": "^6.24.1",
3232
"clean-webpack-plugin": "^1.0.1",
3333
"cross-env": "^5.2.0",
34-
"eslint": "^5.13.0",
34+
"eslint": "^5.14.1",
3535
"eslint-config-airbnb-base": "^13.1.0",
3636
"eslint-plugin-import": "^2.16.0",
3737
"html-webpack-plugin": "^3.2.0",
38-
"react": "^16.8.1",
39-
"react-dom": "^16.7.0",
38+
"react": "^16.8.2",
39+
"react-dom": "^16.8.2",
4040
"rimraf": "^2.6.3",
4141
"rollup": "^0.68.2",
4242
"rollup-plugin-babel": "^3.0.7",

src/socket-daemon.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ export default class SocketDaemon extends Daemon {
469469
wait_for_upload_port: uploadCommandInfo.options.wait_for_upload_port === 'true' || uploadCommandInfo.options.wait_for_upload_port === true,
470470
use_1200bps_touch: uploadCommandInfo.options.use_1200bps_touch === 'true' || uploadCommandInfo.options.use_1200bps_touch === true,
471471
},
472-
extrafiles: uploadCommandInfo.extrafiles || []
472+
extrafiles: uploadCommandInfo.files || []
473473
// Consider to push extra resource files from sketch in future if feature requested (from data folder)
474474
};
475475

0 commit comments

Comments
 (0)