AddUser component deleted
This commit is contained in:
1 parent
dcfaae63a6
commit
fa5b24ca78
3 files changed
+5
-70
No files matched your search
@@ -20,9 +20,9 @@ App.js
|
||||
| | |
|
||||
| | |- UserTabs
|
||||
| | | |
|
||||
| | | |- Tab 1 - AddUser
|
||||
| | | |- Tab 1 - UserUpdate
|
||||
| | | |
|
||||
| | | |- Tab 2 - UpdateUser
|
||||
| | | |- Tab 2 - ManageImages
|
||||
| |
|
||||
| |- Browse
|
||||
| | |
|
||||
|
||||
@@ -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.
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user