mirror of https://github.com/docker/docs.git
Updating the branch to the latest master and making it work with the new docker daemon evolutions
This commit is contained in:
parent
49833aaccd
commit
a0332d279b
|
|
@ -45,22 +45,24 @@ var ContainerSettingsPorts = React.createClass({
|
||||||
document.getElementById('portValue').value = '';
|
document.getElementById('portValue').value = '';
|
||||||
},
|
},
|
||||||
addPort: function () {
|
addPort: function () {
|
||||||
var portKey = document.getElementById('portKey').value;
|
if (document.getElementById('portKey') != null){
|
||||||
var portValue = document.getElementById('portValue').value;
|
var portKey = document.getElementById('portKey').value;
|
||||||
var portTypeValue = document.getElementById('portType').textContent;
|
var portValue = document.getElementById('portValue').value;
|
||||||
var ports = this.state.ports;
|
var portTypeValue = document.getElementById('portType').textContent;
|
||||||
if (portKey !== '') {
|
var ports = this.state.ports;
|
||||||
ports[portKey] = {
|
if (portKey !== '') {
|
||||||
ip: docker.host,
|
ports[portKey] = {
|
||||||
url: docker.host + ':' + portValue,
|
ip: docker.host,
|
||||||
port: portValue,
|
url: docker.host + ':' + portValue,
|
||||||
portType: portTypeValue.trim(),
|
port: portValue,
|
||||||
error: null
|
portType: portTypeValue.trim(),
|
||||||
};
|
error: null
|
||||||
|
};
|
||||||
|
|
||||||
this.checkPort(ports, portKey, portKey);
|
this.checkPort(ports, portKey, portKey);
|
||||||
if (ports[portKey].error === null) {
|
if (ports[portKey].error === null) {
|
||||||
this.createEmptyPort(ports);
|
this.createEmptyPort(ports);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ports;
|
return ports;
|
||||||
|
|
@ -169,20 +171,19 @@ var ContainerSettingsPorts = React.createClass({
|
||||||
let ports = this.state.ports;
|
let ports = this.state.ports;
|
||||||
ports = this.addPort();
|
ports = this.addPort();
|
||||||
this.setState({ports: ports});
|
this.setState({ports: ports});
|
||||||
let bindings = _.reduce(ports, (res, value, key) => {
|
let exposedPorts = {};
|
||||||
|
let portBindings = _.reduce(ports, (res, value, key) => {
|
||||||
if (key !== '') {
|
if (key !== '') {
|
||||||
res[key + '/' + value.portType] = [{
|
res[key + '/' + value.portType] = [{
|
||||||
HostPort: value.port
|
HostPort: value.port
|
||||||
}];
|
}];
|
||||||
|
exposedPorts[key + '/' + value.portType] = {};
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
containerActions.update(this.props.container.Name, {
|
let hostConfig = _.extend(this.props.container.HostConfig, {PortBindings: portBindings});
|
||||||
NetworkSettings: {
|
containerActions.update(this.props.container.Name, {ExposedPorts: exposedPorts, HostConfig: hostConfig});
|
||||||
Ports: bindings
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
},
|
},
|
||||||
render: function () {
|
render: function () {
|
||||||
|
|
@ -201,7 +202,7 @@ var ContainerSettingsPorts = React.createClass({
|
||||||
var portKey = '';
|
var portKey = '';
|
||||||
var portValue = '';
|
var portValue = '';
|
||||||
if (key === '') {
|
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} />;
|
portKey = <input id={'portKey' + key} type="text" disabled={isUpdating} defaultValue={key} />;
|
||||||
portValue = <input id={'portValue' + key} type="text" disabled={isUpdating} defaultValue={port} />;
|
portValue = <input id={'portValue' + key} type="text" disabled={isUpdating} defaultValue={port} />;
|
||||||
}else {
|
}else {
|
||||||
|
|
|
||||||
|
|
@ -296,6 +296,7 @@ export default {
|
||||||
data.Mounts = data.Mounts || existingData.Mounts;
|
data.Mounts = data.Mounts || existingData.Mounts;
|
||||||
|
|
||||||
var fullData = _.extend(existingData, data);
|
var fullData = _.extend(existingData, data);
|
||||||
|
console.log(fullData);
|
||||||
this.createContainer(name, fullData);
|
this.createContainer(name, fullData);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue