app/controllers/fluentd/settings/out_td_controller.rb in fluentd-ui-0.1.2 vs app/controllers/fluentd/settings/out_td_controller.rb in fluentd-ui-0.1.3

- old
+ new

@@ -1,36 +1,18 @@ class Fluentd::Settings::OutTdController < ApplicationController - before_action :login_required - before_action :find_fluentd + include SettingConcern - def show - @setting = Fluentd::Setting::OutTd.new({ + private + + def target_class + Fluentd::Setting::OutTd + end + + def initial_params + { buffer_type: "file", buffer_path: "/var/log/td-agent/buffer/td", auto_create_table: true, match: "td.*.*", - }) + } end - - def finish - @setting = Fluentd::Setting::OutTd.new(setting_params) - unless @setting.valid? - return render "show" - end - - @fluentd.agent.config_append @setting.to_config - if @fluentd.agent.running? - unless @fluentd.agent.restart - @setting.errors.add(:base, @fluentd.agent.log_tail(1).first) - return render "show" - end - end - redirect_to daemon_setting_path(@fluentd) - end - - private - - def setting_params - params.require(:fluentd_setting_out_td).permit(*Fluentd::Setting::OutTd::KEYS) - end - end