mirror of https://github.com/portainer/portainer
feat(templates): Support interactive templates (#819)
parent
09aa67ba61
commit
c3363604ac
|
@ -66,6 +66,18 @@ angular.module('portainer.helpers')
|
|||
return env;
|
||||
};
|
||||
|
||||
helper.getConsoleConfiguration = function(interactiveFlag) {
|
||||
var consoleConfiguration = {
|
||||
openStdin: false,
|
||||
tty: false
|
||||
};
|
||||
if (interactiveFlag === true) {
|
||||
consoleConfiguration.openStdin = true;
|
||||
consoleConfiguration.tty = true;
|
||||
}
|
||||
return consoleConfiguration;
|
||||
};
|
||||
|
||||
helper.createVolumeBindings = function(volumes, generatedVolumesPile) {
|
||||
volumes.forEach(function (volume) {
|
||||
if (volume.containerPath) {
|
||||
|
|
|
@ -11,6 +11,7 @@ function TemplateViewModel(data) {
|
|||
this.Env = data.env ? data.env : [];
|
||||
this.Privileged = data.privileged ? data.privileged : false;
|
||||
this.Volumes = [];
|
||||
this.Interactive = data.interactive ? data.interactive : false;
|
||||
if (data.volumes) {
|
||||
this.Volumes = data.volumes.map(function (v) {
|
||||
return {
|
||||
|
|
|
@ -42,6 +42,9 @@ angular.module('portainer.services')
|
|||
var portConfiguration = TemplateHelper.portArrayToPortConfiguration(template.Ports);
|
||||
configuration.HostConfig.PortBindings = portConfiguration.bindings;
|
||||
configuration.ExposedPorts = portConfiguration.exposedPorts;
|
||||
var consoleConfiguration = TemplateHelper.getConsoleConfiguration(template.Interactive);
|
||||
configuration.OpenStdin = consoleConfiguration.openStdin;
|
||||
configuration.Tty = consoleConfiguration.tty;
|
||||
return configuration;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue