mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 01:07:09 +02:00
Show diff with current file in running backup page
This commit is contained in:
parent
696008e821
commit
638f681541
@ -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
|
||||
|
@ -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"
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user