mirror of
https://github.com/fluent/fluentd-ui.git
synced 2026-05-05 19:06:12 +02:00
Extract element_type method
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
parent
4d22b8065f
commit
1657abf6eb
@ -51,19 +51,23 @@ class Api::SettingsController < ApplicationController
|
||||
end
|
||||
|
||||
def element_id(label_name, element)
|
||||
element_type = case element.name
|
||||
when "source"
|
||||
:sources
|
||||
when "filter"
|
||||
:filters
|
||||
when "match"
|
||||
:matches
|
||||
end
|
||||
element_type = element_type(element.name)
|
||||
elements = @config.group_by_label.dig(label_name, element_type)
|
||||
index = elements.index(element)
|
||||
"#{label_name}:#{"%06d" % index}#{Digest::MD5.hexdigest(element.to_s)}"
|
||||
end
|
||||
|
||||
def element_type(name)
|
||||
case name
|
||||
when "source"
|
||||
:sources
|
||||
when "filter"
|
||||
:filters
|
||||
when "match"
|
||||
:matches
|
||||
end
|
||||
end
|
||||
|
||||
def render_404
|
||||
render nothing: true, status: 404
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user