Display success flash should be succeed only

This commit is contained in:
uu59 2014-07-31 17:25:31 +09:00
parent 4d88f76887
commit fd2ceda5a4

View File

@ -2,26 +2,29 @@ class Fluentd::AgentsController < ApplicationController
before_action :find_fluentd
def start
unless @fluentd.agent.start
if @fluentd.agent.start
flash[:success] = t("messages.fluentd_start_stop_delay_notice", action: t('fluentd.common.start'))
else
flash[:error] = t("messages.fluentd_start_failed", brand: fluentd_ui_title) + @fluentd.agent.log_tail(1).first
end
flash[:success] = t("messages.fluentd_start_stop_delay_notice", action: t('fluentd.common.start'))
redirect_to daemon_path(@fluentd), status: 303 # 303 is change HTTP Verb GET
end
def stop
unless @fluentd.agent.stop
if @fluentd.agent.stop
flash[:success] = t("messages.fluentd_start_stop_delay_notice", action: t('fluentd.common.stop'))
else
flash[:error] = t("messages.fluentd_stop_failed", brand: fluentd_ui_title)
end
flash[:success] = t("messages.fluentd_start_stop_delay_notice", action: t('fluentd.common.stop'))
redirect_to daemon_path(@fluentd), status: 303 # 303 is change HTTP Verb GET
end
def restart
unless @fluentd.agent.restart
if @fluentd.agent.restart
flash[:success] = t("messages.fluentd_start_stop_delay_notice", action: t('fluentd.common.restart'))
else
flash[:error] = t("messages.fluentd_restart_failed", brand: fluentd_ui_title) + @fluentd.agent.log_tail(1).first
end
flash[:success] = t("messages.fluentd_start_stop_delay_notice", action: t('fluentd.common.restart'))
redirect_to daemon_path(@fluentd), status: 303 # 303 is change HTTP Verb GET
end