Commit 5dd0d69b authored by charlie-ablett's avatar charlie-ablett

Rename ConversionFileForm to ExecutionFileForm

parent 01453233
......@@ -9,7 +9,7 @@ const divWidget = (props) => {
return (
<div className="alert alert--error">
<span className="fa fa-warning right-space" aria-hidden="true"></span>
<span className="sr-only">Error:</span>
<span className="sr-only">Error: </span>
{content}
</div>
);
......@@ -17,7 +17,7 @@ const divWidget = (props) => {
return (
<div className="alert alert--warning">
<span className="fa fa-warning right-space" aria-hidden="true"></span>
<span className="sr-only">Warning:</span>
<span className="sr-only">Warning: </span>
{content}
</div>
);
......@@ -25,7 +25,7 @@ const divWidget = (props) => {
return (
<div className="alert alert--success">
<span className="fa fa-check right-space" aria-hidden="true"></span>
<span className="sr-only">Success:</span>
<span className="sr-only">Success: </span>
{content}
</div>
);
......@@ -33,7 +33,7 @@ const divWidget = (props) => {
return (
<div className="alert alert--info">
<span className="fa fa-info-circle right-space" aria-hidden="true"></span>
<span className="sr-only">Info:</span>
<span className="sr-only">Info: </span>
{content}
</div>
);
......
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import * as actions from '../actions/recipeActions';
export class ExecutionFileForm extends Component {
handleExecution = (e) => {
const { dispatch, appState } = this.props;
const form_file_input = this.state.picked_file;
const form_data = new FormData();
form_data.append( 'input_file', form_file_input );
const { signedIn, authToken, tokenType, client, expiry, uid } = appState.session;
dispatch(actions.executeRecipe(this.props.recipe.id, form_data, signedIn, authToken, tokenType, client, expiry, uid));
}
handleFilePickerChange = (event) => {
let file = event.target.files[0];
this.setState({picked_file: file});
}
render() {
let { recipe } = this.props;
return(
<div className="choose-file-container">
<input className="file-picker" type="file" label="Input File" ref="input_file" id="input_file" help="Select a file" onChange={this.handleFilePickerChange} />
<br/>
<button className="file-button" onClick={this.handleExecution}>Convert!</button>
</div>
);
}
}
ExecutionFileForm.propTypes = {
recipe: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired,
appState: PropTypes.object.isRequired
};
function mapStateToProps(state) {
return {
appState: state.appState
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(actions, dispatch),
dispatch: dispatch
};
}
export default connect(
mapStateToProps,
mapDispatchToProps
)(ExecutionFileForm);
......@@ -30,7 +30,7 @@ export const getAllRecipesFailure =
export const executeRecipeSuccessAlert =
[
{id: 7, content: "File conversion successfully started", type: "success"}
{id: 7, content: "Execution successfully started", type: "success"}
];
export const executeRecipeFailureAlert =
......
......@@ -11,7 +11,7 @@ import Header from '../../components/Header';
import RecipesList from '../../components/RecipesList';
import ConversionList from '../../components/ConversionList';
import RecipeStepDetail from '../../components/RecipeStepDetail';
import ConversionFileForm from '../../components/ConversionFileForm';
import ExecutionFileForm from '../../components/ExecutionFileForm';
import AlertList from '../../components/AlertList';
import { getAllRecipes } from '../../actions/recipeActions.js';
......@@ -97,7 +97,7 @@ class RecipeShowPage extends Component {
<h1>Recipe - {recipe.name}</h1>
<h4>{recipe.description}</h4>
<ConversionFileForm recipe={recipe} />
<ExecutionFileForm recipe={recipe} />
<div className="recipe-detail-view-container">
<div>
<h3>Steps</h3>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment