mirror of
https://github.com/fluent/fluentd-ui.git
synced 2025-08-09 15:57:05 +02:00
Associate a note with a backup file.
This commit is contained in:
parent
7a95af83ce
commit
a28b71084c
@ -2,15 +2,18 @@ class Fluentd
|
|||||||
module SettingArchive
|
module SettingArchive
|
||||||
class BackupFile
|
class BackupFile
|
||||||
include Archivable
|
include Archivable
|
||||||
|
attr_reader :note
|
||||||
|
|
||||||
FILE_EXTENSION = ".conf".freeze
|
FILE_EXTENSION = ".conf".freeze
|
||||||
|
|
||||||
def self.find_by_file_id(backup_dir, file_id)
|
def self.find_by_file_id(backup_dir, file_id)
|
||||||
new(file_path_of(backup_dir, file_id))
|
note = Note.find_by_file_id(backup_dir, file_id) rescue nil
|
||||||
|
new(file_path_of(backup_dir, file_id), note)
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(file_path)
|
def initialize(file_path, note = nil)
|
||||||
@file_path = file_path
|
@file_path = file_path
|
||||||
|
@note = note || Note.new(file_path.sub(/#{FILE_EXTENSION}$/, Note::FILE_EXTENSION))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user