Commit bd84aa57 authored by David O'Regan's avatar David O'Regan Committed by Olena Horal-Koretska

Prometheus integration name should not have a modifiable input field

parent 51e5f433
...@@ -32,14 +32,7 @@ import { ...@@ -32,14 +32,7 @@ import {
// feature rollout plan - https://gitlab.com/gitlab-org/gitlab/-/issues/262707#note_442529171 // feature rollout plan - https://gitlab.com/gitlab-org/gitlab/-/issues/262707#note_442529171
import mockedCustomMapping from './mocks/parsedMapping.json'; import mockedCustomMapping from './mocks/parsedMapping.json';
export default { export const i18n = {
placeholders: {
prometheus: targetPrometheusUrlPlaceholder,
opsgenie: targetOpsgenieUrlPlaceholder,
},
JSON_VALIDATE_DELAY,
typeSet,
i18n: {
integrationFormSteps: { integrationFormSteps: {
step1: { step1: {
label: s__('AlertSettings|1. Select integration type'), label: s__('AlertSettings|1. Select integration type'),
...@@ -50,6 +43,7 @@ export default { ...@@ -50,6 +43,7 @@ export default {
step2: { step2: {
label: s__('AlertSettings|2. Name integration'), label: s__('AlertSettings|2. Name integration'),
placeholder: s__('AlertSettings|Enter integration name'), placeholder: s__('AlertSettings|Enter integration name'),
prometheus: s__('AlertSettings|Prometheus'),
}, },
step3: { step3: {
label: s__('AlertSettings|3. Set up webhook'), label: s__('AlertSettings|3. Set up webhook'),
...@@ -105,7 +99,16 @@ export default { ...@@ -105,7 +99,16 @@ export default {
), ),
}, },
}, },
};
export default {
placeholders: {
prometheus: targetPrometheusUrlPlaceholder,
opsgenie: targetOpsgenieUrlPlaceholder,
}, },
JSON_VALIDATE_DELAY,
typeSet,
i18n,
components: { components: {
ClipboardButton, ClipboardButton,
GlButton, GlButton,
...@@ -265,6 +268,9 @@ export default { ...@@ -265,6 +268,9 @@ export default {
this.integrationTestPayload.json === '' this.integrationTestPayload.json === ''
); );
}, },
isSelectDisabled() {
return this.currentIntegration !== null || !this.canAddIntegration;
},
}, },
watch: { watch: {
currentIntegration(val) { currentIntegration(val) {
...@@ -421,7 +427,8 @@ export default { ...@@ -421,7 +427,8 @@ export default {
> >
<gl-form-select <gl-form-select
v-model="selectedIntegration" v-model="selectedIntegration"
:disabled="currentIntegration !== null || !canAddIntegration" :disabled="isSelectDisabled"
:class="{ 'gl-bg-gray-100!': isSelectDisabled }"
:options="options" :options="options"
@change="integrationTypeSelect" @change="integrationTypeSelect"
/> />
...@@ -472,8 +479,13 @@ export default { ...@@ -472,8 +479,13 @@ export default {
> >
<gl-form-input <gl-form-input
v-model="integrationForm.name" v-model="integrationForm.name"
:disabled="isPrometheus"
type="text" type="text"
:placeholder="$options.i18n.integrationFormSteps.step2.placeholder" :placeholder="
isPrometheus
? $options.i18n.integrationFormSteps.step2.prometheus
: $options.i18n.integrationFormSteps.step2.placeholder
"
/> />
</gl-form-group> </gl-form-group>
<gl-form-group <gl-form-group
......
---
title: Prometheus integration name should not have a modifiable input field
merge_request: 48437
author:
type: fixed
...@@ -2619,6 +2619,9 @@ msgstr "" ...@@ -2619,6 +2619,9 @@ msgstr ""
msgid "AlertSettings|Proceed with editing" msgid "AlertSettings|Proceed with editing"
msgstr "" msgstr ""
msgid "AlertSettings|Prometheus"
msgstr ""
msgid "AlertSettings|Prometheus API base URL" msgid "AlertSettings|Prometheus API base URL"
msgstr "" msgstr ""
......
...@@ -93,16 +93,28 @@ describe('AlertsSettingsFormNew', () => { ...@@ -93,16 +93,28 @@ describe('AlertsSettingsFormNew', () => {
).toBe(true); ).toBe(true);
}); });
it('disabled the dropdown and shows help text when multi integrations are not supported', async () => { it('disables the dropdown and shows help text when multi integrations are not supported', async () => {
createComponent({ props: { canAddIntegration: false } }); createComponent({ props: { canAddIntegration: false } });
expect(findSelect().attributes('disabled')).toBe('disabled'); expect(findSelect().attributes('disabled')).toBe('disabled');
expect(findMultiSupportText().exists()).toBe(true); expect(findMultiSupportText().exists()).toBe(true);
}); });
it('disabled the name input when the selected value is prometheus', async () => {
createComponent();
const options = findSelect().findAll('option');
await options.at(2).setSelected();
expect(
findFormFields()
.at(0)
.attributes('disabled'),
).toBe('disabled');
});
}); });
describe('submitting integration form', () => { describe('submitting integration form', () => {
it('allows for create-new-integration with the correct form values for HTTP', async () => { it('allows for create-new-integration with the correct form values for HTTP', async () => {
createComponent({}); createComponent();
const options = findSelect().findAll('option'); const options = findSelect().findAll('option');
await options.at(1).setSelected(); await options.at(1).setSelected();
...@@ -128,7 +140,7 @@ describe('AlertsSettingsFormNew', () => { ...@@ -128,7 +140,7 @@ describe('AlertsSettingsFormNew', () => {
}); });
it('allows for create-new-integration with the correct form values for PROMETHEUS', async () => { it('allows for create-new-integration with the correct form values for PROMETHEUS', async () => {
createComponent({}); createComponent();
const options = findSelect().findAll('option'); const options = findSelect().findAll('option');
await options.at(2).setSelected(); await options.at(2).setSelected();
......
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