Sha256: 18bc3b7aea5b51dbb33aa4c881a79de9216feb9547ef41c96cc976298731f14e

Contents?: true

Size: 1.66 KB

Versions: 14

Compression:

Stored size: 1.66 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;
            $scope.syncPlan.startDate = new Date();

            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

14 entries across 14 versions & 1 rubygems

Version Path
katello-3.8.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.7.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.7.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.8.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.8.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.8.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.7.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.8.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.7.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.7.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.6.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.6.0.1.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.6.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.6.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js