From 3d750a0c7a5df14c495f4ee13643e200a6eba29e Mon Sep 17 00:00:00 2001 From: uu59 Date: Thu, 31 Jul 2014 11:42:17 +0900 Subject: [PATCH] Display a message for the daemon start/stop/restart could take a long time --- app/controllers/fluentd/agents_controller.rb | 3 +++ config/locales/translation_en.yml | 1 + config/locales/translation_ja.yml | 1 + 3 files changed, 5 insertions(+) diff --git a/app/controllers/fluentd/agents_controller.rb b/app/controllers/fluentd/agents_controller.rb index fc5cf96..2829fe8 100644 --- a/app/controllers/fluentd/agents_controller.rb +++ b/app/controllers/fluentd/agents_controller.rb @@ -5,6 +5,7 @@ class Fluentd::AgentsController < ApplicationController unless @fluentd.agent.start 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 @@ -12,6 +13,7 @@ class Fluentd::AgentsController < ApplicationController unless @fluentd.agent.stop 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 @@ -19,6 +21,7 @@ class Fluentd::AgentsController < ApplicationController unless @fluentd.agent.restart 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 diff --git a/config/locales/translation_en.yml b/config/locales/translation_en.yml index ca31ca8..2164329 100644 --- a/config/locales/translation_en.yml +++ b/config/locales/translation_en.yml @@ -7,6 +7,7 @@ en: fluentd_start_failed: Failed to start fluentd fluentd_stop_failed: Failed to stop fluentd fluentd_restart_failed: Failed to restart fluentd + fluentd_start_stop_delay_notice: "'%{action} daemon' is accepted. That operation could take a minute for complete." terms: &terms sign_in: Sign in diff --git a/config/locales/translation_ja.yml b/config/locales/translation_ja.yml index 7aac88f..410bfcf 100644 --- a/config/locales/translation_ja.yml +++ b/config/locales/translation_ja.yml @@ -7,6 +7,7 @@ ja: fluentd_start_failed: "%{brand}の起動に失敗しました。" fluentd_stop_failed: "%{brand}の停止に失敗しました。" fluentd_restart_failed: "%{brand}の再起動に失敗しました。" + fluentd_start_stop_delay_notice: "デーモンの%{action}を受け付けました。処理が完了するまで時間がかかる場合があります。" terms: &terms sign_in: ログイン