Commit 88b6c833 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch '231413-remove-feature-flag' into 'master'

Remove feature flag metrics_dashboard_new_panel_page

See merge request gitlab-org/gitlab!39124
parents 1eee55f8 56cd0fac
......@@ -11,7 +11,6 @@ import {
GlTooltipDirective,
} from '@gitlab/ui';
import CustomMetricsFormFields from '~/custom_metrics/components/custom_metrics_form_fields.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { PANEL_NEW_PAGE } from '../router/constants';
import DuplicateDashboardModal from './duplicate_dashboard_modal.vue';
import CreateDashboardModal from './create_dashboard_modal.vue';
......@@ -38,7 +37,6 @@ export default {
GlTooltip: GlTooltipDirective,
TrackEvent: TrackEventDirective,
},
mixins: [glFeatureFlagsMixin()],
props: {
addingMetricsAvailable: {
type: Boolean,
......@@ -86,7 +84,6 @@ export default {
},
isMenuItemShown() {
return {
addPanel: this.glFeatures.metricsDashboardNewPanelPage,
duplicateDashboard: this.isOutOfTheBoxDashboard,
};
},
......@@ -192,31 +189,29 @@ export default {
</gl-modal>
</template>
<template v-if="isMenuItemShown.addPanel">
<gl-new-dropdown-item
v-if="isMenuItemEnabled.addPanel"
data-testid="add-panel-item-enabled"
:to="newPanelPageLocation"
>
{{ $options.i18n.addPanel }}
</gl-new-dropdown-item>
<!--
wrapper for tooltip as button can be `disabled`
https://bootstrap-vue.org/docs/components/tooltip#disabled-elements
-->
<div v-else v-gl-tooltip :title="$options.i18n.addPanelInfo">
<gl-new-dropdown-item
v-if="isMenuItemEnabled.addPanel"
data-testid="add-panel-item-enabled"
:alt="$options.i18n.addPanelInfo"
:to="newPanelPageLocation"
data-testid="add-panel-item-disabled"
disabled
class="gl-cursor-not-allowed"
>
{{ $options.i18n.addPanel }}
<span class="gl-text-gray-400">{{ $options.i18n.addPanel }}</span>
</gl-new-dropdown-item>
<!--
wrapper for tooltip as button can be `disabled`
https://bootstrap-vue.org/docs/components/tooltip#disabled-elements
-->
<div v-else v-gl-tooltip :title="$options.i18n.addPanelInfo">
<gl-new-dropdown-item
:alt="$options.i18n.addPanelInfo"
:to="newPanelPageLocation"
data-testid="add-panel-item-disabled"
disabled
class="gl-cursor-not-allowed"
>
<span class="gl-text-gray-400">{{ $options.i18n.addPanel }}</span>
</gl-new-dropdown-item>
</div>
</template>
</div>
<gl-new-dropdown-item
v-if="isMenuItemEnabled.editDashboard"
......@@ -230,7 +225,7 @@ export default {
<!--
wrapper for tooltip as button can be `disabled`
https://bootstrap-vue.org/docs/components/tooltip#disabled-elements
-->
-->
<div v-else v-gl-tooltip :title="$options.i18n.editDashboardInfo">
<gl-new-dropdown-item
:alt="$options.i18n.editDashboardInfo"
......
......@@ -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
......@@ -42,9 +42,6 @@ describe('Actions menu', () => {
const createShallowWrapper = (props = {}, options = {}) => {
wrapper = shallowMount(ActionsMenu, {
propsData: { ...dashboardActionsMenuProps, ...props },
provide: {
glFeatures: { metricsDashboardNewPanelPage: true },
},
store,
...options,
});
......
......@@ -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