mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-12 09:17:05 +02:00
and move backup_file model under it. prepare for gathering models that concernig about archive
27 lines
810 B
Ruby
27 lines
810 B
Ruby
class Fluentd::Settings::HistoriesController < ApplicationController
|
|
before_action :login_required
|
|
before_action :find_fluentd
|
|
before_action :find_backup_file, only: [:show, :reuse]
|
|
|
|
def index
|
|
@backup_files = @fluentd.agent.backup_files_in_new_order.map do |file_path|
|
|
Fluentd::SettingArchive::BackupFile.new(file_path)
|
|
end
|
|
end
|
|
|
|
def show
|
|
end
|
|
|
|
def reuse
|
|
@fluentd.agent.config_write @backup_file.content
|
|
redirect_to daemon_setting_path, flash: { success: t('messages.config_successfully_copied', brand: fluentd_ui_brand) }
|
|
end
|
|
|
|
private
|
|
|
|
def find_backup_file
|
|
#Do not use BackupFile.new(params[:id]) because params[:id] can be any path.
|
|
@backup_file = Fluentd::SettingArchive::BackupFile.find_by_file_id(@fluentd.agent.config_backup_dir, params[:id])
|
|
end
|
|
end
|