Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-01-06 15:10:58 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-01-06 15:10:58 +0300
commitf2c27c6f97cf138acaed79b90be7a5be520746fc (patch)
tree369b09c536983f7b8682a8e66ebdac8fd6c54446 /app/assets/javascripts/alerts_settings
parentb3c8b65ec2ab3af29d4d14eac27837e0c4793939 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/alerts_settings')
-rw-r--r--app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue132
-rw-r--r--app/assets/javascripts/alerts_settings/components/alerts_settings_wrapper.vue37
-rw-r--r--app/assets/javascripts/alerts_settings/constants.js10
-rw-r--r--app/assets/javascripts/alerts_settings/index.js10
4 files changed, 10 insertions, 179 deletions
diff --git a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue
index c8742be9985..d183d95f359 100644
--- a/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue
+++ b/app/assets/javascripts/alerts_settings/components/alerts_settings_form.vue
@@ -18,14 +18,11 @@ import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import MappingBuilder from './alert_mapping_builder.vue';
import AlertSettingsFormHelpBlock from './alert_settings_form_help_block.vue';
import getCurrentIntegrationQuery from '../graphql/queries/get_current_integration.query.graphql';
-import service from '../services';
import {
- integrationTypesNew,
+ integrationTypes,
JSON_VALIDATE_DELAY,
targetPrometheusUrlPlaceholder,
- targetOpsgenieUrlPlaceholder,
typeSet,
- sectionHash,
} from '../constants';
// Mocks will be removed when integrating with BE is ready
// data format is defined and will be the same as mocked (maybe with some minor changes)
@@ -91,20 +88,13 @@ export const i18n = {
'AlertSettings|Resetting the authorization key for this project will require updating the authorization key in every alert source it is enabled in.',
),
},
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- opsgenie: {
- label: s__('AlertSettings|2. Add link to your Opsgenie alert list'),
- info: s__(
- 'AlertSettings|Utilizing this option will link the GitLab Alerts navigation item to your existing Opsgenie instance. By selecting this option, you cannot receive alerts from any other source in GitLab; it will effectively be turning Alerts within GitLab off as a feature.',
- ),
- },
},
};
export default {
+ integrationTypes,
placeholders: {
prometheus: targetPrometheusUrlPlaceholder,
- opsgenie: targetOpsgenieUrlPlaceholder,
},
JSON_VALIDATE_DELAY,
typeSet,
@@ -134,10 +124,6 @@ export default {
prometheus: {
default: {},
},
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- opsgenie: {
- default: {},
- },
},
mixins: [glFeatureFlagsMixin()],
props: {
@@ -149,12 +135,6 @@ export default {
type: Boolean,
required: true,
},
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- canManageOpsgenie: {
- type: Boolean,
- required: false,
- default: false,
- },
},
apollo: {
currentIntegration: {
@@ -163,7 +143,7 @@ export default {
},
data() {
return {
- selectedIntegration: integrationTypesNew[0].value,
+ selectedIntegration: integrationTypes[0].value,
active: false,
formVisible: false,
integrationTestPayload: {
@@ -174,8 +154,6 @@ export default {
customMapping: null,
parsingPayload: false,
currentIntegration: null,
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- isManagingOpsgenie: false,
};
},
computed: {
@@ -185,32 +163,12 @@ export default {
jsonIsValid() {
return this.integrationTestPayload.error === null;
},
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- disabledIntegrations() {
- const options = [];
- if (this.opsgenie.active) {
- options.push(typeSet.http, typeSet.prometheus);
- } else if (!this.canManageOpsgenie) {
- options.push(typeSet.opsgenie);
- }
-
- return options;
- },
- options() {
- return integrationTypesNew.map((el) => ({
- ...el,
- disabled: this.disabledIntegrations.includes(el.value),
- }));
- },
selectedIntegrationType() {
switch (this.selectedIntegration) {
case typeSet.http:
return this.generic;
case typeSet.prometheus:
return this.prometheus;
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- case typeSet.opsgenie:
- return this.opsgenie;
default:
return {};
}
@@ -285,49 +243,17 @@ export default {
},
methods: {
integrationTypeSelect() {
- if (this.selectedIntegration === integrationTypesNew[0].value) {
+ if (this.selectedIntegration === integrationTypes[0].value) {
this.formVisible = false;
} else {
this.formVisible = true;
}
-
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- if (this.canManageOpsgenie && this.selectedIntegration === typeSet.opsgenie) {
- this.isManagingOpsgenie = true;
- this.active = this.opsgenie.active;
- this.integrationForm.apiUrl = this.opsgenie.opsgenieMvcTargetUrl;
- } else {
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- this.isManagingOpsgenie = false;
- }
- },
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- submitWithOpsgenie() {
- return service
- .updateGenericActive({
- endpoint: this.opsgenie.formPath,
- params: {
- service: {
- opsgenie_mvc_target_url: this.integrationForm.apiUrl,
- opsgenie_mvc_enabled: this.active,
- },
- },
- })
- .then(() => {
- window.location.hash = sectionHash;
- window.location.reload();
- });
},
submitWithTestPayload() {
this.$emit('set-test-alert-payload', this.testAlertPayload);
this.submit();
},
submit() {
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- if (this.isManagingOpsgenie) {
- return this.submitWithOpsgenie();
- }
-
const { name, apiUrl } = this.integrationForm;
const variables =
this.selectedIntegration === typeSet.http
@@ -343,7 +269,7 @@ export default {
return this.$emit('create-new-integration', integrationPayload);
},
reset() {
- this.selectedIntegration = integrationTypesNew[0].value;
+ this.selectedIntegration = integrationTypes[0].value;
this.integrationTypeSelect();
if (this.currentIntegration) {
@@ -360,9 +286,6 @@ export default {
error: null,
};
this.active = false;
-
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- this.isManagingOpsgenie = false;
},
resetAuthKey() {
if (!this.currentIntegration) {
@@ -428,8 +351,8 @@ export default {
<gl-form-select
v-model="selectedIntegration"
:disabled="isSelectDisabled"
- :class="{ 'gl-bg-gray-100!': isSelectDisabled }"
- :options="options"
+ class="mw-100"
+ :options="$options.integrationTypes"
@change="integrationTypeSelect"
/>
@@ -441,37 +364,7 @@ export default {
</div>
</gl-form-group>
<gl-collapse v-model="formVisible" class="gl-mt-3">
- <!-- TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657 -->
- <div v-if="isManagingOpsgenie">
- <gl-form-group
- id="integration-webhook"
- :label="$options.i18n.integrationFormSteps.opsgenie.label"
- label-for="integration-webhook"
- >
- <span class="gl-my-4">
- {{ $options.i18n.integrationFormSteps.opsgenie.info }}
- </span>
-
- <gl-toggle
- v-model="active"
- :is-loading="loading"
- :label="__('Active')"
- class="gl-my-4 gl-font-weight-normal"
- />
-
- <gl-form-input
- id="opsgenie-opsgenieMvcTargetUrl"
- v-model="integrationForm.apiUrl"
- type="text"
- :placeholder="$options.placeholders.opsgenie"
- />
-
- <span class="gl-text-gray-400 gl-my-1">
- {{ $options.i18n.integrationFormSteps.prometheusFormUrl.help }}
- </span>
- </gl-form-group>
- </div>
- <div v-else>
+ <div>
<gl-form-group
id="name-integration"
:label="$options.i18n.integrationFormSteps.step2.label"
@@ -661,9 +554,7 @@ export default {
data-testid="integration-form-submit"
>{{ s__('AlertSettings|Save integration') }}
</gl-button>
- <!-- TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657 -->
<gl-button
- v-if="!isManagingOpsgenie"
data-testid="integration-test-and-submit"
:disabled="isSubmitTestPayloadDisabled"
category="secondary"
@@ -672,12 +563,7 @@ export default {
@click="submitWithTestPayload"
>{{ s__('AlertSettings|Save and test payload') }}</gl-button
>
- <gl-button
- type="reset"
- class="js-no-auto-disable"
- :class="{ 'gl-ml-3': isManagingOpsgenie }"
- >{{ __('Cancel') }}</gl-button
- >
+ <gl-button type="reset" class="js-no-auto-disable">{{ __('Cancel') }}</gl-button>
</div>
</gl-collapse>
</gl-form>
diff --git a/app/assets/javascripts/alerts_settings/components/alerts_settings_wrapper.vue b/app/assets/javascripts/alerts_settings/components/alerts_settings_wrapper.vue
index 002d09be22b..d0cac066ffa 100644
--- a/app/assets/javascripts/alerts_settings/components/alerts_settings_wrapper.vue
+++ b/app/assets/javascripts/alerts_settings/components/alerts_settings_wrapper.vue
@@ -1,5 +1,4 @@
<script>
-import { GlAlert, GlLink, GlSprintf } from '@gitlab/ui';
import { s__ } from '~/locale';
import { fetchPolicies } from '~/lib/graphql';
import createFlash, { FLASH_TYPES } from '~/flash';
@@ -41,10 +40,6 @@ export default {
),
},
components: {
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- GlAlert,
- GlLink,
- GlSprintf,
IntegrationsList,
AlertSettingsForm,
},
@@ -55,10 +50,6 @@ export default {
prometheus: {
default: {},
},
- // TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657
- opsgenie: {
- default: {},
- },
projectPath: {
default: '',
},
@@ -105,13 +96,6 @@ export default {
canAddIntegration() {
return this.multiIntegrations || this.integrations?.list?.length < 2;
},
- canManageOpsgenie() {
- return (
- this.opsgenie.active ||
- this.integrations?.list?.every(({ active }) => active === false) ||
- this.integrations?.list?.length === 0
- );
- },
},
methods: {
createNewIntegration({ type, variables }) {
@@ -319,27 +303,7 @@ export default {
<template>
<div>
- <!-- TODO: Will be removed in 13.7 as part of: https://gitlab.com/gitlab-org/gitlab/-/issues/273657 -->
- <gl-alert v-if="opsgenie.active" :dismissible="false" variant="tip">
- <gl-sprintf
- :message="
- s__(
- 'AlertSettings|We will soon be introducing the ability to create multiple unique HTTP endpoints. When this functionality is live, you will be able to configure an integration with Opsgenie to surface Opsgenie alerts in GitLab. This will replace the current Opsgenie integration which will be deprecated. %{linkStart}More Information%{linkEnd}',
- )
- "
- >
- <template #link="{ content }">
- <gl-link
- class="gl-display-inline-block"
- href="https://gitlab.com/gitlab-org/gitlab/-/issues/273657"
- target="_blank"
- >{{ content }}</gl-link
- >
- </template>
- </gl-sprintf>
- </gl-alert>
<integrations-list
- v-else
:integrations="integrations.list"
:loading="loading"
@edit-integration="editIntegration"
@@ -348,7 +312,6 @@ export default {
<alert-settings-form
:loading="isUpdating"
:can-add-integration="canAddIntegration"
- :can-manage-opsgenie="canManageOpsgenie"
@create-new-integration="createNewIntegration"
@update-integration="updateIntegration"
@reset-token="resetToken"
diff --git a/app/assets/javascripts/alerts_settings/constants.js b/app/assets/javascripts/alerts_settings/constants.js
index e30dc2ad553..ecd7c921b2f 100644
--- a/app/assets/javascripts/alerts_settings/constants.js
+++ b/app/assets/javascripts/alerts_settings/constants.js
@@ -40,22 +40,15 @@ export const i18n = {
integration: s__('AlertSettings|Integration'),
};
-// TODO: Delete as part of old form removal in 13.6
export const integrationTypes = [
+ { value: '', text: s__('AlertSettings|Select integration type') },
{ value: 'HTTP', text: s__('AlertSettings|HTTP Endpoint') },
{ value: 'PROMETHEUS', text: s__('AlertSettings|External Prometheus') },
- { value: 'OPSGENIE', text: s__('AlertSettings|Opsgenie') },
-];
-
-export const integrationTypesNew = [
- { value: '', text: s__('AlertSettings|Select integration type') },
- ...integrationTypes,
];
export const typeSet = {
http: 'HTTP',
prometheus: 'PROMETHEUS',
- opsgenie: 'OPSGENIE',
};
export const integrationToDeleteDefault = { id: null, name: '' };
@@ -63,7 +56,6 @@ export const integrationToDeleteDefault = { id: null, name: '' };
export const JSON_VALIDATE_DELAY = 250;
export const targetPrometheusUrlPlaceholder = 'http://prometheus.example.com/';
-export const targetOpsgenieUrlPlaceholder = 'https://app.opsgenie.com/alert/list/';
export const sectionHash = 'js-alert-management-settings';
diff --git a/app/assets/javascripts/alerts_settings/index.js b/app/assets/javascripts/alerts_settings/index.js
index 73d132ce335..cc939577717 100644
--- a/app/assets/javascripts/alerts_settings/index.js
+++ b/app/assets/javascripts/alerts_settings/index.js
@@ -29,10 +29,6 @@ export default (el) => {
formPath,
authorizationKey,
url,
- opsgenieMvcAvailable,
- opsgenieMvcFormPath,
- opsgenieMvcEnabled,
- opsgenieMvcTargetUrl,
projectPath,
multiIntegrations,
} = el.dataset;
@@ -56,12 +52,6 @@ export default (el) => {
token: authorizationKey,
url,
},
- opsgenie: {
- formPath: opsgenieMvcFormPath,
- active: parseBoolean(opsgenieMvcEnabled),
- opsgenieMvcTargetUrl,
- opsgenieMvcIsAvailable: parseBoolean(opsgenieMvcAvailable),
- },
projectPath,
multiIntegrations: parseBoolean(multiIntegrations),
},