Sha256: ed467aef74ad8d79d38115191dc076290c5854cecc6e706fef90dd8a5d87f223

Contents?: true

Size: 1.96 KB

Versions: 28

Compression:

Stored size: 1.96 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')}
            ];

        };

        /**
         * Create a sync plan, including setting the dates correctly.
         *
         * @returns $resource sync plan
         */
        this.createSyncPlan = function (syncPlan, success, error) {
            var GMT_OFFSET_MILLISECONDS = syncPlan.startDate.getTimezoneOffset() * 60000,
                syncDate = new Date(syncPlan.startDate.getTime() + GMT_OFFSET_MILLISECONDS),
                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

28 entries across 28 versions & 1 rubygems

Version Path
katello-3.8.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.7.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.7.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.8.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.8.0.rc3 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.8.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.7.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.8.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.7.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.7.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.5.2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.6.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.6.0.1.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.6.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.6.0.rc1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.5.1.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.5.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.5.0.1 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.5.0 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js
katello-3.5.0.rc2 engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plan-helper.service.js