2017-01-31 23:26:29 +00:00
|
|
|
angular.module('portainer.helpers')
|
|
|
|
.factory('ContainerHelper', [function ContainerHelperFactory() {
|
|
|
|
'use strict';
|
2017-02-10 05:11:00 +00:00
|
|
|
var helper = {};
|
|
|
|
|
|
|
|
helper.commandStringToArray = function(command) {
|
|
|
|
return splitargs(command);
|
|
|
|
};
|
|
|
|
|
|
|
|
helper.hideContainers = function(containers, containersToHideLabels) {
|
|
|
|
return containers.filter(function (container) {
|
|
|
|
var filterContainer = false;
|
|
|
|
containersToHideLabels.forEach(function(label, index) {
|
|
|
|
if (_.has(container.Labels, label.name) &&
|
|
|
|
container.Labels[label.name] === label.value) {
|
|
|
|
filterContainer = true;
|
2017-01-31 23:26:29 +00:00
|
|
|
}
|
|
|
|
});
|
2017-02-10 05:11:00 +00:00
|
|
|
if (!filterContainer) {
|
|
|
|
return container;
|
|
|
|
}
|
|
|
|
});
|
2017-01-31 23:26:29 +00:00
|
|
|
};
|
2017-02-10 05:11:00 +00:00
|
|
|
|
|
|
|
return helper;
|
2017-01-31 23:26:29 +00:00
|
|
|
}]);
|