Sha256: 937e7bd86899e81b57dd1ac30b1a0c3a8840b83287112d6b798485f65dbb4966

Contents?: true

Size: 1.61 KB

Versions: 6

Compression:

Stored size: 1.61 KB

Contents

/**
 * @ngdoc object
 * @name  Bastion.sync-plans.controller:NewSyncPlanController
 *
 * @requires $scope
 * @requires translate
 * @requires SyncPlan
 * @requires SyncPlanHelper
 * @requires Notification
 *
 * @description
 *   Controls the creation of an empty SyncPlan object for use by sub-controllers.
 */
angular.module('Bastion.sync-plans').controller('NewSyncPlanController',
    ['$scope', '$rootScope', 'translate', 'SyncPlan', 'SyncPlanHelper', 'Notification',
        function ($scope, $rootScope, translate, SyncPlan, SyncPlanHelper, Notification) {
            $scope.intervals = SyncPlanHelper.getIntervals();

            $scope.syncPlan = new SyncPlan();
            $scope.syncPlan.interval = $scope.intervals[0].id;

            function success(syncPlan) {
                $scope.working = false;
                $scope.$state.go('sync-plan.info', {syncPlanId: syncPlan.id});
                Notification.setSuccessMessage(translate('New sync plan successfully created.'));
            }

            function error(response) {
                var form = SyncPlanHelper.getForm();

                angular.forEach(response.data.errors, function (errors, field) {
                    form[field].$setValidity('server', false);
                    form[field].$error.messages = errors;
                });

                $scope.working = false;
            }

            $scope.createSyncPlan = function (syncPlan) {
                SyncPlanHelper.createSyncPlan(syncPlan, success, error);
            };

            $scope.setForm = function (form) {
                SyncPlanHelper.setForm(form);
            };
        }]
);

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
katello-3.5.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.5.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.5.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.5.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.5.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.5.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js