Sha256: d487184da7a64991b26686a95802785da002a0b5aa0047fe46633f61d9492d80

Contents?: true

Size: 1.84 KB

Versions: 35

Compression:

Stored size: 1.84 KB

Contents

(function () {
    'use strict';

    /**
     * @ngdoc controller
     * @name  Bastion.environments.controller:NewEnvironmentController
     *
     * @description
     *   Handles creating a new environment.
     */
    function NewEnvironmentController($scope, Environment, FormUtils) {

        function success() {
            $scope.transitionTo('environments.index');
        }

        function error(response) {
            $scope.working = false;
            angular.forEach(response.data.errors, function (errors, field) {
                if ($scope.environmentForm.hasOwnProperty(field)) {
                    $scope.environmentForm[field].$setValidity('server', false);
                    $scope.environmentForm[field].$error.messages = errors;
                } else {
                    $scope.errorMessages.push(errors);
                }
            });
        }

        $scope.errorMessages = [];
        $scope.successMessages = [];

        $scope.loading = true;
        $scope.environment = new Environment();
        $scope.priorEnvironment = Environment.get({id: $scope.$stateParams.priorId});

        $scope.priorEnvironment.$promise.then(function () {
            $scope.loading = false;
        });

        $scope.save = function (environment) {
            environment['prior_id'] = $scope.$stateParams.priorId;
            environment.$save(success, error);
        };

        $scope.$watch('environment.name', function () {
            if ($scope.environmentForm.name) {
                $scope.environmentForm.name.$setValidity('server', true);
                FormUtils.labelize($scope.environment);
            }
        });

    }

    angular
        .module('Bastion.environments')
        .controller('NewEnvironmentController', NewEnvironmentController);

    NewEnvironmentController.$inject = ['$scope', 'Environment', 'FormUtils'];

})();

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
katello-3.3.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.3.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.3.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.3.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.3.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.3.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.3.0.rc1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.3.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.2.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.2.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.2.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.2.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.2.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.2.0.rc1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.2.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.1.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.1.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.1.0.rc2.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-3.0.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js
katello-2.4.5 engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/new-environment.controller.js