Sha256: 05f7ac9bc9c79d9db12a5e3bda4b0736ec5942cebbf8b674553ddfcd689ef21d

Contents?: true

Size: 1.71 KB

Versions: 30

Compression:

Stored size: 1.71 KB

Contents

/**
 * @ngdoc service
 * @name  Bastion.content-hosts.service:ContentHostsHelper
 *
 * @description
 *   Helper service that contains functionality common amongst content hosts.
 */
angular.module('Bastion.content-hosts').service('ContentHostsHelper',
    function () {
        this.convertMemToGB = function (memoryValue) {
            if (angular.isString(memoryValue)) {
                memoryValue = memoryValue.toLowerCase();
                if (_.includes(memoryValue, "gb")) {
                    memoryValue = memoryValue.replace("gb", "").trim();
                    return memoryValue;
                }
                memoryValue = parseInt(memoryValue);
            }
            memoryValue = (memoryValue / 1048576).toFixed(2);
            return memoryValue;
        };

        this.getHostStatusIcon = function (globalStatus) {
            var icons;
            var colors = {
                0: 'green',
                1: 'yellow',
                2: 'red'
            };

            globalStatus = colors[globalStatus] || "red";
            icons = {
                'green': globalStatus + ' host-status pficon pficon-ok status-ok',
                'yellow': globalStatus + ' host-status pficon pficon-info status-warn',
                'red': globalStatus + ' host-status pficon pficon-error-circle-o status-error'
            };

            return icons[globalStatus];
        };

        this.getHostPurposeStatusIcon = function (statusCode) {
            var code = parseInt(statusCode);

            if (code === 0) { // matched
                return 'pficon pficon-ok';
            } else if (code === 1) { // mismatched
                return 'pficon pficon-warning-triangle-o';
            }
        };
    }
);

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
katello-3.15.3.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.0.rc1.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.0.rc1.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.0.rc1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.15.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.14.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.13.4 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.14.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.13.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.14.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.13.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.14.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js
katello-3.13.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/content-hosts-helper.service.js