-
-
Notifications
You must be signed in to change notification settings - Fork 16
V2 #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
V2 #109
Changes from 9 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
59a40d4
Add separate v2 component
matteosuppo e7dd7b6
Pass daemon as a property
matteosuppo 9bd32a2
Show installed tools table
matteosuppo abf3611
Install tool on separate package
matteosuppo 1a6b3fc
Add default testing values for v2.upload
matteosuppo 2166c46
Make linter happier
matteosuppo cffeef1
Add documentation
matteosuppo a43744a
Make sure to use v2 when enabled to download required tools
matteosuppo 6f73ce9
Don't use v2 if it's not available
matteosuppo c7097cd
make install tool ui a little nicer
a39c5d1
Revert code formatting done by vscode
matteosuppo 1aa9f63
minor fixes demo, updated some deps
c554839
2.2.0
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import React from 'react'; | ||
import { flatMap } from 'rxjs/operators'; | ||
|
||
export class V2InstallTool extends React.Component { | ||
constructor() { | ||
super(); | ||
this.state = { | ||
name: 'avrdude', | ||
version: '6.3.0-arduino9', | ||
packager: 'arduino', | ||
url: 'http://downloads.arduino.cc/tools/avrdude-6.3.0-arduino9-i686-w64-mingw32.zip', | ||
checksum: 'SHA-256:f3c5cfa8d0b3b0caee81c5b35fb6acff89c342ef609bf4266734c6266a256d4f', | ||
signature: '7628b488c7ffd21ae1ca657245751a4043c419fbab5c256a020fb53f17eb88686439f54f18e78a80b40fc2de742f79b78ed4338c959216dc8ae8279e482d2d4117eeaf34a281ce2369d1dc4356f782c0940d82610f1c892e913b637391c39e95d4d4dfe82d8dbc5350b833186a70a62c7952917481bad798a9c8b4905df91bd914fbdfd6e98ef75c8f7fb06284278da449ce05b27741d6eda156bbdb906d519ff7d7d5042379fdfc55962b3777fb9240b368552182758c297e39c72943d75d177f2dbb584b2210301250796dbe8af11f0cf06d762fe4f912294f4cdc8aff26715354cfb33010a81342fbbc438912eb424a39fc0c52a9b2bf722051a6f3b024bd', | ||
res: '' | ||
}; | ||
|
||
this.handleChange = this.handleChange.bind(this); | ||
this.handleSubmit = this.handleSubmit.bind(this); | ||
} | ||
|
||
componentDidMount() { | ||
this.daemon = this.props.daemon; | ||
|
||
this.daemon.agentV2Found.subscribe(daemonV2 => { | ||
if (!daemonV2) { | ||
return; | ||
} | ||
this.daemonV2 = daemonV2; | ||
}); | ||
} | ||
|
||
handleChange(event) { | ||
this.setState({ [event.target.name]: event.target.value }); | ||
} | ||
|
||
handleSubmit(event) { | ||
event.preventDefault(); | ||
|
||
this.daemonV2.installTool({ | ||
name: this.state.name, | ||
version: this.state.version, | ||
packager: this.state.packager, | ||
checksum: this.state.checksum, | ||
signature: this.state.signature, | ||
url: this.state.url, | ||
|
||
}) | ||
.then(res => { | ||
this.setState({ | ||
res: JSON.stringify(res, null, 2) | ||
}); | ||
}) | ||
.catch(err => { | ||
this.setState({ | ||
res: JSON.stringify(err, null, 2) | ||
}); | ||
}); | ||
} | ||
|
||
render() { | ||
return ( | ||
<section> | ||
<h2>Install a new tool</h2> | ||
<form onSubmit={this.handleSubmit}> | ||
<label> | ||
Name: | ||
<input type="text" name="name" value={this.state.name} onChange={this.handleChange} /> | ||
</label><br /> | ||
<label> | ||
Version: | ||
<input type="text" name="version" value={this.state.version} onChange={this.handleChange} /> | ||
</label> <br /> | ||
<label> | ||
Packager: | ||
<input type="text" name="packager" value={this.state.packager} onChange={this.handleChange} /> | ||
</label> <br /> | ||
<label> | ||
Url: | ||
<input type="text" name="url" value={this.state.url} onChange={this.handleChange} /> | ||
</label> <br /> | ||
<label> | ||
Checksum: | ||
<input type="text" name="checksum" value={this.state.checksum} onChange={this.handleChange} /> | ||
</label> <br /> | ||
<label> | ||
Signature: | ||
<input type="text" name="signature" value={this.state.signature} onChange={this.handleChange} /> | ||
</label> <br /> | ||
<input type="submit" value="Submit" /> | ||
</form> | ||
<textarea cols="100" rows="10" value={this.state.res} readOnly></textarea> | ||
</section> | ||
); | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React from 'react'; | ||
import { V2InstallTool } from './install_tool.jsx'; | ||
|
||
class V2 extends React.Component { | ||
constructor() { | ||
super(); | ||
this.state = { | ||
tools: [] | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
this.daemon = this.props.daemon; | ||
|
||
this.daemon.agentV2Found.subscribe(daemonV2 => { | ||
if (!daemonV2) { | ||
return; | ||
} | ||
this.daemonV2 = daemonV2; | ||
this.daemonV2.installedTools().then(res => { | ||
this.setState({ | ||
tools: res | ||
}); | ||
}); | ||
}); | ||
} | ||
|
||
render() { | ||
const tools = this.state.tools.map((tool, i) => <tr key={i}> | ||
<td>{tool.packager}</td> | ||
<td>{tool.name}</td> | ||
<td>{tool.version}</td> | ||
</tr>); | ||
|
||
return ( | ||
<section> | ||
<h2>V2</h2> | ||
<section> | ||
<h3>Installed tools</h3> | ||
<form onSubmit={this.handleInstallTool}> | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Packager</th> | ||
<th>Name</th> | ||
<th>Version</th> | ||
</tr> | ||
</thead> | ||
<tbody>{tools}</tbody> | ||
</table> | ||
</form> | ||
|
||
<V2InstallTool daemon={this.props.daemon}></V2InstallTool> | ||
</section> | ||
</section > | ||
); | ||
} | ||
} | ||
|
||
export default V2; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@matteosuppo pleeease, don't modify the formatting 😄
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.
Sorry vscode decided it was better that way. I didn't even notice. Should I put it the way it was?
Uh oh!
There was an error while loading. Please reload this page.
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 know, vscode has its own will sometimes. Yes please 👍