1
0
Fork 0
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:
Anthony Lapenna 2018-01-25 08:13:56 +01:00 committed by GitHub
parent 672819f3af
commit f31f29fa2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 3 deletions

View file

@ -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;
}]);