mirror of https://github.com/docker/docs.git
Merge pull request #654 from TeckniX/add-tty-stdin
Added support for docker tty stdin options
This commit is contained in:
commit
11739f0eac
|
|
@ -22,10 +22,14 @@ var ContainerSettingsGeneral = React.createClass({
|
||||||
return [util.randomId(), e[0], e[1]];
|
return [util.randomId(), e[0], e[1]];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let [tty, openStdin] = ContainerUtil.mode(this.props.container) || [true, true];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
slugName: null,
|
slugName: null,
|
||||||
nameError: null,
|
nameError: null,
|
||||||
env: env
|
env: env,
|
||||||
|
tty: tty,
|
||||||
|
openStdin: openStdin
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -90,7 +94,9 @@ var ContainerSettingsGeneral = React.createClass({
|
||||||
list.push(key + '=' + value);
|
list.push(key + '=' + value);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
containerActions.update(this.props.container.Name, {Env: list});
|
let tty = this.state.tty;
|
||||||
|
let openStdin = this.state.openStdin;
|
||||||
|
containerActions.update(this.props.container.Name, {Env: list, Tty: tty, OpenStdin: openStdin});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleChangeEnvKey: function (index, event) {
|
handleChangeEnvKey: function (index, event) {
|
||||||
|
|
@ -133,6 +139,18 @@ var ContainerSettingsGeneral = React.createClass({
|
||||||
metrics.track('Removed Environment Variable');
|
metrics.track('Removed Environment Variable');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleChangeTty: function () {
|
||||||
|
this.setState({
|
||||||
|
tty: !this.state.tty
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleChangeOpenStdin: function () {
|
||||||
|
this.setState({
|
||||||
|
openStdin: !this.state.openStdin
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
handleDeleteContainer: function () {
|
handleDeleteContainer: function () {
|
||||||
dialog.showMessageBox({
|
dialog.showMessageBox({
|
||||||
message: 'Are you sure you want to delete this container?',
|
message: 'Are you sure you want to delete this container?',
|
||||||
|
|
@ -211,6 +229,13 @@ var ContainerSettingsGeneral = React.createClass({
|
||||||
<div className="env-vars">
|
<div className="env-vars">
|
||||||
{vars}
|
{vars}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="settings-section">
|
||||||
|
<div className="env-vars">
|
||||||
|
<h4>Advanced Options</h4>
|
||||||
|
<p><input type="checkbox" checked={this.state.tty} onChange={this.handleChangeTty}/> Attach standard streams to a tty, including stdin if it is not closed</p>
|
||||||
|
<p><input type="checkbox" checked={this.state.openStdin} onChange={this.handleChangeOpenStdin}/> Keep STDIN open even if not attached</p>
|
||||||
|
</div>
|
||||||
<a className="btn btn-action" disabled={this.props.container.State.Updating} onClick={this.handleSaveEnvVars}>Save</a>
|
<a className="btn btn-action" disabled={this.props.container.State.Updating} onClick={this.handleSaveEnvVars}>Save</a>
|
||||||
</div>
|
</div>
|
||||||
<div className="settings-section">
|
<div className="settings-section">
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,14 @@ var ContainerUtil = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Provide Foreground options
|
||||||
|
mode: function (container) {
|
||||||
|
if (!container || !container.Config) {
|
||||||
|
return [true, true];
|
||||||
|
}
|
||||||
|
return [container.Config.Tty, container.Config.OpenStdin];
|
||||||
|
},
|
||||||
|
|
||||||
// TODO: inject host here instead of requiring Docker
|
// TODO: inject host here instead of requiring Docker
|
||||||
ports: function (container) {
|
ports: function (container) {
|
||||||
if (!container || !container.NetworkSettings) {
|
if (!container || !container.NetworkSettings) {
|
||||||
|
|
|
||||||
|
|
@ -101,6 +101,7 @@ export default {
|
||||||
containerData.Env = containerData.Config.Env;
|
containerData.Env = containerData.Config.Env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
containerData.Volumes = _.mapObject(containerData.Volumes, () => {return {};});
|
containerData.Volumes = _.mapObject(containerData.Volumes, () => {return {};});
|
||||||
|
|
||||||
let existing = this.client.getContainer(name);
|
let existing = this.client.getContainer(name);
|
||||||
|
|
@ -160,6 +161,8 @@ export default {
|
||||||
Config: {
|
Config: {
|
||||||
Image: imageName,
|
Image: imageName,
|
||||||
},
|
},
|
||||||
|
Tty: true,
|
||||||
|
OpenStdin: true,
|
||||||
State: {
|
State: {
|
||||||
Downloading: true
|
Downloading: true
|
||||||
}
|
}
|
||||||
|
|
@ -181,7 +184,7 @@ export default {
|
||||||
|
|
||||||
delete this.placeholders[name];
|
delete this.placeholders[name];
|
||||||
localStorage.setItem('placeholders', JSON.stringify(this.placeholders));
|
localStorage.setItem('placeholders', JSON.stringify(this.placeholders));
|
||||||
this.createContainer(name, {Image: imageName});
|
this.createContainer(name, {Image: imageName, Tty: true, OpenStdin: true});
|
||||||
},
|
},
|
||||||
|
|
||||||
// progress is actually the progression PER LAYER (combined in columns)
|
// progress is actually the progression PER LAYER (combined in columns)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue