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

77 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-07-28 23:09:34 +05:30
import Vue from 'vue';
2021-01-29 00:20:46 +05:30
import { GlToast } from '@gitlab/ui';
2020-07-28 23:09:34 +05:30
import { parseBoolean } from '~/lib/utils/common_utils';
2021-01-29 00:20:46 +05:30
import AlertSettingsWrapper from './components/alerts_settings_wrapper.vue';
import apolloProvider from './graphql';
apolloProvider.clients.defaultClient.cache.writeData({
data: {
currentIntegration: null,
},
});
Vue.use(GlToast);
2020-07-28 23:09:34 +05:30
export default el => {
if (!el) {
return null;
}
const {
prometheusActivated,
prometheusUrl,
prometheusAuthorizationKey,
prometheusFormPath,
prometheusResetKeyPath,
prometheusApiUrl,
activated: activatedStr,
alertsSetupUrl,
alertsUsageUrl,
formPath,
authorizationKey,
url,
opsgenieMvcAvailable,
opsgenieMvcFormPath,
opsgenieMvcEnabled,
opsgenieMvcTargetUrl,
2021-01-29 00:20:46 +05:30
projectPath,
multiIntegrations,
2020-07-28 23:09:34 +05:30
} = el.dataset;
return new Vue({
el,
2020-10-24 23:57:45 +05:30
provide: {
prometheus: {
2021-01-29 00:20:46 +05:30
active: parseBoolean(prometheusActivated),
url: prometheusUrl,
token: prometheusAuthorizationKey,
2020-10-24 23:57:45 +05:30
prometheusFormPath,
prometheusResetKeyPath,
prometheusApiUrl,
},
generic: {
alertsSetupUrl,
alertsUsageUrl,
2021-01-29 00:20:46 +05:30
active: parseBoolean(activatedStr),
2020-10-24 23:57:45 +05:30
formPath,
2021-01-29 00:20:46 +05:30
token: authorizationKey,
2020-10-24 23:57:45 +05:30
url,
},
opsgenie: {
formPath: opsgenieMvcFormPath,
2021-01-29 00:20:46 +05:30
active: parseBoolean(opsgenieMvcEnabled),
2020-10-24 23:57:45 +05:30
opsgenieMvcTargetUrl,
2021-01-29 00:20:46 +05:30
opsgenieMvcIsAvailable: parseBoolean(opsgenieMvcAvailable),
2020-10-24 23:57:45 +05:30
},
2021-01-29 00:20:46 +05:30
projectPath,
multiIntegrations: parseBoolean(multiIntegrations),
2020-10-24 23:57:45 +05:30
},
2021-01-29 00:20:46 +05:30
apolloProvider,
2020-10-24 23:57:45 +05:30
components: {
2021-01-29 00:20:46 +05:30
AlertSettingsWrapper,
2020-10-24 23:57:45 +05:30
},
2020-07-28 23:09:34 +05:30
render(createElement) {
2021-01-29 00:20:46 +05:30
return createElement('alert-settings-wrapper');
2020-07-28 23:09:34 +05:30
},
});
};