2017-02-10 01:11:36 +00:00
|
|
|
function TemplateViewModel(data) {
|
|
|
|
this.Title = data.title;
|
|
|
|
this.Description = data.description;
|
2017-04-18 16:16:00 +00:00
|
|
|
this.Note = data.note ? data.note : data.description;
|
2017-04-05 08:13:32 +00:00
|
|
|
this.Category = data.category;
|
2017-02-10 01:11:36 +00:00
|
|
|
this.Logo = data.logo;
|
|
|
|
this.Image = data.image;
|
|
|
|
this.Registry = data.registry ? data.registry : '';
|
2017-02-10 05:11:00 +00:00
|
|
|
this.Command = data.command ? data.command : '';
|
2017-02-10 20:32:34 +00:00
|
|
|
this.Network = data.network ? data.network : '';
|
2017-02-10 01:11:36 +00:00
|
|
|
this.Env = data.env ? data.env : [];
|
2017-03-10 14:43:57 +00:00
|
|
|
this.Privileged = data.privileged ? data.privileged : false;
|
2017-02-13 05:16:14 +00:00
|
|
|
this.Volumes = [];
|
|
|
|
if (data.volumes) {
|
|
|
|
this.Volumes = data.volumes.map(function (v) {
|
|
|
|
return {
|
|
|
|
readOnly: false,
|
|
|
|
containerPath: v,
|
|
|
|
type: 'auto'
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
2017-02-10 01:11:36 +00:00
|
|
|
this.Ports = [];
|
|
|
|
if (data.ports) {
|
|
|
|
this.Ports = data.ports.map(function (p) {
|
|
|
|
var portAndProtocol = _.split(p, '/');
|
|
|
|
return {
|
|
|
|
containerPort: portAndProtocol[0],
|
|
|
|
protocol: portAndProtocol[1]
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|