|
|
@ -48,7 +48,16 @@ class PlatformCreate extends Component {
|
|
|
|
enabled: true,
|
|
|
|
enabled: true,
|
|
|
|
allTenants: false,
|
|
|
|
allTenants: false,
|
|
|
|
files: [],
|
|
|
|
files: [],
|
|
|
|
platformProperties: [{key:"Enabled", value: "Boolean"}, {key:"Access Token", value:"String"}]
|
|
|
|
platformProperties: [],
|
|
|
|
|
|
|
|
selectedProperty: 0,
|
|
|
|
|
|
|
|
name: "",
|
|
|
|
|
|
|
|
description: "",
|
|
|
|
|
|
|
|
property: "",
|
|
|
|
|
|
|
|
propertyTypes: [
|
|
|
|
|
|
|
|
{key: 0, value: 'String'},
|
|
|
|
|
|
|
|
{key: 1, value: 'Number'},
|
|
|
|
|
|
|
|
{key: 2, value: 'Boolean'},
|
|
|
|
|
|
|
|
{key: 3, value: 'File'}]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -71,6 +80,14 @@ class PlatformCreate extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Triggers the onChange action on property type selection.
|
|
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
_onPropertySelect = (event, index, value) => {
|
|
|
|
|
|
|
|
console.log(this.state.propertyTypes[value]);
|
|
|
|
|
|
|
|
this.setState({selectedProperty: value});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Remove the selected property from the property list.
|
|
|
|
* Remove the selected property from the property list.
|
|
|
|
* */
|
|
|
|
* */
|
|
|
@ -82,79 +99,155 @@ class PlatformCreate extends Component {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Add a new platform property.
|
|
|
|
* Add a new platform property.
|
|
|
|
* TODO: Create a property object and send to the endpoint.
|
|
|
|
|
|
|
|
* */
|
|
|
|
* */
|
|
|
|
_addProperty() {
|
|
|
|
_addProperty() {
|
|
|
|
|
|
|
|
let property = this.state.property;
|
|
|
|
|
|
|
|
let selected = this.state.selectedProperty;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.setState({platformProperties:
|
|
|
|
|
|
|
|
this.state.platformProperties.concat([
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
key: property,
|
|
|
|
|
|
|
|
value: this.state.propertyTypes[selected].value
|
|
|
|
|
|
|
|
}]),
|
|
|
|
|
|
|
|
property: "",
|
|
|
|
|
|
|
|
selectedProperty: 0});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Triggers in onChange event of text fields.
|
|
|
|
|
|
|
|
* Text fields are identified by their ids and the value will be persisted in the component state.
|
|
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
_onTextChange = (event, value) => {
|
|
|
|
|
|
|
|
let property = this.state.property;
|
|
|
|
|
|
|
|
let name = this.state.name;
|
|
|
|
|
|
|
|
let description = this.state.description;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
switch (event.target.id) {
|
|
|
|
|
|
|
|
case "name": {
|
|
|
|
|
|
|
|
name = value;
|
|
|
|
|
|
|
|
this.setState({name: name});
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "description": {
|
|
|
|
|
|
|
|
description = value;
|
|
|
|
|
|
|
|
this.setState({description: description});
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "property": {
|
|
|
|
|
|
|
|
property = value;
|
|
|
|
|
|
|
|
this.setState({property: property});
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_onCreatePlatform() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_clearForm() {
|
|
|
|
|
|
|
|
this.setState({enabled: true,
|
|
|
|
|
|
|
|
allTenants: false,
|
|
|
|
|
|
|
|
files: [],
|
|
|
|
|
|
|
|
platformProperties: [],
|
|
|
|
|
|
|
|
selectedProperty: 0,
|
|
|
|
|
|
|
|
name: "",
|
|
|
|
|
|
|
|
description: "",
|
|
|
|
|
|
|
|
property: "",})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
|
|
|
|
const {
|
|
|
|
|
|
|
|
platformProperties,
|
|
|
|
|
|
|
|
allTenants,
|
|
|
|
|
|
|
|
enabled,
|
|
|
|
|
|
|
|
selectedProperty,
|
|
|
|
|
|
|
|
propertyTypes,
|
|
|
|
|
|
|
|
name,
|
|
|
|
|
|
|
|
description,
|
|
|
|
|
|
|
|
property} = this.state;
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className="middle" style={{width: '95%', height: '100%', marginTop: '1%'}}>
|
|
|
|
<div className="middle" style={{width: '95%', height: '100%', marginTop: '1%'}}>
|
|
|
|
<Card>
|
|
|
|
<Card>
|
|
|
|
<CardTitle title="Create Platform"/>
|
|
|
|
<CardTitle title="Create Platform"/>
|
|
|
|
|
|
|
|
|
|
|
|
{/**
|
|
|
|
|
|
|
|
* The stepper goes here.
|
|
|
|
|
|
|
|
*/}
|
|
|
|
|
|
|
|
<CardActions>
|
|
|
|
<CardActions>
|
|
|
|
<div style={{width: '100%', margin: 'auto', paddingLeft: '10px'}}>
|
|
|
|
<div style={{width: '100%', margin: 'auto', paddingLeft: '10px'}}>
|
|
|
|
<form>
|
|
|
|
<form>
|
|
|
|
<TextField
|
|
|
|
<TextField
|
|
|
|
hintText="Enter the Platform Name."
|
|
|
|
hintText="Enter the Platform Name."
|
|
|
|
|
|
|
|
id="name"
|
|
|
|
floatingLabelText="Name*"
|
|
|
|
floatingLabelText="Name*"
|
|
|
|
floatingLabelFixed={true}
|
|
|
|
floatingLabelFixed={true}
|
|
|
|
|
|
|
|
value={name}
|
|
|
|
|
|
|
|
onChange={this._onTextChange.bind(this)}
|
|
|
|
/><br/>
|
|
|
|
/><br/>
|
|
|
|
<TextField
|
|
|
|
<TextField
|
|
|
|
|
|
|
|
id="description"
|
|
|
|
hintText="Enter the Platform Description."
|
|
|
|
hintText="Enter the Platform Description."
|
|
|
|
floatingLabelText="Description*"
|
|
|
|
floatingLabelText="Description*"
|
|
|
|
floatingLabelFixed={true}
|
|
|
|
floatingLabelFixed={true}
|
|
|
|
multiLine={true}
|
|
|
|
multiLine={true}
|
|
|
|
rows={2}
|
|
|
|
rows={2}
|
|
|
|
|
|
|
|
value={description}
|
|
|
|
|
|
|
|
onChange={this._onTextChange.bind(this)}
|
|
|
|
/><br/><br/>
|
|
|
|
/><br/><br/>
|
|
|
|
<Toggle
|
|
|
|
<Toggle
|
|
|
|
id="tenant"
|
|
|
|
id="tenant"
|
|
|
|
label="Shared with all Tenants"
|
|
|
|
label="Shared with all Tenants"
|
|
|
|
labelPosition="right"
|
|
|
|
labelPosition="right"
|
|
|
|
onToggle={this._handleToggle.bind(this)}
|
|
|
|
onToggle={this._handleToggle.bind(this)}
|
|
|
|
defaultToggled={this.state.allTenants}
|
|
|
|
toggled={allTenants}
|
|
|
|
/> <br/>
|
|
|
|
/> <br/>
|
|
|
|
<Toggle
|
|
|
|
<Toggle
|
|
|
|
id="enabled"
|
|
|
|
id="enabled"
|
|
|
|
label="Enabled"
|
|
|
|
label="Enabled"
|
|
|
|
labelPosition="right"
|
|
|
|
labelPosition="right"
|
|
|
|
onToggle={this.handleToggle.bind(this)}
|
|
|
|
onToggle={this._handleToggle.bind(this)}
|
|
|
|
defaultToggled={this.state.enabled}
|
|
|
|
toggled={enabled}
|
|
|
|
/> <br/>
|
|
|
|
/> <br/>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<p style={{color: '#BDBDBD'}}>Platform Properties</p>
|
|
|
|
<p style={{color: '#BaBaBa'}}>Platform Properties</p>
|
|
|
|
<div id="property-container">
|
|
|
|
<div id="property-container">
|
|
|
|
{this.state.platformProperties.map((p) => {
|
|
|
|
{platformProperties.map((p) => {
|
|
|
|
return <div key={p.key}>{p.key} : {p.value}
|
|
|
|
return <div key={p.key}>{p.key} : {p.value}
|
|
|
|
<IconButton onClick={this._removeProperty.bind(this, p)}>
|
|
|
|
<IconButton onClick={this._removeProperty.bind(this, p)}>
|
|
|
|
<Close style={{height:'10px', width:'10px'}}/>
|
|
|
|
<Close style={{height: '10px', width: '10px'}}/>
|
|
|
|
</IconButton>
|
|
|
|
</IconButton>
|
|
|
|
</div>})}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
})}
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div style={{display: 'flex'}}>
|
|
|
|
<TextField
|
|
|
|
<TextField
|
|
|
|
hintText=""
|
|
|
|
id="property"
|
|
|
|
|
|
|
|
hintText="Property Name"
|
|
|
|
floatingLabelText="Platform Property*"
|
|
|
|
floatingLabelText="Platform Property*"
|
|
|
|
floatingLabelFixed={true}
|
|
|
|
floatingLabelFixed={true}
|
|
|
|
|
|
|
|
value={this.state.property}
|
|
|
|
|
|
|
|
onChange={this._onTextChange.bind(this)}
|
|
|
|
/> <em/>
|
|
|
|
/> <em/>
|
|
|
|
<SelectField
|
|
|
|
<SelectField
|
|
|
|
|
|
|
|
style={{flex: '1 1 23% 1', margin: '0 1%'}}
|
|
|
|
floatingLabelText="Property Type"
|
|
|
|
floatingLabelText="Property Type"
|
|
|
|
value={this.state.store}
|
|
|
|
value={selectedProperty}
|
|
|
|
floatingLabelFixed={true}>
|
|
|
|
floatingLabelFixed={true}
|
|
|
|
<MenuItem value={1} primaryText="String"/>
|
|
|
|
onChange={this._onPropertySelect.bind(this)}>
|
|
|
|
<MenuItem value={2} primaryText="Number"/>
|
|
|
|
{propertyTypes.map((type) => {
|
|
|
|
<MenuItem value={3} primaryText="Boolean"/>
|
|
|
|
return <MenuItem key={type.key}
|
|
|
|
<MenuItem value={4} primaryText="File"/>
|
|
|
|
value={type.key}
|
|
|
|
|
|
|
|
primaryText={type.value}/>
|
|
|
|
|
|
|
|
})}
|
|
|
|
</SelectField>
|
|
|
|
</SelectField>
|
|
|
|
<IconButton onClick={this._addProperty.bind(this)}>
|
|
|
|
<IconButton onClick={this._addProperty.bind(this)}>
|
|
|
|
<AddCircleOutline/>
|
|
|
|
<AddCircleOutline/>
|
|
|
|
</IconButton>
|
|
|
|
</IconButton>
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<p style={{color: '#BDBDBD'}}>Platform Icon*:</p>
|
|
|
|
<p style={{color: '#BDBDBD'}}>Platform Icon*:</p>
|
|
|
|
<Dropzone style={{width: '100px', height: '100px', border: 'dashed #BDBDBD 1px'}}>
|
|
|
|
<Dropzone style={{width: '100px', height: '100px', border: 'dashed #BDBDBD 1px'}}>
|
|
|
@ -162,8 +255,9 @@ class PlatformCreate extends Component {
|
|
|
|
</Dropzone>
|
|
|
|
</Dropzone>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|
<RaisedButton primary={true} label="Create"/>
|
|
|
|
<RaisedButton primary={true} label="Create"
|
|
|
|
<FlatButton label="Cancel"/>
|
|
|
|
onClick={this._onCreatePlatform.bind(this)}/>
|
|
|
|
|
|
|
|
<FlatButton label="Cancel" onClick={this._clearForm.bind(this)}/>
|
|
|
|
</form>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</CardActions>
|
|
|
|
</CardActions>
|
|
|
|