2020-07-13 09:09:29 +00:00
|
|
|
import Vue from 'vue';
|
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
|
|
|
import SettingsTabs from './components/incidents_settings_tabs.vue';
|
2020-07-16 15:09:38 +00:00
|
|
|
import IncidentsSettingsService from './incidents_settings_service';
|
2020-07-13 09:09:29 +00:00
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const el = document.querySelector('.js-incidents-settings');
|
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const {
|
2020-07-16 15:09:38 +00:00
|
|
|
dataset: {
|
|
|
|
operationsSettingsEndpoint,
|
|
|
|
templates,
|
|
|
|
createIssue,
|
|
|
|
issueTemplateKey,
|
|
|
|
sendEmail,
|
|
|
|
pagerdutyActive,
|
|
|
|
pagerdutyWebhookUrl,
|
|
|
|
pagerdutyResetKeyPath,
|
2020-08-21 15:10:03 +00:00
|
|
|
autoCloseIncident,
|
2020-10-13 06:09:09 +00:00
|
|
|
slaActive,
|
|
|
|
slaMinutes,
|
|
|
|
slaFeatureAvailable,
|
2020-07-16 15:09:38 +00:00
|
|
|
},
|
2020-07-13 09:09:29 +00:00
|
|
|
} = el;
|
|
|
|
|
2020-07-16 15:09:38 +00:00
|
|
|
const service = new IncidentsSettingsService(operationsSettingsEndpoint, pagerdutyResetKeyPath);
|
2020-07-13 09:09:29 +00:00
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
provide: {
|
2020-07-16 15:09:38 +00:00
|
|
|
service,
|
2020-07-13 09:09:29 +00:00
|
|
|
alertSettings: {
|
|
|
|
templates: JSON.parse(templates),
|
|
|
|
createIssue: parseBoolean(createIssue),
|
|
|
|
issueTemplateKey,
|
|
|
|
sendEmail: parseBoolean(sendEmail),
|
2020-08-21 15:10:03 +00:00
|
|
|
autoCloseIncident: parseBoolean(autoCloseIncident),
|
2020-07-13 09:09:29 +00:00
|
|
|
},
|
2020-07-16 15:09:38 +00:00
|
|
|
pagerDutySettings: {
|
|
|
|
active: parseBoolean(pagerdutyActive),
|
|
|
|
webhookUrl: pagerdutyWebhookUrl,
|
|
|
|
},
|
2020-10-13 06:09:09 +00:00
|
|
|
serviceLevelAgreementSettings: {
|
|
|
|
active: parseBoolean(slaActive),
|
|
|
|
minutes: slaMinutes,
|
|
|
|
available: parseBoolean(slaFeatureAvailable),
|
|
|
|
},
|
2020-07-13 09:09:29 +00:00
|
|
|
},
|
|
|
|
render(createElement) {
|
|
|
|
return createElement(SettingsTabs);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|