Force query selection for dashboards not to use descendants
This commit is contained in:
parent
867b1a4bc1
commit
421d1efa9b
@ -401,6 +401,18 @@ module DashboardsHelper
|
||||
title.presence || block_definition[:label]
|
||||
end
|
||||
|
||||
def options_for_query_select(klass, project)
|
||||
# sidebar_queries cannot be use because descendants classes are included
|
||||
# this changes on class loading
|
||||
# queries = klass.visible.global_or_on_project(@project).sorted.to_a
|
||||
queries = klass.visible
|
||||
.global_or_on_project(project)
|
||||
.where(type: klass.to_s)
|
||||
.sorted.to_a
|
||||
|
||||
tag.option + options_from_collection_for_select(queries, :id, :name)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Renders a single block content
|
||||
|
@ -12,7 +12,7 @@ div id="#{block}-settings" style="#{'display: none;' if hide}"
|
||||
= block_definition[:label]
|
||||
'
|
||||
= select_tag "settings[#{block}][query_id]",
|
||||
tag.option + options_from_collection_for_select(sidebar_queries(klass, @project), :id, :name),
|
||||
options_for_query_select(klass, @project),
|
||||
required: true
|
||||
p
|
||||
label
|
||||
|
Loading…
x
Reference in New Issue
Block a user