Skip to content

Instantly share code, notes, and snippets.

View gregturn's full-sized avatar

Greg L. Turnquist gregturn

View GitHub Profile
{
"id": 1,
"name": "Gandalf",
"employees": [
"Frodo::ring bearer",
"Bilbo::burglar"
],
"_links": {
"self": {
"href": "http://localhost:8080/managers/1"
@gregturn
gregturn / customer.json
Last active May 29, 2017 23:57
Custom JSON HAL document - after update
{
"firstName" : "Frodo",
"lastName" : "Baggins",
"name" : "Frodo Baggins",
"_links" : {
"self" : {
"href" : "/customers/1"
}
}
}
@gregturn
gregturn / Customer.java
Last active May 29, 2017 23:57
Customer domain object - after update
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class Customer {
private String firstName;
private String lastName;
public void setName(String wholeName) {
String[] parts = wholeName.split(" ");
this.firstName = parts[0];
@gregturn
gregturn / customer.json
Last active May 29, 2017 23:58
Customer JSON HAL document - before changes
{
"name" : "Frodo Baggins",
"_links" : {
"self" : {
"href" : "/customers/1"
}
}
}
@gregturn
gregturn / Customer.java
Last active May 29, 2017 23:58
Customer domain object - before changes
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class Customer {
private String name;
}
requiredFieldsFilledOut() {
return this.state.required.filter(field => this.state[field]).length === this.state.required.length
}
{this.requiredFieldsFilledOut() ?
<li className={this.tabStatus('status')} onClick={this.handleStatus}>
<a id="status-link" className="tabs__link">Install</a>
</li>
:
<li className={this.tabStatus('status')}>
<a className="tabs__link">Install</a>
</li>
}
// Fixed constant stuffed inside the state
this.state['required'] = [
this.state.api,
this.state.email,
this.state.password,
this.state.services,
this.state.primaryAccount,
this.state.domain,
'all.namespace'
]
return (<li className='control-group'>
{this.props.settings.required.includes(this.props.name) && !this.props.settings[this.props.name] ?
<label className={labelLayout}>{this.props.label} <span className='required'>(*required)</span></label>
:
<label className={labelLayout}>{this.props.label}</label>
}
{optional}
<input className={inputLayout} type="text"
placeholder={this.props.placeHolder}
name={this.props.name}
<CheckboxInput label="OAuth?"
name={this.props.settings.oauthEnabled}
handleChange={this.handleChange}
settings={this.props.settings} />