Sha256: eb017d9f4911ee93e518a28ec1155694e64200cf3327b1fdce3bb4a97eae8fd8

Contents?: true

Size: 1.85 KB

Versions: 188

Compression:

Stored size: 1.85 KB

Contents

angular.module('Bastion.environments').service('PathsService',
    ['$q', 'Organization', 'CurrentOrganization',
        function ($q, Organization, CurrentOrganization) {

            this.getActualPaths = function () {
                var actualPaths = [];

                return this.loadPaths().then(function (paths) {
                    var data = {};
                    data.library = paths[0].environments[0];

                    angular.forEach(paths, function (path, index) {
                        paths[index].environments.splice(0, 1);

                        if (paths[index].environments.length !== 0) {
                            actualPaths.push(path);
                        }
                    });
                    data.paths = actualPaths;
                    return data;
                });
            };

            this.loadPaths = function () {
                var deferred = $q.defer();

                Organization.paths({id: CurrentOrganization}, function (response) {
                    deferred.resolve(response);
                });
                return deferred.promise;
            };

            this.getCurrentPath = function (prior) {
                return this.loadPaths().then(function (paths) {
                    var currentPath = null;
                    if (prior.library) {
                        currentPath = [prior];
                    } else {
                        angular.forEach(paths, function (path) {
                            angular.forEach(path.environments, function (env) {
                                if (env.id === prior.id) {
                                    currentPath = path;
                                }
                            });
                        });
                    }
                    return currentPath.environments;
                });
            };
        }]
);

Version data entries

188 entries across 188 versions & 1 rubygems

Version Path
katello-4.2.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.0.2.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.1.2.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.0.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.1.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-3.18.4 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.1.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.0.1.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-3.18.3.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.1.0.rc2.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.1.0.rc2.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.0.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-3.18.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.1.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.1.0.rc1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.1.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.0.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.0.0.rc3.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js