mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
refactor(templates): refactor controller code and create required services (#580)
This commit is contained in:
parent
06a484880b
commit
2f3475b96a
10 changed files with 421 additions and 249 deletions
19
app/models/template.js
Normal file
19
app/models/template.js
Normal file
|
@ -0,0 +1,19 @@
|
|||
function TemplateViewModel(data) {
|
||||
this.Title = data.title;
|
||||
this.Description = data.description;
|
||||
this.Logo = data.logo;
|
||||
this.Image = data.image;
|
||||
this.Registry = data.registry ? data.registry : '';
|
||||
this.Env = data.env ? data.env : [];
|
||||
this.Volumes = data.volumes ? data.volumes : [];
|
||||
this.Ports = [];
|
||||
if (data.ports) {
|
||||
this.Ports = data.ports.map(function (p) {
|
||||
var portAndProtocol = _.split(p, '/');
|
||||
return {
|
||||
containerPort: portAndProtocol[0],
|
||||
protocol: portAndProtocol[1]
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue