Sha256: 053b57a4d55157f34d5afe7fcccdcb9bd5ebe006bf2198ef5821f2c423c25bbe

Contents?: true

Size: 1.93 KB

Versions: 159

Compression:

Stored size: 1.93 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();
            $scope.isWorking = false;

            function success(syncPlan) {
                $scope.isWorking = 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();
                $scope.isWorking = false;
                angular.forEach(response.data.errors, function (errors, field) {
                    if (form[field]) {
                        form[field].$setValidity('server', false);
                        form[field].$error.messages = errors;
                    } else {
                        Notification.setErrorMessage("Error saving the Sync Plan: " + " " + errors);
                    }
                });
            }

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

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

Version data entries

159 entries across 159 versions & 1 rubygems

Version Path
katello-3.17.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.17.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0.rc5.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0.rc5 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0.rc4.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.15.3.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.15.3 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0.rc4 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0.rc3.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.15.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0.rc2.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.15.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0.rc1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.15.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.16.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js
katello-3.15.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js