Merge pull request #35 from AAVikings/master

Browser integration
This commit is contained in:
benme authored and GitHub committed 2019-02-16 19:20:49 -03:00
commit 7919e7e84e
5 files changed
+33 -32

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@superalgos/operations-client",
"version": "0.0.14",
"version": "0.0.15",
"description": "Superalgos Operations client-side web app",
"main": "src/index.js",
"dependencies": {
+21 -23
View File
@@ -32,7 +32,7 @@ class AddClone extends Component {
state: '',
stateDatetime: 0,
createDatetime: 0,
runAsTeam: false,
runAsTeam: true,
teams: [],
teamId: '',
keyId: '',
@@ -52,7 +52,7 @@ class AddClone extends Component {
serverResponse: '',
serverError: false,
processNameError: false,
keyIdError: false
keyIdError: false,
}
}
@@ -155,7 +155,16 @@ class AddClone extends Component {
{ this.state.selectedBot.kind === "TRADER" &&
<React.Fragment>
<Typography className={classes.typography} variant='subtitle1' align='justify'>
At the moment Live Trading Clones trade by default 0.001 BTC on Poloniex.
Available Running Modes are Backtest and Live.
<ul>
<li> Backtest mode does NOT put real orders at the exchange;
it simulates the order execution at the specified price.
</li>
<li>
Live mode DOES put real orders at the exchange.
</li>
</ul>
</Typography>
<TextField
@@ -271,7 +280,12 @@ class AddClone extends Component {
}}
</Query>
<Typography className={classes.typography} variant='subtitle1' align='justify'>
Because we are still in early alpha-testing phase,
Live Trading Clones are limited to an initial investment
of 0.001 BTC. If you choose to run this bot or any modified
version of the code, you are doing it at your own risk.
</Typography>
</React.Fragment>
}
@@ -294,22 +308,6 @@ class AddClone extends Component {
className={classNames(classes.form, classes.textField)}
/>
<Typography className={classes.typography} variant='subtitle1' align='justify'>
The Resume Execution option let's you pick up the context of
the last execution and continue from there.
</Typography>
<FormControlLabel
control={
<Checkbox
checked={this.state.resumeExecution}
onChange={(e)=>this.setState({resumeExecution:e.target.checked })}
value="resumeExecution"
color="primary"
/>
}
label="Resume Execution"
className={classNames(classes.form, classes.textField)}
/>
</React.Fragment>
}
@@ -417,9 +415,9 @@ class AddClone extends Component {
</React.Fragment>
}
<Typography className={classes.typography} variant='subtitle1' align='justify'>
You will be able to query your clone information under Active Clones until it finishes the execution, then it will moved to the History.
You will be able to see the clone information under Active Clones.
Whenever you decide to stop the clone you can delete it. On History Clones will find all deleted clones.
</Typography>
<div className={classes.actionButton} >
@@ -552,7 +550,7 @@ class AddClone extends Component {
state : '',
stateDatetime: 0,
createDatetime: 0,
runAsTeam: false,
runAsTeam: true,
processName: '',
teams: [],
teamId: '',
+1 -1
View File
@@ -24,7 +24,7 @@ const styles = theme => ({
typography: {
width: '80%',
marginLeft: '10%',
marginTop: 40
marginTop: 20
},
form: {
marginTop: 20
+3 -3
View File
@@ -9,21 +9,21 @@ class Home extends Component {
<React.Fragment>
<TopBar
size='big'
title='Operations Module'
title='Clones Module'
text='Responsible for manage bot clones.'
backgroundUrl='https://superalgos.org/img/photos/ecosystem.jpg'
/>
<div className='homePage container'>
<Typography variant='h1' align='center' className='title'>
Welcome to the Operations Module!
Welcome to the Clones Module!
</Typography>
<Typography variant='h2' align='center' className='subtitle'>
Responsible for manage bot clones.
</Typography>
<div className='column'>
<Typography align='justify'>
The Operations module allows you to create instances of your bots
The Clones module allows you to create instances of your bots
that will be executed on a virtual machine.
</Typography>
</div>
@@ -15,7 +15,7 @@ import {
import logger from '../../config/logger'
import createKubernetesClone from '../../kubernetes/createClone'
import { isDefined } from '../../config/utils'
import { LIVE } from '../../enums/CloneMode'
import { LIVE, COMPETITION } from '../../enums/CloneMode'
const args = {
clone: { type: CloneInputType }
@@ -36,8 +36,8 @@ const resolve = async(parent, { clone }, context) => {
throw new WrongArgumentsError('The bot type selected is not valid.')
}
if (clone.mode === LIVE && !isDefined(clone.keyId)) {
throw new WrongArgumentsError('The key was not provided to run the clone in Live mode.')
if ( (clone.mode === LIVE || clone.mode === COMPETITION) && !isDefined(clone.keyId)) {
throw new WrongArgumentsError('The key was not provided to run the clone.')
}
try {
@@ -53,7 +53,7 @@ const resolve = async(parent, { clone }, context) => {
logger.debug('addClone -> Creating the clone on the Database.')
let savedClone = await newClone.save()
if (clone.mode === LIVE) {
if (clone.mode === LIVE || clone.mode === COMPETITION) {
logger.debug('addClone -> Authorizing clone to use the key.')
let response = await authorizeClone(context.authorization, clone.keyId, clone.id, false)
logger.debug('addClone -> Authorizing clone to use the key.')
@@ -62,7 +62,10 @@ const resolve = async(parent, { clone }, context) => {
} else {
throw new AutorizationError()
}
}else{
await createKubernetesClone(clone)
}
logger.debug('addClone -> Clone created sucessfully.')
return savedClone
} catch (err) {