|
|
@ -21,12 +21,12 @@ import Dropzone from 'react-dropzone';
|
|
|
|
import React, {Component} from 'react';
|
|
|
|
import React, {Component} from 'react';
|
|
|
|
import Toggle from 'material-ui/Toggle';
|
|
|
|
import Toggle from 'material-ui/Toggle';
|
|
|
|
import MenuItem from 'material-ui/MenuItem';
|
|
|
|
import MenuItem from 'material-ui/MenuItem';
|
|
|
|
import Close from 'material-ui/svg-icons/navigation/close';
|
|
|
|
|
|
|
|
import TextField from 'material-ui/TextField';
|
|
|
|
import TextField from 'material-ui/TextField';
|
|
|
|
import FlatButton from 'material-ui/FlatButton';
|
|
|
|
import FlatButton from 'material-ui/FlatButton';
|
|
|
|
import IconButton from 'material-ui/IconButton';
|
|
|
|
import IconButton from 'material-ui/IconButton';
|
|
|
|
import SelectField from 'material-ui/SelectField';
|
|
|
|
import SelectField from 'material-ui/SelectField';
|
|
|
|
import RaisedButton from 'material-ui/RaisedButton';
|
|
|
|
import RaisedButton from 'material-ui/RaisedButton';
|
|
|
|
|
|
|
|
import Close from 'material-ui/svg-icons/navigation/close';
|
|
|
|
import {Card, CardActions, CardTitle} from 'material-ui/Card';
|
|
|
|
import {Card, CardActions, CardTitle} from 'material-ui/Card';
|
|
|
|
import AddCircleOutline from 'material-ui/svg-icons/content/add-circle-outline';
|
|
|
|
import AddCircleOutline from 'material-ui/svg-icons/content/add-circle-outline';
|
|
|
|
|
|
|
|
|
|
|
@ -52,7 +52,11 @@ class PlatformCreate extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
handleToggle(event) {
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Handles toggle button actions.
|
|
|
|
|
|
|
|
* One method is used for all the toggle buttons and, each toggle is identified by the id.
|
|
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
_handleToggle(event) {
|
|
|
|
switch (event.target.id) {
|
|
|
|
switch (event.target.id) {
|
|
|
|
case "enabled" : {
|
|
|
|
case "enabled" : {
|
|
|
|
let enabled = this.state.enabled;
|
|
|
|
let enabled = this.state.enabled;
|
|
|
@ -67,21 +71,24 @@ class PlatformCreate extends Component {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
removeProperty(p) {
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Remove the selected property from the property list.
|
|
|
|
|
|
|
|
* */
|
|
|
|
|
|
|
|
_removeProperty(property) {
|
|
|
|
let properties = this.state.platformProperties;
|
|
|
|
let properties = this.state.platformProperties;
|
|
|
|
properties.splice(properties.indexOf(p), 1);
|
|
|
|
properties.splice(properties.indexOf(property), 1);
|
|
|
|
this.setState({platformProperties: properties});
|
|
|
|
this.setState({platformProperties: properties});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
addProperty() {
|
|
|
|
/**
|
|
|
|
let property = {key: Math.random(), value: "Temp Prop"};
|
|
|
|
* Add a new platform property.
|
|
|
|
let properties = this.state.platformProperties;
|
|
|
|
* TODO: Create a property object and send to the endpoint.
|
|
|
|
properties.push(property);
|
|
|
|
* */
|
|
|
|
this.setState({platformProperties: properties});
|
|
|
|
_addProperty() {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
console.log(this.state.platformProperties);
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className="middle" style={{width: '95%', height: '100%', marginTop: '1%'}}>
|
|
|
|
<div className="middle" style={{width: '95%', height: '100%', marginTop: '1%'}}>
|
|
|
|
<Card>
|
|
|
|
<Card>
|
|
|
@ -109,7 +116,7 @@ class PlatformCreate extends Component {
|
|
|
|
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}
|
|
|
|
defaultToggled={this.state.allTenants}
|
|
|
|
/> <br/>
|
|
|
|
/> <br/>
|
|
|
|
<Toggle
|
|
|
|
<Toggle
|
|
|
@ -124,7 +131,7 @@ class PlatformCreate extends Component {
|
|
|
|
<div id="property-container">
|
|
|
|
<div id="property-container">
|
|
|
|
{this.state.platformProperties.map((p) => {
|
|
|
|
{this.state.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>})}
|
|
|
@ -143,7 +150,7 @@ class PlatformCreate extends Component {
|
|
|
|
<MenuItem value={3} primaryText="Boolean"/>
|
|
|
|
<MenuItem value={3} primaryText="Boolean"/>
|
|
|
|
<MenuItem value={4} primaryText="File"/>
|
|
|
|
<MenuItem value={4} primaryText="File"/>
|
|
|
|
</SelectField>
|
|
|
|
</SelectField>
|
|
|
|
<IconButton onClick={this.addProperty.bind(this)}>
|
|
|
|
<IconButton onClick={this._addProperty.bind(this)}>
|
|
|
|
<AddCircleOutline/>
|
|
|
|
<AddCircleOutline/>
|
|
|
|
</IconButton>
|
|
|
|
</IconButton>
|
|
|
|
<br/>
|
|
|
|
<br/>
|
|
|
|