Sha256: e6991baff3b5b9d3ddde406796bae1ded4819746196755391eee949a838abefb
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
module SettingConcern extend ActiveSupport::Concern included do before_action :login_required before_action :find_fluentd helper_method :target_plugin_name, :plugin_setting_form_action_url end def show @setting = target_class.new(initial_params) @buffer = @setting.create_buffer @storage = @setting.create_storage @parser = @setting.create_parser @formatter = @setting.create_formatter render "shared/settings/show" end def finish @setting = target_class.new(setting_params) unless @setting.valid? return render "shared/settings/show" end @fluentd.agent.config_merge(@setting.to_config.to_s) if @fluentd.agent.running? unless @fluentd.agent.restart @setting.errors.add(:base, @fluentd.agent.log.tail(1).first) return render "shared/settings/show" end end redirect_to daemon_setting_path(@fluentd) end private def setting_params params.require(:setting).permit(*target_class.permit_params) end def initial_params target_class.initial_params end def target_plugin_name prefix = case target_class.plugin_type when "input" "in" when "output" "out" else target_class.plugin_type end "#{prefix}_#{target_class.plugin_name}" end def plugin_setting_form_action_url(*args) send("finish_daemon_setting_#{target_plugin_name}_path", *args) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fluentd-ui-1.2.1 | app/controllers/concerns/setting_concern.rb |
fluentd-ui-1.2.0 | app/controllers/concerns/setting_concern.rb |
fluentd-ui-1.1.0 | app/controllers/concerns/setting_concern.rb |