Sha256: 300800583acc32e6b4cbc4ded76c234278879813bbc5f901ffff706a5d988430
Contents?: true
Size: 1.4 KB
Versions: 6
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true class HomeController < ApplicationController def update return redirect_to(:back) unless is_admin # Update list of entities to synchronize current_organization.synchronized_entities.keys.each do |entity| current_organization.synchronized_entities[entity] = params[entity.to_s].present? end current_organization.sync_enabled = current_organization.synchronized_entities.values.any? current_organization.enable_historical_data(params['historical-data'].present?) trigger_sync = current_organization.sync_enabled && current_organization.sync_enabled_changed? current_organization.save # Trigger sync only if the sync has been enabled start_synchronization if trigger_sync redirect_to(:back) end def synchronize return redirect_to(:back) unless is_admin Maestrano::Connector::Rails::SynchronizationJob.perform_later(current_organization.id, (params['opts'] || {}).merge(forced: true)) flash[:info] = 'Synchronization requested' redirect_to(:back) end # Implement the redirection to the external application def redirect_to_external redirect_to 'https://path/to/external/app' end private def start_synchronization Maestrano::Connector::Rails::SynchronizationJob.perform_later(current_organization.id, {}) flash[:info] = 'Congrats, you\'re all set up! Your data are now being synced' end end
Version data entries
6 entries across 6 versions & 1 rubygems