mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 10:56:11 +02:00
Show exceptions if updating note fails.
This commit is contained in:
parent
336e22bea7
commit
9cc12f7bc3
@ -4,12 +4,8 @@ class Fluentd::Settings::NotesController < ApplicationController
|
||||
before_action :find_note, only: [:update]
|
||||
|
||||
def update
|
||||
if @note.update(params[:note][:content])
|
||||
flash[:success] = t('messages.note_updating_success')
|
||||
else
|
||||
flash[:error] = t('errors.messages.note_updating_failed')
|
||||
end
|
||||
redirect_to daemon_setting_path
|
||||
@note.update!(params[:note][:content])
|
||||
redirect_to daemon_setting_path, flash: { success: t('messages.note_updating_success') }
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
@ -18,16 +18,10 @@ class Fluentd
|
||||
@file_path = file_path
|
||||
end
|
||||
|
||||
def update(content)
|
||||
begin
|
||||
File.open(@file_path, "w") do |f|
|
||||
f.write content
|
||||
end
|
||||
rescue => ex
|
||||
Rails.logger.error ex.message
|
||||
return false
|
||||
def update!(content)
|
||||
File.open(@file_path, "w") do |f|
|
||||
f.write content
|
||||
end
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -287,7 +287,6 @@ en:
|
||||
is_a_directory: is a directory. should be a file
|
||||
duplicated_conf: Configurations is duplicated
|
||||
out_forward_blank_server: server settings should be at least one
|
||||
note_updating_failed: Updating the note is failed. See application logs.
|
||||
|
||||
activemodel: &activemodel
|
||||
errors:
|
||||
|
||||
@ -292,7 +292,6 @@ ja:
|
||||
is_a_directory: はディレクトリです。ファイルを指定してください
|
||||
duplicated_conf: 同じ内容の設定がすでに存在しています
|
||||
out_forward_blank_server: serverの設定がありません。
|
||||
note_updating_failed: メモの更新に失敗しました。ログを確認して下さい。
|
||||
|
||||
activemodel: &activemodel
|
||||
errors:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user