Commit 7b6be4d2 authored by rpereira2's avatar rpereira2 Committed by Miguel Rincon

Remove feature flag metrics_dashboard_new_panel_page

Now that the new panel page on the frontend is ready, we can remove
the feature flag.
parent 75ce65df
......@@ -14,7 +14,6 @@ class Projects::EnvironmentsController < Projects::ApplicationController
push_frontend_feature_flag(:prometheus_computed_alerts)
push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate)
push_frontend_feature_flag(:metrics_dashboard_new_panel_page)
end
before_action :authorize_read_environment!, except: [:metrics, :additional_metrics, :metrics_dashboard, :metrics_redirect]
before_action :authorize_create_environment!, only: [:new, :create]
......
......@@ -4,7 +4,6 @@ module Projects
module Metrics
module Dashboards
class BuilderController < Projects::ApplicationController
before_action :ensure_feature_flags
before_action :authorize_metrics_dashboard!
def panel_preview
......@@ -21,10 +20,6 @@ module Projects
private
def ensure_feature_flags
render_404 unless Feature.enabled?(:metrics_dashboard_new_panel_page, project)
end
def rendered_panel
@panel_preview ||= ::Metrics::Dashboard::PanelPreviewService.new(project, panel_yaml, environment).execute
end
......
......@@ -10,14 +10,9 @@ module Projects
before_action do
push_frontend_feature_flag(:prometheus_computed_alerts)
push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate)
push_frontend_feature_flag(:metrics_dashboard_new_panel_page)
end
def show
if params[:page].present? && !Feature.enabled?(:metrics_dashboard_new_panel_page, project)
return render_404
end
if environment
render 'projects/environments/metrics'
else
......
---
title: Make available new UI for adding a panel to a metrics dashboard
merge_request: 39124
author:
type: added
......@@ -49,10 +49,6 @@ RSpec.describe 'Projects::Metrics::Dashboards::BuilderController' do
describe 'POST /:namespace/:project/-/metrics/dashboards/builder' do
context 'as anonymous user' do
before do
stub_feature_flags(metrics_dashboard_new_panel_page: true)
end
it 'redirects user to sign in page' do
send_request
......@@ -62,7 +58,6 @@ RSpec.describe 'Projects::Metrics::Dashboards::BuilderController' do
context 'as user with guest access' do
before do
stub_feature_flags(metrics_dashboard_new_panel_page: true)
project.add_guest(user)
login_as(user)
end
......@@ -80,48 +75,30 @@ RSpec.describe 'Projects::Metrics::Dashboards::BuilderController' do
login_as(user)
end
context 'metrics_dashboard_new_panel_page is enabled' do
before do
stub_feature_flags(metrics_dashboard_new_panel_page: true)
end
context 'valid yaml panel is supplied' do
it 'returns success' do
send_request(panel_yaml: valid_panel_yml)
context 'valid yaml panel is supplied' do
it 'returns success' do
send_request(panel_yaml: valid_panel_yml)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to include('title' => 'Super Chart A1', 'type' => 'area-chart')
end
end
context 'invalid yaml panel is supplied' do
it 'returns unprocessable entity' do
send_request(panel_yaml: invalid_panel_yml)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response['message']).to eq('Each "panel" must define an array :metrics')
end
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to include('title' => 'Super Chart A1', 'type' => 'area-chart')
end
end
context 'invalid panel_yaml is not a yaml string' do
it 'returns unprocessable entity' do
send_request(panel_yaml: 1)
context 'invalid yaml panel is supplied' do
it 'returns unprocessable entity' do
send_request(panel_yaml: invalid_panel_yml)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response['message']).to eq('Invalid configuration format')
end
expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response['message']).to eq('Each "panel" must define an array :metrics')
end
end
context 'metrics_dashboard_new_panel_page is disabled' do
before do
stub_feature_flags(metrics_dashboard_new_panel_page: false)
end
it 'returns not found' do
send_request
context 'invalid panel_yaml is not a yaml string' do
it 'returns unprocessable entity' do
send_request(panel_yaml: 1)
expect(response).to have_gitlab_http_status(:not_found)
expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response['message']).to eq('Invalid configuration format')
end
end
end
......
......@@ -96,26 +96,26 @@ RSpec.describe 'metrics dashboard page' do
end
describe 'GET :/namespace/:project/-/metrics/:page' do
it 'returns 200 with path param page and feature flag enabled' do
stub_feature_flags(metrics_dashboard_new_panel_page: true)
it 'returns 200 with path param page' do
# send_request(page: 'panel/new') cannot be used because it encodes '/'
get "/#{project.namespace.to_param}/#{project.to_param}/-/metrics/panel/new"
get "#{dashboard_route}/panel/new"
expect(response).to have_gitlab_http_status(:ok)
end
it 'returns 404 with path param page and feature flag disabled' do
stub_feature_flags(metrics_dashboard_new_panel_page: false)
it 'returns 200 with dashboard and path param page' do
# send_request(page: 'panel/new') cannot be used because it encodes '/'
get "/#{project.namespace.to_param}/#{project.to_param}/-/metrics/panel/new"
get "#{dashboard_route(dashboard_path: 'dashboard.yml')}/panel/new"
expect(response).to have_gitlab_http_status(:not_found)
expect(response).to have_gitlab_http_status(:ok)
end
end
def send_request(params = {})
get namespace_project_metrics_dashboard_path(namespace_id: project.namespace, project_id: project, **params)
get dashboard_route(params)
end
def dashboard_route(params = {})
namespace_project_metrics_dashboard_path(namespace_id: project.namespace, project_id: project, **params)
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