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