Updating the branch to the latest master and making it work with the new docker daemon evolutions

This commit is contained in:
Alexandre Vazquez 2016-03-27 16:03:11 +02:00
parent 49833aaccd
commit a0332d279b
2 changed files with 24 additions and 22 deletions

View File

@ -45,6 +45,7 @@ var ContainerSettingsPorts = React.createClass({
document.getElementById('portValue').value = '';
},
addPort: function () {
if (document.getElementById('portKey') != null){
var portKey = document.getElementById('portKey').value;
var portValue = document.getElementById('portValue').value;
var portTypeValue = document.getElementById('portType').textContent;
@ -63,6 +64,7 @@ var ContainerSettingsPorts = React.createClass({
this.createEmptyPort(ports);
}
}
}
return ports;
},
handleAddPort: function (e) {
@ -169,20 +171,19 @@ var ContainerSettingsPorts = React.createClass({
let ports = this.state.ports;
ports = this.addPort();
this.setState({ports: ports});
let bindings = _.reduce(ports, (res, value, key) => {
let exposedPorts = {};
let portBindings = _.reduce(ports, (res, value, key) => {
if (key !== '') {
res[key + '/' + value.portType] = [{
HostPort: value.port
}];
exposedPorts[key + '/' + value.portType] = {};
}
return res;
}, {});
containerActions.update(this.props.container.Name, {
NetworkSettings: {
Ports: bindings
}
});
let hostConfig = _.extend(this.props.container.HostConfig, {PortBindings: portBindings});
containerActions.update(this.props.container.Name, {ExposedPorts: exposedPorts, HostConfig: hostConfig});
},
render: function () {
@ -201,7 +202,7 @@ var ContainerSettingsPorts = React.createClass({
var portKey = '';
var portValue = '';
if (key === '') {
icon = <td><a disabled={isUpdating} onClick={this.handleAddPort.bind(this)} className="only-icon btn btn-positive small"><span className="icon icon-add"></span></a></td>;
icon = <td><a disabled={isUpdating} onClick={this.handleAddPort} className="only-icon btn btn-positive small"><span className="icon icon-add"></span></a></td>;
portKey = <input id={'portKey' + key} type="text" disabled={isUpdating} defaultValue={key} />;
portValue = <input id={'portValue' + key} type="text" disabled={isUpdating} defaultValue={port} />;
}else {

View File

@ -296,6 +296,7 @@ export default {
data.Mounts = data.Mounts || existingData.Mounts;
var fullData = _.extend(existingData, data);
console.log(fullData);
this.createContainer(name, fullData);
});
},