AddUser component deleted

This commit is contained in:
Luis Fernando Molina committed 2018-09-10 11:46:35 +02:00
1 parent dcfaae63a6
commit fa5b24ca78
3 files changed
+5 -70

No files matched your search

+2 -2
View File
@@ -20,9 +20,9 @@ App.js
| | |
| | |- UserTabs
| | | |
| | | |- Tab 1 - AddUser
| | | |- Tab 1 - UserUpdate
| | | |
| | | |- Tab 2 - UpdateUser
| | | |- Tab 2 - ManageImages
| |
| |- Browse
| | |
-53
View File
@@ -1,53 +0,0 @@
import React, { Component } from 'react';
import {graphql, compose} from 'react-apollo';
import {getRolesQuery, addUserMutation, getUsersQuery} from '../queries/queries';
import AddUserNextButton from './AddUserNextButton';
class AddUser extends Component {
constructor(props){
super(props);
this.state = {
alias: '',
authId: '1'
};
}
submitForm(e){
e.preventDefault();
this.props.addUserMutation({
variables: {
alias: this.state.alias,
authId: this.state.authId
},
refetchQueries: [{ query: getUsersQuery}] // This allow us to re run whatever queries are necesary after the mutation.
});
this.props.onAdded();
}
render(){
return(
<div>
<form onSubmit={this.submitForm.bind(this)}>
<p>Choose an Alias that will identify you anonimously across the whole Advanced Algos ecosystem. Choose it carefully, since the the Alias can not be changed later.</p>
<div >
<div >
<input id="alias" type="text" onChange={ (e) => this.setState({ alias:e.target.value})}/>
<label htmlFor="alias">Alias</label>
</div>
</div>
<div className="row">
<AddUserNextButton/>
</div>
</form>
</div>
);
}
}
export default compose(
graphql(getRolesQuery, {name: "getRolesQuery"}),
graphql(addUserMutation, {name: "addUserMutation"})
) (AddUser); // This technique binds more than one query to a single component.
+3 -15
View File
@@ -11,7 +11,6 @@ import Typography from '@material-ui/core/Typography';
// Components
import AddUser from './AddUser';
import UpdateUser from './UpdateUser';
function TabContainer(props) {
@@ -36,23 +35,16 @@ const styles = theme => ({
class UserTabs extends React.Component {
state = {
value: 0,
cureateDisabled: "false"
value: 0
};
handleChange = (event, value) => {
this.setState({ value });
};
updateUser = () => {
this.setState({ value: 1, cureateDisabled: "true" });
};
render() {
const { classes } = this.props;
const { value } = this.state;
const { createDisabled } = this.state;
return (
<div className={classes.root}>
@@ -65,16 +57,12 @@ class UserTabs extends React.Component {
indicatorColor="primary"
textColor="primary"
>
<Tab label="Create Profile" icon={<AddIcon />} />
<Tab disabled={createDisabled} label="Create Profile" icon={<AddIcon />} />
<Tab label="Update Profile" icon={<UpdateIcon />} />
<Tab label="Manage Images" icon={<ImageIcon />} />
</Tabs>
</AppBar>
{value === 0 && <TabContainer><AddUser onAdded={this.updateUser}/></TabContainer>}
{value === 1 && <TabContainer><UpdateUser/></TabContainer>}
{value === 2 && <TabContainer>Item Three</TabContainer>}
{value === 0 && <TabContainer><UpdateUser/></TabContainer>}
{value === 1 && <TabContainer>Item Three</TabContainer>}
</div>
);
}