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.10.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.9.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.10.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.10.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.8.4 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.9.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.8.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.9.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.7.6 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.8.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.9.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.9.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.8.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.7.5 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.8.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.8.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.7.4 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.8.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.7.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js
katello-4.7.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/paths.service.js