debian-mirror-gitlab/app/assets/javascripts/incidents_settings/index.js

57 lines
1.4 KiB
JavaScript
Raw Normal View History

2020-07-28 23:09:34 +05:30
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import SettingsTabs from './components/incidents_settings_tabs.vue';
import IncidentsSettingsService from './incidents_settings_service';
export default () => {
const el = document.querySelector('.js-incidents-settings');
if (!el) {
return null;
}
const {
dataset: {
operationsSettingsEndpoint,
templates,
createIssue,
issueTemplateKey,
sendEmail,
pagerdutyActive,
pagerdutyWebhookUrl,
pagerdutyResetKeyPath,
2020-11-24 15:15:51 +05:30
autoCloseIncident,
2021-01-03 14:25:43 +05:30
slaActive,
slaMinutes,
slaFeatureAvailable,
2020-07-28 23:09:34 +05:30
},
} = el;
const service = new IncidentsSettingsService(operationsSettingsEndpoint, pagerdutyResetKeyPath);
return new Vue({
el,
provide: {
service,
alertSettings: {
templates: JSON.parse(templates),
createIssue: parseBoolean(createIssue),
issueTemplateKey,
sendEmail: parseBoolean(sendEmail),
2020-11-24 15:15:51 +05:30
autoCloseIncident: parseBoolean(autoCloseIncident),
2020-07-28 23:09:34 +05:30
},
pagerDutySettings: {
active: parseBoolean(pagerdutyActive),
webhookUrl: pagerdutyWebhookUrl,
},
2021-01-03 14:25:43 +05:30
serviceLevelAgreementSettings: {
active: parseBoolean(slaActive),
minutes: slaMinutes,
available: parseBoolean(slaFeatureAvailable),
},
2020-07-28 23:09:34 +05:30
},
render(createElement) {
return createElement(SettingsTabs);
},
});
};