Commit 8785e309 authored by Tristan Read's avatar Tristan Read Committed by Ezekiel Kigbo

Add `alert_runbooks` feature flag

parent 3d5d66b0
...@@ -294,6 +294,14 @@ export default { ...@@ -294,6 +294,14 @@ export default {
data-qa-selector="alert_threshold_field" data-qa-selector="alert_threshold_field"
/> />
</gl-form-group> </gl-form-group>
<gl-form-group
v-if="glFeatures.alertRunbooks"
:label="s__('PrometheusAlerts|Runbook')"
label-for="alert-runbook"
data-testid="alertRunbookField"
>
<gl-form-input id="alert-runbook" :disabled="formDisabled" type="text" />
</gl-form-group>
</div> </div>
<template #modal-ok> <template #modal-ok>
<gl-link <gl-link
......
...@@ -10,6 +10,7 @@ module Projects ...@@ -10,6 +10,7 @@ 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(:alert_runbooks)
end end
def show def show
......
...@@ -18991,6 +18991,9 @@ msgstr "" ...@@ -18991,6 +18991,9 @@ msgstr ""
msgid "PrometheusAlerts|Operator" msgid "PrometheusAlerts|Operator"
msgstr "" msgstr ""
msgid "PrometheusAlerts|Runbook"
msgstr ""
msgid "PrometheusAlerts|Select query" msgid "PrometheusAlerts|Select query"
msgstr "" msgstr ""
......
...@@ -29,7 +29,7 @@ describe('AlertWidgetForm', () => { ...@@ -29,7 +29,7 @@ describe('AlertWidgetForm', () => {
configuredAlert: metricId, configuredAlert: metricId,
}; };
function createComponent(props = {}) { function createComponent(props = {}, featureFlags = {}) {
const propsData = { const propsData = {
...defaultProps, ...defaultProps,
...props, ...props,
...@@ -37,6 +37,9 @@ describe('AlertWidgetForm', () => { ...@@ -37,6 +37,9 @@ describe('AlertWidgetForm', () => {
wrapper = shallowMount(AlertWidgetForm, { wrapper = shallowMount(AlertWidgetForm, {
propsData, propsData,
provide: {
glFeatures: featureFlags,
},
stubs: { stubs: {
GlModal: ModalStub, GlModal: ModalStub,
}, },
...@@ -46,6 +49,7 @@ describe('AlertWidgetForm', () => { ...@@ -46,6 +49,7 @@ describe('AlertWidgetForm', () => {
const modal = () => wrapper.find(ModalStub); const modal = () => wrapper.find(ModalStub);
const modalTitle = () => modal().attributes('title'); const modalTitle = () => modal().attributes('title');
const submitButton = () => modal().find(GlLink); const submitButton = () => modal().find(GlLink);
const alertRunbookField = () => wrapper.find('[data-testid="alertRunbookField"]');
const submitButtonTrackingOpts = () => const submitButtonTrackingOpts = () =>
JSON.parse(submitButton().attributes('data-tracking-options')); JSON.parse(submitButton().attributes('data-tracking-options'));
const e = { const e = {
...@@ -217,4 +221,18 @@ describe('AlertWidgetForm', () => { ...@@ -217,4 +221,18 @@ describe('AlertWidgetForm', () => {
}); });
}); });
}); });
describe('alert runbooks feature flag', () => {
it('hides the runbook field when the flag is disabled', () => {
createComponent(undefined, { alertRunbooks: false });
expect(alertRunbookField().exists()).toBe(false);
});
it('shows the runbook field when the flag is enabled', () => {
createComponent(undefined, { alertRunbooks: true });
expect(alertRunbookField().exists()).toBe(true);
});
});
}); });
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