mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 07:19:41 +02:00
feat(service): add hosts file entries in service create/update (#1511)
This commit is contained in:
parent
c9e060d574
commit
8e40eb1844
6 changed files with 152 additions and 1 deletions
|
@ -191,5 +191,31 @@ angular.module('portainer.helpers').factory('ServiceHelper', [function ServiceHe
|
|||
return humanDuration;
|
||||
};
|
||||
|
||||
helper.translateHostsEntriesToHostnameIP = function(entries) {
|
||||
var ipHostEntries = [];
|
||||
if (entries) {
|
||||
entries.forEach(function(entry) {
|
||||
if (entry.indexOf(' ') && entry.split(' ').length === 2) {
|
||||
var keyValue = entry.split(' ');
|
||||
ipHostEntries.push({ hostname: keyValue[1], ip: keyValue[0]});
|
||||
}
|
||||
});
|
||||
}
|
||||
return ipHostEntries;
|
||||
};
|
||||
|
||||
|
||||
helper.translateHostnameIPToHostsEntries = function(entries) {
|
||||
var ipHostEntries = [];
|
||||
if (entries) {
|
||||
entries.forEach(function(entry) {
|
||||
if (entry.ip && entry.hostname) {
|
||||
ipHostEntries.push(entry.ip + ' ' + entry.hostname);
|
||||
}
|
||||
});
|
||||
}
|
||||
return ipHostEntries;
|
||||
};
|
||||
|
||||
return helper;
|
||||
}]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue