Commit b3471aea authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab master

parents 21e5b701 b0d463e1
...@@ -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
......
...@@ -6,6 +6,5 @@ ...@@ -6,6 +6,5 @@
- else - else
%link{ { rel: 'preload', href: stylesheet_url('application'), as: 'style' }, ActionController::Base.asset_host ? { crossorigin: 'anonymous' } : {} } %link{ { rel: 'preload', href: stylesheet_url('application'), as: 'style' }, ActionController::Base.asset_host ? { crossorigin: 'anonymous' } : {} }
%link{ { rel: 'preload', href: stylesheet_url("highlight/themes/#{user_color_scheme}"), as: 'style' }, ActionController::Base.asset_host ? { crossorigin: 'anonymous' } : {} } %link{ { rel: 'preload', href: stylesheet_url("highlight/themes/#{user_color_scheme}"), as: 'style' }, ActionController::Base.asset_host ? { crossorigin: 'anonymous' } : {} }
%link{ { rel: 'preload', href: asset_url("fontawesome-webfont.woff2?v=4.7.0"), as: 'font', type: 'font/woff2' }, ActionController::Base.asset_host ? { crossorigin: 'anonymous' } : {} }
- if Gitlab::CurrentSettings.snowplow_enabled? && Gitlab::CurrentSettings.snowplow_collector_hostname - if Gitlab::CurrentSettings.snowplow_enabled? && Gitlab::CurrentSettings.snowplow_collector_hostname
%link{ rel: 'preconnect', href: Gitlab::CurrentSettings.snowplow_collector_hostname, crossorigin: '' } %link{ rel: 'preconnect', href: Gitlab::CurrentSettings.snowplow_collector_hostname, crossorigin: '' }
---
title: Add primary key to elasticsearch_indexed_projects
merge_request: 48919
author:
type: changed
---
title: Prometheus integration name should not have a modifiable input field
merge_request: 48437
author:
type: fixed
# frozen_string_literal: true
class AddPrimaryKeyToElasticSearchIndexedProjects < ActiveRecord::Migration[6.0]
DOWNTIME = false
UNIQUE_INDEX_NAME = 'index_elasticsearch_indexed_projects_on_project_id'
PRIMARY_KEY_NAME = 'elasticsearch_indexed_projects_pkey'
def up
execute(<<~SQL)
DELETE FROM elasticsearch_indexed_projects
WHERE project_id IS NULL
SQL
execute(<<~SQL)
ALTER TABLE elasticsearch_indexed_projects
ALTER COLUMN project_id SET NOT NULL,
ADD CONSTRAINT #{PRIMARY_KEY_NAME} PRIMARY KEY USING INDEX #{UNIQUE_INDEX_NAME}
SQL
end
def down
add_index :elasticsearch_indexed_projects, :project_id, unique: true, name: UNIQUE_INDEX_NAME # rubocop:disable Migration/AddIndex
execute(<<~SQL)
ALTER TABLE elasticsearch_indexed_projects
DROP CONSTRAINT #{PRIMARY_KEY_NAME},
ALTER COLUMN project_id DROP NOT NULL
SQL
end
end
d9ad12dce02d6823536f3206e9c90a0da82c08089c3ce252e8ef28a59589e747
\ No newline at end of file
...@@ -11935,7 +11935,7 @@ CREATE TABLE elasticsearch_indexed_namespaces ( ...@@ -11935,7 +11935,7 @@ CREATE TABLE elasticsearch_indexed_namespaces (
CREATE TABLE elasticsearch_indexed_projects ( CREATE TABLE elasticsearch_indexed_projects (
created_at timestamp with time zone NOT NULL, created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL,
project_id integer project_id integer NOT NULL
); );
CREATE TABLE emails ( CREATE TABLE emails (
...@@ -19255,6 +19255,9 @@ ALTER TABLE ONLY draft_notes ...@@ -19255,6 +19255,9 @@ ALTER TABLE ONLY draft_notes
ALTER TABLE ONLY elastic_reindexing_tasks ALTER TABLE ONLY elastic_reindexing_tasks
ADD CONSTRAINT elastic_reindexing_tasks_pkey PRIMARY KEY (id); ADD CONSTRAINT elastic_reindexing_tasks_pkey PRIMARY KEY (id);
ALTER TABLE ONLY elasticsearch_indexed_projects
ADD CONSTRAINT elasticsearch_indexed_projects_pkey PRIMARY KEY (project_id);
ALTER TABLE ONLY emails ALTER TABLE ONLY emails
ADD CONSTRAINT emails_pkey PRIMARY KEY (id); ADD CONSTRAINT emails_pkey PRIMARY KEY (id);
...@@ -21056,8 +21059,6 @@ CREATE INDEX index_elasticsearch_indexed_namespaces_on_created_at ON elasticsear ...@@ -21056,8 +21059,6 @@ CREATE INDEX index_elasticsearch_indexed_namespaces_on_created_at ON elasticsear
CREATE UNIQUE INDEX index_elasticsearch_indexed_namespaces_on_namespace_id ON elasticsearch_indexed_namespaces USING btree (namespace_id); CREATE UNIQUE INDEX index_elasticsearch_indexed_namespaces_on_namespace_id ON elasticsearch_indexed_namespaces USING btree (namespace_id);
CREATE UNIQUE INDEX index_elasticsearch_indexed_projects_on_project_id ON elasticsearch_indexed_projects USING btree (project_id);
CREATE UNIQUE INDEX index_emails_on_confirmation_token ON emails USING btree (confirmation_token); CREATE UNIQUE INDEX index_emails_on_confirmation_token ON emails USING btree (confirmation_token);
CREATE UNIQUE INDEX index_emails_on_email ON emails USING btree (email); CREATE UNIQUE INDEX index_emails_on_email ON emails USING btree (email);
......
...@@ -13,10 +13,6 @@ ...@@ -13,10 +13,6 @@
= sprite_icon('spinner', size: 24, css_class: 'gl-spinner') = sprite_icon('spinner', size: 24, css_class: 'gl-spinner')
- if can_update_approvers - if can_update_approvers
- approver_presenter = MergeRequestApproverPresenter.new(issuable, skip_user: current_user) - approver_presenter = MergeRequestApproverPresenter.new(issuable, skip_user: current_user)
.form-text.text-muted.suggested-approvers
- if approver_presenter.any?
Suggested approvers:
= approver_presenter.render
- if approver_presenter.show_code_owner_tips? - if approver_presenter.show_code_owner_tips?
.form-text.text-muted .form-text.text-muted
= _('Tip: add a') = _('Tip: add a')
......
...@@ -22,27 +22,12 @@ RSpec.describe 'shared/issuable/_approvals.html.haml' do ...@@ -22,27 +22,12 @@ RSpec.describe 'shared/issuable/_approvals.html.haml' do
end end
context 'has no approvers' do context 'has no approvers' do
context 'when mr_collapsed_approval_rules feature flag is off' do
before do
stub_feature_flags(mr_collapsed_approval_rules: false)
render 'shared/issuable/approvals', form: form, issuable: merge_request, presenter: presenter
end
it 'shows suggested approvers' do
expect(rendered).to have_css('.suggested-approvers')
end
end
context 'can not override approvers' do context 'can not override approvers' do
before do before do
allow(view).to receive(:can?).with(user, :update_approvers, merge_request).and_return(false) allow(view).to receive(:can?).with(user, :update_approvers, merge_request).and_return(false)
render 'shared/issuable/approvals', form: form, issuable: merge_request, presenter: presenter render 'shared/issuable/approvals', form: form, issuable: merge_request, presenter: presenter
end end
it 'hides suggested approvers' do
expect(rendered).not_to have_css('.suggested-approvers')
end
it 'hides select approvers field' do it 'hides select approvers field' do
expect(rendered).not_to have_css('#merge_request_approver_ids') expect(rendered).not_to have_css('#merge_request_approver_ids')
end end
......
...@@ -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();
......
...@@ -861,10 +861,10 @@ ...@@ -861,10 +861,10 @@
eslint-plugin-vue "^6.2.1" eslint-plugin-vue "^6.2.1"
vue-eslint-parser "^7.0.0" vue-eslint-parser "^7.0.0"
"@gitlab/svgs@1.175.0": "@gitlab/svgs@1.176.0":
version "1.175.0" version "1.176.0"
resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.175.0.tgz#734f341784af1cd1d62d160a17bcdfb61ff7b04d" resolved "https://registry.yarnpkg.com/@gitlab/svgs/-/svgs-1.176.0.tgz#3b6d415704ed36db87146cfa361f3f9e2c01f535"
integrity sha512-gXpc87TGSXIzfAr4QER1Qw1v3P47pBO6BXkma52blgwXVmcFNe3nhQzqsqt66wKNzrIrk3lAcB4GUyPHbPVXpg== integrity sha512-cl3SlGmLF/bnPAxrg52eRQOxRSrU54AB3yfV9TLi2iNAg/Jws0nuvdVZ4LRKKyyzHmT6yfVusCIGCISzvON6ew==
"@gitlab/ui@24.4.0": "@gitlab/ui@24.4.0":
version "24.4.0" version "24.4.0"
......
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