-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add general files to setup the workflow in the app
- Loading branch information
Showing
14 changed files
with
287 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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,3 @@ | ||
[submodule "jssp-frontend/src/sharedComponents"] | ||
path = jssp-frontend/src/sharedComponents | ||
url = [email protected]:kisna72/sharedComponents.git |
This file contains 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 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 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 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,11 @@ | ||
import React from 'react'; | ||
|
||
class JobSetup extends React.Component { | ||
|
||
|
||
render(){ | ||
return(<p>I M Job Setup </p>) | ||
} | ||
} | ||
|
||
export default JobSetup |
This file contains 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,78 @@ | ||
import React from 'react'; | ||
import { TextInput } from '../sharedComponents/react/Input'; | ||
import '../styles/kr-card.css'; | ||
import '../styles/kr-form.css'; | ||
/** | ||
* | ||
*/ | ||
class Categories extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = { | ||
name:'' | ||
} | ||
} | ||
handleChange = (event) =>{ | ||
this.setState({ | ||
name:event.target.value | ||
}) | ||
console.log(event.target.value) | ||
} | ||
handleSubmit = (event) => { | ||
event.preventDefault() | ||
this.props.createCategory({ | ||
id:2, | ||
name:this.state.name, | ||
machines:[] | ||
}) | ||
this.setState({ | ||
name:'' | ||
}) | ||
} | ||
render() { | ||
return ( | ||
<div className="machines-wrapper__categories ml-3 kr-card"> | ||
|
||
<h3>Categories</h3> | ||
<table> | ||
<thead> | ||
{this.props.categories.length > 0 && | ||
<tr> | ||
<th>Id</th> | ||
<th>Name</th> | ||
</tr> | ||
} | ||
</thead> | ||
<tbody> | ||
{this.props.categories.map(category => { | ||
return ( | ||
<tr> | ||
<td>{category.id}</td> | ||
<td>{category.name}</td> | ||
</tr> | ||
) | ||
})} | ||
</tbody> | ||
</table> | ||
<p className="machines-wrapper__categories--intro"> | ||
Please Enter a new category below. Once saved, | ||
the categories will appear as a selection option | ||
in each machine. You'll have to individually apply | ||
new categories to existing machines. | ||
</p> | ||
<form onSubmit={this.handleSubmit}> | ||
<TextInput | ||
id="category-input" | ||
value={this.state.name} | ||
onChange={this.handleChange} | ||
label="Enter new category" | ||
smallLabel="You will be able to apply each category to multiple machines" | ||
/> | ||
<button type="submit" className="btn btn-primary" disabled={this.state.name === ""}>Add Category</button> | ||
</form> | ||
</div> | ||
) | ||
} | ||
} | ||
|
||
export default Categories |
This file contains 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,65 @@ | ||
import React from 'react'; | ||
import '../styles/machines.scss'; | ||
import { randomID } from '../helpers'; | ||
import { TextInput } from '../sharedComponents/react/Input'; | ||
|
||
class Machines extends React.Component { | ||
constructor(props){ | ||
super(props) //props gets the machines object. | ||
this.state = { | ||
name:'' | ||
} | ||
} | ||
handleChange = (event) => { | ||
this.setState({name:event.target.value}) | ||
} | ||
addMachine = (event) => { | ||
event.preventDefault(); | ||
// CODE to call the API. | ||
this.props.createMachine({ | ||
name:this.state.name, | ||
id: randomID() | ||
}, | ||
this.setState({ | ||
name:'' | ||
}) | ||
); | ||
|
||
console.log("Submitting a new machine with name ", this.state.name) | ||
} | ||
render(){ | ||
return ( | ||
<div className="machines-wrapper"> | ||
<div className="machines-wrapper__main"> | ||
<h3 className="machines-wrapper__main__title">Machines</h3> | ||
<table> | ||
<tbody> | ||
{this.props.machines.map(machine => { | ||
return ( | ||
<tr> | ||
<td>{machine.id}</td> | ||
<td>{machine.name}</td> | ||
</tr>) | ||
})} | ||
</tbody> | ||
</table> | ||
<p> | ||
Please enter the machine below. Each machine must have a name. | ||
Once all machines are entered, you can create categories and apply categories to each machines. | ||
</p> | ||
<form class="" onSubmit={this.addMachine}> | ||
<TextInput | ||
id="machine-name" | ||
label="Name for your machine" | ||
smallLabel="Give your machine a recognizable name" | ||
value={this.state.name} | ||
onChange={this.handleChange} | ||
/> | ||
<button type="submit" class="btn btn-primary mb-2" disabled={this.state.name === "" }>Add Machine</button> | ||
</form> | ||
</div> | ||
</div>) | ||
} | ||
} | ||
|
||
export default Machines |
This file contains 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 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,10 @@ | ||
var randomID = function () { | ||
// Math.random should be unique because of its seeding algorithm. | ||
// Convert it to base 36 (numbers + letters), and grab the first 9 characters | ||
// after the decimal. | ||
return '_' + Math.random().toString(36).substr(2, 9); | ||
}; | ||
|
||
export { | ||
randomID | ||
} |
Oops, something went wrong.