2020-07-28 23:09:34 +05:30
|
|
|
<script>
|
|
|
|
import {
|
|
|
|
GlAlert,
|
|
|
|
GlButton,
|
|
|
|
GlForm,
|
|
|
|
GlFormGroup,
|
|
|
|
GlFormInput,
|
|
|
|
GlFormInputGroup,
|
|
|
|
GlFormTextarea,
|
|
|
|
GlLink,
|
|
|
|
GlModal,
|
|
|
|
GlModalDirective,
|
|
|
|
GlSprintf,
|
|
|
|
GlFormSelect,
|
|
|
|
} from '@gitlab/ui';
|
|
|
|
import { debounce } from 'lodash';
|
2021-01-03 14:25:43 +05:30
|
|
|
import { doesHashExistInUrl } from '~/lib/utils/url_utility';
|
2020-07-28 23:09:34 +05:30
|
|
|
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
|
|
|
|
import ToggleButton from '~/vue_shared/components/toggle_button.vue';
|
|
|
|
import csrf from '~/lib/utils/csrf';
|
|
|
|
import service from '../services';
|
|
|
|
import {
|
|
|
|
i18n,
|
2021-01-29 00:20:46 +05:30
|
|
|
integrationTypes,
|
2020-07-28 23:09:34 +05:30
|
|
|
JSON_VALIDATE_DELAY,
|
|
|
|
targetPrometheusUrlPlaceholder,
|
|
|
|
targetOpsgenieUrlPlaceholder,
|
2021-01-03 14:25:43 +05:30
|
|
|
sectionHash,
|
2020-07-28 23:09:34 +05:30
|
|
|
} from '../constants';
|
2021-01-03 14:25:43 +05:30
|
|
|
import createFlash, { FLASH_TYPES } from '~/flash';
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
export default {
|
|
|
|
i18n,
|
|
|
|
csrf,
|
|
|
|
targetOpsgenieUrlPlaceholder,
|
|
|
|
targetPrometheusUrlPlaceholder,
|
|
|
|
components: {
|
|
|
|
GlAlert,
|
|
|
|
GlButton,
|
|
|
|
GlForm,
|
|
|
|
GlFormGroup,
|
|
|
|
GlFormInput,
|
|
|
|
GlFormInputGroup,
|
|
|
|
GlFormSelect,
|
|
|
|
GlFormTextarea,
|
|
|
|
GlLink,
|
|
|
|
GlModal,
|
|
|
|
GlSprintf,
|
|
|
|
ClipboardButton,
|
|
|
|
ToggleButton,
|
|
|
|
},
|
|
|
|
directives: {
|
|
|
|
'gl-modal': GlModalDirective,
|
|
|
|
},
|
2020-10-24 23:57:45 +05:30
|
|
|
inject: ['prometheus', 'generic', 'opsgenie'],
|
2020-07-28 23:09:34 +05:30
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
loading: false,
|
2021-01-29 00:20:46 +05:30
|
|
|
selectedIntegration: integrationTypes[0].value,
|
|
|
|
options: integrationTypes,
|
2020-10-24 23:57:45 +05:30
|
|
|
active: false,
|
2021-01-29 00:20:46 +05:30
|
|
|
token: '',
|
2020-10-24 23:57:45 +05:30
|
|
|
targetUrl: '',
|
2020-07-28 23:09:34 +05:30
|
|
|
feedback: {
|
|
|
|
variant: 'danger',
|
2020-10-24 23:57:45 +05:30
|
|
|
feedbackMessage: '',
|
2020-07-28 23:09:34 +05:30
|
|
|
isFeedbackDismissed: false,
|
|
|
|
},
|
|
|
|
testAlert: {
|
|
|
|
json: null,
|
|
|
|
error: null,
|
|
|
|
},
|
|
|
|
canSaveForm: false,
|
2020-10-24 23:57:45 +05:30
|
|
|
serverError: null,
|
2020-07-28 23:09:34 +05:30
|
|
|
};
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
sections() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
text: this.$options.i18n.usageSection,
|
|
|
|
url: this.generic.alertsUsageUrl,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
text: this.$options.i18n.setupSection,
|
|
|
|
url: this.generic.alertsSetupUrl,
|
|
|
|
},
|
|
|
|
];
|
|
|
|
},
|
|
|
|
isPrometheus() {
|
2021-01-29 00:20:46 +05:30
|
|
|
return this.selectedIntegration === 'PROMETHEUS';
|
2020-07-28 23:09:34 +05:30
|
|
|
},
|
|
|
|
isOpsgenie() {
|
2021-01-29 00:20:46 +05:30
|
|
|
return this.selectedIntegration === 'OPSGENIE';
|
2020-07-28 23:09:34 +05:30
|
|
|
},
|
2021-01-29 00:20:46 +05:30
|
|
|
selectedIntegrationType() {
|
|
|
|
switch (this.selectedIntegration) {
|
|
|
|
case 'HTTP': {
|
2020-07-28 23:09:34 +05:30
|
|
|
return {
|
|
|
|
url: this.generic.url,
|
2021-01-29 00:20:46 +05:30
|
|
|
token: this.generic.token,
|
|
|
|
active: this.generic.active,
|
2020-10-24 23:57:45 +05:30
|
|
|
resetKey: this.resetKey.bind(this),
|
2020-07-28 23:09:34 +05:30
|
|
|
};
|
|
|
|
}
|
2021-01-29 00:20:46 +05:30
|
|
|
case 'PROMETHEUS': {
|
2020-07-28 23:09:34 +05:30
|
|
|
return {
|
2021-01-29 00:20:46 +05:30
|
|
|
url: this.prometheus.url,
|
|
|
|
token: this.prometheus.token,
|
|
|
|
active: this.prometheus.active,
|
|
|
|
resetKey: this.resetKey.bind(this, 'PROMETHEUS'),
|
2020-07-28 23:09:34 +05:30
|
|
|
targetUrl: this.prometheus.prometheusApiUrl,
|
|
|
|
};
|
|
|
|
}
|
2021-01-29 00:20:46 +05:30
|
|
|
case 'OPSGENIE': {
|
2020-07-28 23:09:34 +05:30
|
|
|
return {
|
|
|
|
targetUrl: this.opsgenie.opsgenieMvcTargetUrl,
|
2021-01-29 00:20:46 +05:30
|
|
|
active: this.opsgenie.active,
|
2020-07-28 23:09:34 +05:30
|
|
|
};
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
showFeedbackMsg() {
|
|
|
|
return this.feedback.feedbackMessage && !this.isFeedbackDismissed;
|
|
|
|
},
|
|
|
|
showAlertSave() {
|
|
|
|
return (
|
|
|
|
this.feedback.feedbackMessage === this.$options.i18n.testAlertFailed &&
|
|
|
|
!this.isFeedbackDismissed
|
|
|
|
);
|
|
|
|
},
|
|
|
|
prometheusInfo() {
|
|
|
|
return this.isPrometheus ? this.$options.i18n.prometheusInfo : '';
|
|
|
|
},
|
|
|
|
jsonIsValid() {
|
|
|
|
return this.testAlert.error === null;
|
|
|
|
},
|
|
|
|
canTestAlert() {
|
2020-10-24 23:57:45 +05:30
|
|
|
return this.active && this.testAlert.json !== null;
|
2020-07-28 23:09:34 +05:30
|
|
|
},
|
|
|
|
canSaveConfig() {
|
|
|
|
return !this.loading && this.canSaveForm;
|
|
|
|
},
|
|
|
|
baseUrlPlaceholder() {
|
|
|
|
return this.isOpsgenie
|
|
|
|
? this.$options.targetOpsgenieUrlPlaceholder
|
|
|
|
: this.$options.targetPrometheusUrlPlaceholder;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
watch: {
|
|
|
|
'testAlert.json': debounce(function debouncedJsonValidate() {
|
|
|
|
this.validateJson();
|
|
|
|
}, JSON_VALIDATE_DELAY),
|
|
|
|
targetUrl(oldVal, newVal) {
|
2021-01-29 00:20:46 +05:30
|
|
|
if (newVal && oldVal !== this.selectedIntegrationType.targetUrl) {
|
2020-07-28 23:09:34 +05:30
|
|
|
this.canSaveForm = true;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
mounted() {
|
2021-01-29 00:20:46 +05:30
|
|
|
if (this.prometheus.active || this.generic.active || !this.opsgenie.opsgenieMvcIsAvailable) {
|
2020-07-28 23:09:34 +05:30
|
|
|
this.removeOpsGenieOption();
|
2021-01-29 00:20:46 +05:30
|
|
|
} else if (this.opsgenie.active) {
|
2020-07-28 23:09:34 +05:30
|
|
|
this.setOpsgenieAsDefault();
|
|
|
|
}
|
2021-01-29 00:20:46 +05:30
|
|
|
this.active = this.selectedIntegrationType.active;
|
|
|
|
this.token = this.selectedIntegrationType.token ?? '';
|
2020-07-28 23:09:34 +05:30
|
|
|
},
|
|
|
|
methods: {
|
2021-01-03 14:25:43 +05:30
|
|
|
createUserErrorMessage(errors = {}) {
|
|
|
|
const error = Object.entries(errors)?.[0];
|
|
|
|
if (error) {
|
|
|
|
const [field, [msg]] = error;
|
|
|
|
this.serverError = `${field} ${msg}`;
|
|
|
|
}
|
2020-07-28 23:09:34 +05:30
|
|
|
},
|
|
|
|
setOpsgenieAsDefault() {
|
|
|
|
this.options = this.options.map(el => {
|
2021-01-29 00:20:46 +05:30
|
|
|
if (el.value !== 'OPSGENIE') {
|
2020-07-28 23:09:34 +05:30
|
|
|
return { ...el, disabled: true };
|
|
|
|
}
|
|
|
|
return { ...el, disabled: false };
|
|
|
|
});
|
2021-01-29 00:20:46 +05:30
|
|
|
this.selectedIntegration = this.options.find(({ value }) => value === 'OPSGENIE').value;
|
2020-07-28 23:09:34 +05:30
|
|
|
if (this.targetUrl === null) {
|
2021-01-29 00:20:46 +05:30
|
|
|
this.targetUrl = this.selectedIntegrationType.targetUrl;
|
2020-07-28 23:09:34 +05:30
|
|
|
}
|
|
|
|
},
|
|
|
|
removeOpsGenieOption() {
|
|
|
|
this.options = this.options.map(el => {
|
2021-01-29 00:20:46 +05:30
|
|
|
if (el.value !== 'OPSGENIE') {
|
2020-07-28 23:09:34 +05:30
|
|
|
return { ...el, disabled: false };
|
|
|
|
}
|
|
|
|
return { ...el, disabled: true };
|
|
|
|
});
|
|
|
|
},
|
|
|
|
resetFormValues() {
|
|
|
|
this.testAlert.json = null;
|
2021-01-29 00:20:46 +05:30
|
|
|
this.targetUrl = this.selectedIntegrationType.targetUrl;
|
|
|
|
this.active = this.selectedIntegrationType.active;
|
2020-07-28 23:09:34 +05:30
|
|
|
},
|
|
|
|
dismissFeedback() {
|
|
|
|
this.serverError = null;
|
|
|
|
this.feedback = { ...this.feedback, feedbackMessage: null };
|
|
|
|
this.isFeedbackDismissed = false;
|
|
|
|
},
|
2020-10-24 23:57:45 +05:30
|
|
|
resetKey(key) {
|
2021-01-29 00:20:46 +05:30
|
|
|
const fn = key === 'PROMETHEUS' ? this.resetPrometheusKey() : this.resetGenericKey();
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
return fn
|
2020-07-28 23:09:34 +05:30
|
|
|
.then(({ data: { token } }) => {
|
2021-01-29 00:20:46 +05:30
|
|
|
this.token = token;
|
|
|
|
this.setFeedback({ feedbackMessage: this.$options.i18n.tokenRest, variant: 'success' });
|
2020-07-28 23:09:34 +05:30
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
this.setFeedback({ feedbackMessage: this.$options.i18n.errorKeyMsg, variant: 'danger' });
|
|
|
|
});
|
|
|
|
},
|
2020-10-24 23:57:45 +05:30
|
|
|
resetGenericKey() {
|
|
|
|
this.dismissFeedback();
|
|
|
|
return service.updateGenericKey({
|
|
|
|
endpoint: this.generic.formPath,
|
|
|
|
params: { service: { token: '' } },
|
|
|
|
});
|
|
|
|
},
|
2020-07-28 23:09:34 +05:30
|
|
|
resetPrometheusKey() {
|
2020-10-24 23:57:45 +05:30
|
|
|
return service.updatePrometheusKey({ endpoint: this.prometheus.prometheusResetKeyPath });
|
2020-07-28 23:09:34 +05:30
|
|
|
},
|
|
|
|
toggleService(value) {
|
|
|
|
this.canSaveForm = true;
|
2020-10-24 23:57:45 +05:30
|
|
|
this.active = value;
|
2020-07-28 23:09:34 +05:30
|
|
|
},
|
|
|
|
toggle(value) {
|
|
|
|
return this.isPrometheus ? this.togglePrometheusActive(value) : this.toggleActivated(value);
|
|
|
|
},
|
|
|
|
toggleActivated(value) {
|
|
|
|
this.loading = true;
|
2021-01-29 00:20:46 +05:30
|
|
|
const path = this.isOpsgenie ? this.opsgenie.formPath : this.generic.formPath;
|
2020-07-28 23:09:34 +05:30
|
|
|
return service
|
|
|
|
.updateGenericActive({
|
2021-01-29 00:20:46 +05:30
|
|
|
endpoint: path,
|
2020-07-28 23:09:34 +05:30
|
|
|
params: this.isOpsgenie
|
|
|
|
? { service: { opsgenie_mvc_target_url: this.targetUrl, opsgenie_mvc_enabled: value } }
|
|
|
|
: { service: { active: value } },
|
|
|
|
})
|
2021-01-03 14:25:43 +05:30
|
|
|
.then(() => this.notifySuccessAndReload())
|
2020-07-28 23:09:34 +05:30
|
|
|
.catch(({ response: { data: { errors } = {} } = {} }) => {
|
|
|
|
this.createUserErrorMessage(errors);
|
|
|
|
this.setFeedback({
|
2021-01-03 14:25:43 +05:30
|
|
|
feedbackMessage: this.$options.i18n.errorMsg,
|
2020-07-28 23:09:34 +05:30
|
|
|
variant: 'danger',
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
this.loading = false;
|
|
|
|
this.canSaveForm = false;
|
|
|
|
});
|
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
reload() {
|
|
|
|
if (!doesHashExistInUrl(sectionHash)) {
|
|
|
|
window.location.hash = sectionHash;
|
|
|
|
}
|
|
|
|
window.location.reload();
|
|
|
|
},
|
2020-07-28 23:09:34 +05:30
|
|
|
togglePrometheusActive(value) {
|
|
|
|
this.loading = true;
|
|
|
|
return service
|
|
|
|
.updatePrometheusActive({
|
|
|
|
endpoint: this.prometheus.prometheusFormPath,
|
|
|
|
params: {
|
|
|
|
token: this.$options.csrf.token,
|
|
|
|
config: value,
|
|
|
|
url: this.targetUrl,
|
|
|
|
redirect: window.location,
|
|
|
|
},
|
|
|
|
})
|
2021-01-03 14:25:43 +05:30
|
|
|
.then(() => this.notifySuccessAndReload())
|
2020-07-28 23:09:34 +05:30
|
|
|
.catch(({ response: { data: { errors } = {} } = {} }) => {
|
|
|
|
this.createUserErrorMessage(errors);
|
|
|
|
this.setFeedback({
|
2021-01-03 14:25:43 +05:30
|
|
|
feedbackMessage: this.$options.i18n.errorMsg,
|
2020-07-28 23:09:34 +05:30
|
|
|
variant: 'danger',
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
this.loading = false;
|
|
|
|
this.canSaveForm = false;
|
|
|
|
});
|
|
|
|
},
|
2021-01-03 14:25:43 +05:30
|
|
|
notifySuccessAndReload() {
|
|
|
|
createFlash({ message: this.$options.i18n.changesSaved, type: FLASH_TYPES.NOTICE });
|
|
|
|
setTimeout(() => this.reload(), 1000);
|
2020-07-28 23:09:34 +05:30
|
|
|
},
|
|
|
|
setFeedback({ feedbackMessage, variant }) {
|
|
|
|
this.feedback = { feedbackMessage, variant };
|
|
|
|
},
|
|
|
|
validateJson() {
|
|
|
|
this.testAlert.error = null;
|
|
|
|
try {
|
|
|
|
JSON.parse(this.testAlert.json);
|
|
|
|
} catch (e) {
|
|
|
|
this.testAlert.error = JSON.stringify(e.message);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
validateTestAlert() {
|
|
|
|
this.loading = true;
|
2020-10-24 23:57:45 +05:30
|
|
|
this.dismissFeedback();
|
2020-07-28 23:09:34 +05:30
|
|
|
this.validateJson();
|
|
|
|
return service
|
|
|
|
.updateTestAlert({
|
2021-01-29 00:20:46 +05:30
|
|
|
endpoint: this.selectedIntegrationType.url,
|
2020-07-28 23:09:34 +05:30
|
|
|
data: this.testAlert.json,
|
2021-01-29 00:20:46 +05:30
|
|
|
token: this.selectedIntegrationType.token,
|
2020-07-28 23:09:34 +05:30
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
this.setFeedback({
|
|
|
|
feedbackMessage: this.$options.i18n.testAlertSuccess,
|
|
|
|
variant: 'success',
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
this.setFeedback({
|
|
|
|
feedbackMessage: this.$options.i18n.testAlertFailed,
|
|
|
|
variant: 'danger',
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
this.loading = false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onSubmit() {
|
2020-10-24 23:57:45 +05:30
|
|
|
this.dismissFeedback();
|
|
|
|
this.toggle(this.active);
|
2020-07-28 23:09:34 +05:30
|
|
|
},
|
|
|
|
onReset() {
|
|
|
|
this.testAlert.json = null;
|
|
|
|
this.dismissFeedback();
|
2021-01-29 00:20:46 +05:30
|
|
|
this.targetUrl = this.selectedIntegrationType.targetUrl;
|
2020-07-28 23:09:34 +05:30
|
|
|
|
|
|
|
if (this.canSaveForm) {
|
|
|
|
this.canSaveForm = false;
|
2021-01-29 00:20:46 +05:30
|
|
|
this.active = this.selectedIntegrationType.active;
|
2020-07-28 23:09:34 +05:30
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
2021-01-29 00:20:46 +05:30
|
|
|
<gl-form @submit.prevent="onSubmit" @reset.prevent="onReset">
|
|
|
|
<h5 class="gl-font-lg gl-my-5">{{ $options.i18n.integrationsLabel }}</h5>
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
<gl-alert v-if="showFeedbackMsg" :variant="feedback.variant" @dismiss="dismissFeedback">
|
|
|
|
{{ feedback.feedbackMessage }}
|
|
|
|
<br />
|
|
|
|
<i v-if="serverError">{{ __('Error message:') }} {{ serverError }}</i>
|
|
|
|
<gl-button
|
|
|
|
v-if="showAlertSave"
|
|
|
|
variant="danger"
|
|
|
|
category="primary"
|
|
|
|
class="gl-display-block gl-mt-3"
|
|
|
|
@click="toggle(active)"
|
|
|
|
>
|
|
|
|
{{ __('Save anyway') }}
|
|
|
|
</gl-button>
|
|
|
|
</gl-alert>
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
<div data-testid="alert-settings-description">
|
|
|
|
<p v-for="section in sections" :key="section.text">
|
|
|
|
<gl-sprintf :message="section.text">
|
|
|
|
<template #link="{ content }">
|
|
|
|
<gl-link :href="section.url" target="_blank">{{ content }}</gl-link>
|
|
|
|
</template>
|
|
|
|
</gl-sprintf>
|
|
|
|
</p>
|
|
|
|
</div>
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
<gl-form-group label-for="integration-type" :label="$options.i18n.integration">
|
|
|
|
<gl-form-select
|
|
|
|
id="integration-type"
|
|
|
|
v-model="selectedIntegration"
|
|
|
|
:options="options"
|
|
|
|
data-testid="alert-settings-select"
|
|
|
|
@change="resetFormValues"
|
|
|
|
/>
|
|
|
|
<span class="gl-text-gray-500">
|
|
|
|
<gl-sprintf :message="$options.i18n.integrationsInfo">
|
|
|
|
<template #link="{ content }">
|
|
|
|
<gl-link
|
|
|
|
class="gl-display-inline-block"
|
|
|
|
href="https://gitlab.com/groups/gitlab-org/-/epics/4390"
|
|
|
|
target="_blank"
|
|
|
|
>{{ content }}</gl-link
|
|
|
|
>
|
|
|
|
</template>
|
|
|
|
</gl-sprintf>
|
|
|
|
</span>
|
|
|
|
</gl-form-group>
|
|
|
|
<gl-form-group :label="$options.i18n.activeLabel" label-for="active">
|
|
|
|
<toggle-button
|
|
|
|
id="active"
|
|
|
|
:disabled-input="loading"
|
|
|
|
:is-loading="loading"
|
|
|
|
:value="active"
|
|
|
|
@change="toggleService"
|
|
|
|
/>
|
|
|
|
</gl-form-group>
|
|
|
|
<gl-form-group
|
|
|
|
v-if="isOpsgenie || isPrometheus"
|
|
|
|
:label="$options.i18n.apiBaseUrlLabel"
|
|
|
|
label-for="api-url"
|
|
|
|
>
|
|
|
|
<gl-form-input
|
|
|
|
id="api-url"
|
|
|
|
v-model="targetUrl"
|
|
|
|
type="url"
|
|
|
|
:placeholder="baseUrlPlaceholder"
|
|
|
|
:disabled="!active"
|
|
|
|
/>
|
|
|
|
<span class="gl-text-gray-500">
|
|
|
|
{{ $options.i18n.apiBaseUrlHelpText }}
|
|
|
|
</span>
|
|
|
|
</gl-form-group>
|
|
|
|
<template v-if="!isOpsgenie">
|
|
|
|
<gl-form-group :label="$options.i18n.urlLabel" label-for="url">
|
|
|
|
<gl-form-input-group id="url" readonly :value="selectedIntegrationType.url">
|
|
|
|
<template #append>
|
|
|
|
<clipboard-button
|
|
|
|
:text="selectedIntegrationType.url"
|
|
|
|
:title="$options.i18n.copyToClipboard"
|
|
|
|
class="gl-m-0!"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</gl-form-input-group>
|
2021-01-03 14:25:43 +05:30
|
|
|
<span class="gl-text-gray-500">
|
2021-01-29 00:20:46 +05:30
|
|
|
{{ prometheusInfo }}
|
2020-07-28 23:09:34 +05:30
|
|
|
</span>
|
|
|
|
</gl-form-group>
|
2021-01-29 00:20:46 +05:30
|
|
|
<gl-form-group :label="$options.i18n.tokenLabel" label-for="authorization-key">
|
|
|
|
<gl-form-input-group id="authorization-key" class="gl-mb-2" readonly :value="token">
|
|
|
|
<template #append>
|
|
|
|
<clipboard-button
|
|
|
|
:text="token"
|
|
|
|
:title="$options.i18n.copyToClipboard"
|
|
|
|
class="gl-m-0!"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</gl-form-input-group>
|
|
|
|
<gl-button v-gl-modal.tokenModal :disabled="!active" class="gl-mt-3">{{
|
|
|
|
$options.i18n.resetKey
|
|
|
|
}}</gl-button>
|
|
|
|
<gl-modal
|
|
|
|
modal-id="tokenModal"
|
|
|
|
:title="$options.i18n.resetKey"
|
|
|
|
:ok-title="$options.i18n.resetKey"
|
|
|
|
ok-variant="danger"
|
|
|
|
@ok="selectedIntegrationType.resetKey"
|
|
|
|
>
|
|
|
|
{{ $options.i18n.restKeyInfo }}
|
|
|
|
</gl-modal>
|
2020-07-28 23:09:34 +05:30
|
|
|
</gl-form-group>
|
|
|
|
<gl-form-group
|
2021-01-29 00:20:46 +05:30
|
|
|
:label="$options.i18n.alertJson"
|
|
|
|
label-for="alert-json"
|
|
|
|
:invalid-feedback="testAlert.error"
|
2020-07-28 23:09:34 +05:30
|
|
|
>
|
2021-01-29 00:20:46 +05:30
|
|
|
<gl-form-textarea
|
|
|
|
id="alert-json"
|
|
|
|
v-model.trim="testAlert.json"
|
2020-10-24 23:57:45 +05:30
|
|
|
:disabled="!active"
|
2021-01-29 00:20:46 +05:30
|
|
|
:state="jsonIsValid"
|
|
|
|
:placeholder="$options.i18n.alertJsonPlaceholder"
|
|
|
|
rows="6"
|
|
|
|
max-rows="10"
|
2020-07-28 23:09:34 +05:30
|
|
|
/>
|
|
|
|
</gl-form-group>
|
2021-01-29 00:20:46 +05:30
|
|
|
|
|
|
|
<gl-button :disabled="!canTestAlert" @click="validateTestAlert">{{
|
|
|
|
$options.i18n.testAlertInfo
|
|
|
|
}}</gl-button>
|
|
|
|
</template>
|
|
|
|
<div class="footer-block row-content-block gl-display-flex gl-justify-content-space-between">
|
|
|
|
<gl-button variant="success" category="primary" :disabled="!canSaveConfig" @click="onSubmit">
|
|
|
|
{{ __('Save changes') }}
|
|
|
|
</gl-button>
|
|
|
|
<gl-button category="primary" :disabled="!canSaveConfig" @click="onReset">
|
|
|
|
{{ __('Cancel') }}
|
|
|
|
</gl-button>
|
|
|
|
</div>
|
|
|
|
</gl-form>
|
2020-07-28 23:09:34 +05:30
|
|
|
</template>
|