Sha256: 3539fa9795e9b0d51685285730a32d30be28af0959a83a3155e8ce2dce178f0e

Contents?: true

Size: 1.69 KB

Versions: 10

Compression:

Stored size: 1.69 KB

Contents

/**
 * @ngdoc object
 * @name  Bastion.content-hosts.controller:ContentHostProductsController
 *
 * @requires $scope
 * @requires translate
 * @requires ContentHost
 * @requires Product
 * @requires CurrentOrganization
 *
 * @description
 *   Provides the functionality for the content-host products action pane.
 */
angular.module('Bastion.content-hosts').controller('ContentHostProductsController',
    ['$scope', 'translate', 'ContentHost', 'Product', 'CurrentOrganization',
    function ($scope, translate, ContentHost, Product, CurrentOrganization) {

        $scope.successMessages = [];
        $scope.errorMessages = [];
        $scope.displayArea = { working: true, isAvailableContent: false };

        $scope.isAnyAvailableContent = function (products) {
            var isAvailableContent = false;
            angular.forEach(products, function (product) {
                if (product['available_content'].length > 0) {
                    isAvailableContent = true;
                }
            });
            return isAvailableContent;
        };

        $scope.contentHost.$promise.then(function () {
            ContentHost.products({id: $scope.contentHost.uuid,
                                  'organization_id': CurrentOrganization,
                                  enabled: true,
                                  'full_result': true,
                                  'include_available_content': true
                                 }, function (response) {
                $scope.products = response.results;
                $scope.displayArea.isAvailableContent = $scope.isAnyAvailableContent($scope.products);
                $scope.displayArea.working = false;
            });
        });

    }]
);

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katello-2.4.5 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js
katello-2.4.4 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js
katello-2.4.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js
katello-2.4.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js
katello-3.0.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js
katello-2.4.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js
katello-2.4.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js
katello-2.4.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js
katello-2.4.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js
katello-2.4.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-products.controller.js