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 { ...@@ -11,7 +11,6 @@ import {
GlTooltipDirective, GlTooltipDirective,
} from '@gitlab/ui'; } from '@gitlab/ui';
import CustomMetricsFormFields from '~/custom_metrics/components/custom_metrics_form_fields.vue'; 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 { PANEL_NEW_PAGE } from '../router/constants';
import DuplicateDashboardModal from './duplicate_dashboard_modal.vue'; import DuplicateDashboardModal from './duplicate_dashboard_modal.vue';
import CreateDashboardModal from './create_dashboard_modal.vue'; import CreateDashboardModal from './create_dashboard_modal.vue';
...@@ -38,7 +37,6 @@ export default { ...@@ -38,7 +37,6 @@ export default {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
TrackEvent: TrackEventDirective, TrackEvent: TrackEventDirective,
}, },
mixins: [glFeatureFlagsMixin()],
props: { props: {
addingMetricsAvailable: { addingMetricsAvailable: {
type: Boolean, type: Boolean,
...@@ -86,7 +84,6 @@ export default { ...@@ -86,7 +84,6 @@ export default {
}, },
isMenuItemShown() { isMenuItemShown() {
return { return {
addPanel: this.glFeatures.metricsDashboardNewPanelPage,
duplicateDashboard: this.isOutOfTheBoxDashboard, duplicateDashboard: this.isOutOfTheBoxDashboard,
}; };
}, },
...@@ -192,31 +189,29 @@ export default { ...@@ -192,31 +189,29 @@ export default {
</gl-modal> </gl-modal>
</template> </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 <gl-new-dropdown-item
v-if="isMenuItemEnabled.addPanel" :alt="$options.i18n.addPanelInfo"
data-testid="add-panel-item-enabled"
:to="newPanelPageLocation" :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> </gl-new-dropdown-item>
</div>
<!--
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>
<gl-new-dropdown-item <gl-new-dropdown-item
v-if="isMenuItemEnabled.editDashboard" v-if="isMenuItemEnabled.editDashboard"
...@@ -230,7 +225,7 @@ export default { ...@@ -230,7 +225,7 @@ export default {
<!-- <!--
wrapper for tooltip as button can be `disabled` wrapper for tooltip as button can be `disabled`
https://bootstrap-vue.org/docs/components/tooltip#disabled-elements https://bootstrap-vue.org/docs/components/tooltip#disabled-elements
--> -->
<div v-else v-gl-tooltip :title="$options.i18n.editDashboardInfo"> <div v-else v-gl-tooltip :title="$options.i18n.editDashboardInfo">
<gl-new-dropdown-item <gl-new-dropdown-item
:alt="$options.i18n.editDashboardInfo" :alt="$options.i18n.editDashboardInfo"
......
...@@ -14,7 +14,6 @@ class Projects::EnvironmentsController < Projects::ApplicationController ...@@ -14,7 +14,6 @@ class Projects::EnvironmentsController < Projects::ApplicationController
push_frontend_feature_flag(:prometheus_computed_alerts) push_frontend_feature_flag(:prometheus_computed_alerts)
push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate) push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate)
push_frontend_feature_flag(:metrics_dashboard_new_panel_page)
end end
before_action :authorize_read_environment!, except: [:metrics, :additional_metrics, :metrics_dashboard, :metrics_redirect] before_action :authorize_read_environment!, except: [:metrics, :additional_metrics, :metrics_dashboard, :metrics_redirect]
before_action :authorize_create_environment!, only: [:new, :create] before_action :authorize_create_environment!, only: [:new, :create]
......
...@@ -4,7 +4,6 @@ module Projects ...@@ -4,7 +4,6 @@ module Projects
module Metrics module Metrics
module Dashboards module Dashboards
class BuilderController < Projects::ApplicationController class BuilderController < Projects::ApplicationController
before_action :ensure_feature_flags
before_action :authorize_metrics_dashboard! before_action :authorize_metrics_dashboard!
def panel_preview def panel_preview
...@@ -21,10 +20,6 @@ module Projects ...@@ -21,10 +20,6 @@ module Projects
private private
def ensure_feature_flags
render_404 unless Feature.enabled?(:metrics_dashboard_new_panel_page, project)
end
def rendered_panel def rendered_panel
@panel_preview ||= ::Metrics::Dashboard::PanelPreviewService.new(project, panel_yaml, environment).execute @panel_preview ||= ::Metrics::Dashboard::PanelPreviewService.new(project, panel_yaml, environment).execute
end end
......
...@@ -10,14 +10,9 @@ module Projects ...@@ -10,14 +10,9 @@ module Projects
before_action do before_action do
push_frontend_feature_flag(:prometheus_computed_alerts) push_frontend_feature_flag(:prometheus_computed_alerts)
push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate) push_frontend_feature_flag(:disable_metric_dashboard_refresh_rate)
push_frontend_feature_flag(:metrics_dashboard_new_panel_page)
end end
def show def show
if params[:page].present? && !Feature.enabled?(:metrics_dashboard_new_panel_page, project)
return render_404
end
if environment if environment
render 'projects/environments/metrics' render 'projects/environments/metrics'
else 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', () => { ...@@ -42,9 +42,6 @@ describe('Actions menu', () => {
const createShallowWrapper = (props = {}, options = {}) => { const createShallowWrapper = (props = {}, options = {}) => {
wrapper = shallowMount(ActionsMenu, { wrapper = shallowMount(ActionsMenu, {
propsData: { ...dashboardActionsMenuProps, ...props }, propsData: { ...dashboardActionsMenuProps, ...props },
provide: {
glFeatures: { metricsDashboardNewPanelPage: true },
},
store, store,
...options, ...options,
}); });
......
...@@ -49,10 +49,6 @@ RSpec.describe 'Projects::Metrics::Dashboards::BuilderController' do ...@@ -49,10 +49,6 @@ RSpec.describe 'Projects::Metrics::Dashboards::BuilderController' do
describe 'POST /:namespace/:project/-/metrics/dashboards/builder' do describe 'POST /:namespace/:project/-/metrics/dashboards/builder' do
context 'as anonymous user' 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 it 'redirects user to sign in page' do
send_request send_request
...@@ -62,7 +58,6 @@ RSpec.describe 'Projects::Metrics::Dashboards::BuilderController' do ...@@ -62,7 +58,6 @@ RSpec.describe 'Projects::Metrics::Dashboards::BuilderController' do
context 'as user with guest access' do context 'as user with guest access' do
before do before do
stub_feature_flags(metrics_dashboard_new_panel_page: true)
project.add_guest(user) project.add_guest(user)
login_as(user) login_as(user)
end end
...@@ -80,48 +75,30 @@ RSpec.describe 'Projects::Metrics::Dashboards::BuilderController' do ...@@ -80,48 +75,30 @@ RSpec.describe 'Projects::Metrics::Dashboards::BuilderController' do
login_as(user) login_as(user)
end end
context 'metrics_dashboard_new_panel_page is enabled' do context 'valid yaml panel is supplied' do
before do it 'returns success' do
stub_feature_flags(metrics_dashboard_new_panel_page: true) send_request(panel_yaml: valid_panel_yml)
end
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(response).to have_gitlab_http_status(:ok)
expect(json_response).to include('title' => 'Super Chart A1', 'type' => 'area-chart') 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
end end
end
context 'invalid panel_yaml is not a yaml string' do context 'invalid yaml panel is supplied' do
it 'returns unprocessable entity' do it 'returns unprocessable entity' do
send_request(panel_yaml: 1) send_request(panel_yaml: invalid_panel_yml)
expect(response).to have_gitlab_http_status(:unprocessable_entity) expect(response).to have_gitlab_http_status(:unprocessable_entity)
expect(json_response['message']).to eq('Invalid configuration format') expect(json_response['message']).to eq('Each "panel" must define an array :metrics')
end
end end
end end
context 'metrics_dashboard_new_panel_page is disabled' do context 'invalid panel_yaml is not a yaml string' do
before do it 'returns unprocessable entity' do
stub_feature_flags(metrics_dashboard_new_panel_page: false) send_request(panel_yaml: 1)
end
it 'returns not found' do
send_request
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 end
end end
......
...@@ -96,26 +96,26 @@ RSpec.describe 'metrics dashboard page' do ...@@ -96,26 +96,26 @@ RSpec.describe 'metrics dashboard page' do
end end
describe 'GET :/namespace/:project/-/metrics/:page' do describe 'GET :/namespace/:project/-/metrics/:page' do
it 'returns 200 with path param page and feature flag enabled' do it 'returns 200 with path param page' do
stub_feature_flags(metrics_dashboard_new_panel_page: true)
# send_request(page: 'panel/new') cannot be used because it encodes '/' # 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) expect(response).to have_gitlab_http_status(:ok)
end end
it 'returns 404 with path param page and feature flag disabled' do it 'returns 200 with dashboard and path param page' do
stub_feature_flags(metrics_dashboard_new_panel_page: false)
# send_request(page: 'panel/new') cannot be used because it encodes '/' # 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
end end
def send_request(params = {}) 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
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