Sha256: 2c3def56826c5cf483d0447babdb7d200903b6ec3b62161bb0d7937d5eda0610

Contents?: true

Size: 1.91 KB

Versions: 181

Compression:

Stored size: 1.91 KB

Contents

(function () {

    /**
     * @ngdoc service
     * @name Bastion.sync-plans.service:SyncPlanHelper
     *
     * @description
     *   Provides a helper service for Sync Plans
     *
     */
    function SyncPlanHelper(translate) {

        /**
         * Get the set form.  Allows the sharing of form data across controllers
         *
         * @param form the form to set
         */
        this.setForm = function (form) {
            this.form = form;
        };

        /**
         * Set the form.  Allows the sharing of form data across controllers
         *
         * @returns {form|*} the stored form
         */
        this.getForm = function () {
            return this.form;
        };

        /**
         * Returns the valid sync plan intervals.
         *
         * @returns {{id: string, value: *}[]}
         */
        this.getIntervals = function () {
            return [
                {id: 'hourly', value: translate('hourly')},
                {id: 'daily', value: translate('daily')},
                {id: 'weekly', value: translate('weekly')},
                {id: 'custom cron', value: translate('custom cron')}
            ];

        };

        /**
         * Create a sync plan, including setting the dates correctly.
         *
         * @returns $resource sync plan
         */
        this.createSyncPlan = function (syncPlan, success, error) {
            var syncDate = new Date(syncPlan.startDate.getTime()),
                syncTime = new Date(syncPlan.startTime || new Date());
            syncDate.setHours(syncTime.getHours());
            syncDate.setMinutes(syncTime.getMinutes());
            syncDate.setSeconds(0);

            syncPlan['sync_date'] = syncDate.toString();
            syncPlan.$save(success, error);
            return syncPlan;
        };
    }

    angular.module('Bastion.sync-plans').service('SyncPlanHelper', SyncPlanHelper);
    SyncPlanHelper.$inject = ['translate'];
})();

Version data entries

181 entries across 181 versions & 1 rubygems

Version Path
katello-4.14.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.15.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.15.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.15.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.14.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.14.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.14.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.14.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.14.0.rc1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.14.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.13.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.13.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.12.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.13.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.12.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.12.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.12.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.12.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.11.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-4.11.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js