Commit 58d220bd authored by Stan Hu's avatar Stan Hu

Merge branch 'unlink-metrics-feature-flags' into 'master'

Refactor EnvironmentsController#metrics_dashboard endpoint

See merge request gitlab-org/gitlab-ce!30782
parents be7290a9 c290eca1
...@@ -160,20 +160,22 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -160,20 +160,22 @@ class Projects::EnvironmentsController < Projects::ApplicationController
end end
def metrics_dashboard def metrics_dashboard
return render_403 unless Feature.enabled?(:environment_metrics_use_prometheus_endpoint, project) if Feature.enabled?(:gfm_embedded_metrics, project) && params[:embedded]
if Feature.enabled?(:environment_metrics_show_multiple_dashboards, project)
result = dashboard_finder.find( result = dashboard_finder.find(
project, project,
current_user, current_user,
environment, environment,
dashboard_path: params[:dashboard],
embedded: params[:embedded] embedded: params[:embedded]
) )
elsif Feature.enabled?(:environment_metrics_show_multiple_dashboards, project)
result = dashboard_finder.find(
project,
current_user,
environment,
dashboard_path: params[:dashboard]
)
unless params[:embedded] result[:all_dashboards] = dashboard_finder.find_all_paths(project)
result[:all_dashboards] = dashboard_finder.find_all_paths(project)
end
else else
result = dashboard_finder.find(project, current_user, environment) result = dashboard_finder.find(project, current_user, environment)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment