mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
feat(volumes): check if volumes are used in service definitions (#1601)
This commit is contained in:
parent
672819f3af
commit
f31f29fa2f
2 changed files with 26 additions and 3 deletions
|
@ -11,5 +11,20 @@ angular.module('portainer.helpers')
|
|||
return options;
|
||||
};
|
||||
|
||||
helper.isVolumeUsedByAService = function(volume, services) {
|
||||
for (var i = 0; i < services.length; i++) {
|
||||
var service = services[i];
|
||||
var mounts = service.Mounts;
|
||||
for (var j = 0; j < mounts.length; j++) {
|
||||
var mount = mounts[j];
|
||||
if (mount.Source === volume.Id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
return helper;
|
||||
}]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue