diff --git a/app/controllers/concerns/setting_history_concern.rb b/app/controllers/concerns/setting_history_concern.rb index 26abcfd..6e4796e 100644 --- a/app/controllers/concerns/setting_history_concern.rb +++ b/app/controllers/concerns/setting_history_concern.rb @@ -10,7 +10,7 @@ module SettingHistoryConcern def show current = @fluentd.agent.config target = @backup_file.content - @sdiff = Diff::LCS.sdiff(current.split("\n").map(&:rstrip), target.split("\n").map(&:rstrip)) + @sdiff = Diff::LCS.sdiff(current.split("\n").map(&:rstrip), target.split("\n").map(&:rstrip)) if target end def reuse diff --git a/app/views/fluentd/settings/running_backup/show.html.haml b/app/views/fluentd/settings/running_backup/show.html.haml index 68b8b42..5018e79 100644 --- a/app/views/fluentd/settings/running_backup/show.html.haml +++ b/app/views/fluentd/settings/running_backup/show.html.haml @@ -12,9 +12,20 @@ .row .col-xs-12 - if @backup_file.content + %h2 + = t('.page_title') %pre = preserve do = @backup_file.content - else %p =t('fluentd.common.never_started_yet', brand: fluentd_ui_brand) + - if @backup_file.content + .col-xs-12.diff + %h2 + Diff: + %div + = t(".diff_discription") + %div.pull-right + = link_to t(".show_current"), daemon_setting_path(@fluentd) + = preserve render "/shared/settings/diff" diff --git a/config/locales/translation_en.yml b/config/locales/translation_en.yml index 09a692f..db94c78 100644 --- a/config/locales/translation_en.yml +++ b/config/locales/translation_en.yml @@ -263,12 +263,14 @@ en: page_title: "Reuse Setting History" target_config: "Target Config" current_config: "Current Config" - diff_discription: "diff between current config and target config(%{file_name})" + diff_discription: "diff between current config and target config(%{file_name}) (showing with '+' and '-' if any)" show_current: "> see current config" running_backup: title: "Running Config" show: page_title: "Running Config" + diff_discription: "diff between config and running config (showing with '+' and '-' if any)" + show_current: "> see current config" misc: information: diff --git a/config/locales/translation_ja.yml b/config/locales/translation_ja.yml index b4fe2a3..bdabe44 100644 --- a/config/locales/translation_ja.yml +++ b/config/locales/translation_ja.yml @@ -268,12 +268,14 @@ ja: page_title: "設定履歴 | 詳細" target_config: "対象設定" current_config: "現在の設定" - diff_discription: "現在の設定と対象設定(%{file_name})の差分" + diff_discription: "現在の設定と対象設定(%{file_name})の差分(+-で表示)" show_current: "> 現在の設定を見る" running_backup: title: "使用中の設定" show: page_title: "使用中の設定" + diff_discription: "現在の設定と使用中の設定の差分(+-で表示)" + show_current: "> 現在の設定を見る" misc: information: diff --git a/spec/features/fluentd/setting/running_backup_spec.rb b/spec/features/fluentd/setting/running_backup_spec.rb index 2219c3d..aae7e47 100644 --- a/spec/features/fluentd/setting/running_backup_spec.rb +++ b/spec/features/fluentd/setting/running_backup_spec.rb @@ -36,6 +36,12 @@ describe "running_backup", stub: :daemon do expect(page).to have_text(I18n.t("terms.reuse")) end + it 'has diff' do + expect(page).to have_text("- type http") + expect(page).to have_text("- port 8899") + expect(page).to have_text("+ Running backup file content") + end + it 'update config and redirect to setting#show' do click_link I18n.t("terms.reuse")