2020-11-16 21:09:02 +00:00
|
|
|
import { GlToast } from '@gitlab/ui';
|
2021-02-14 18:09:20 +00:00
|
|
|
import Vue from 'vue';
|
2020-07-02 21:09:14 +00:00
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
2020-10-29 00:08:36 +00:00
|
|
|
import AlertSettingsWrapper from './components/alerts_settings_wrapper.vue';
|
2020-11-12 15:09:09 +00:00
|
|
|
import apolloProvider from './graphql';
|
2020-07-02 21:09:14 +00:00
|
|
|
|
2020-11-12 15:09:09 +00:00
|
|
|
apolloProvider.clients.defaultClient.cache.writeData({
|
|
|
|
data: {
|
|
|
|
currentIntegration: null,
|
|
|
|
},
|
|
|
|
});
|
2020-11-16 21:09:02 +00:00
|
|
|
Vue.use(GlToast);
|
2020-10-29 18:09:11 +00:00
|
|
|
|
2020-12-23 21:10:24 +00:00
|
|
|
export default (el) => {
|
2020-07-02 21:09:14 +00:00
|
|
|
if (!el) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
const {
|
|
|
|
prometheusActivated,
|
|
|
|
prometheusUrl,
|
|
|
|
prometheusAuthorizationKey,
|
|
|
|
prometheusFormPath,
|
|
|
|
prometheusResetKeyPath,
|
|
|
|
prometheusApiUrl,
|
|
|
|
activated: activatedStr,
|
|
|
|
alertsSetupUrl,
|
|
|
|
alertsUsageUrl,
|
|
|
|
formPath,
|
|
|
|
authorizationKey,
|
|
|
|
url,
|
2020-10-29 18:09:11 +00:00
|
|
|
projectPath,
|
2020-11-09 12:09:24 +00:00
|
|
|
multiIntegrations,
|
2021-02-04 21:09:06 +00:00
|
|
|
alertFields,
|
2020-07-02 21:09:14 +00:00
|
|
|
} = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2021-01-11 21:10:36 +00:00
|
|
|
components: {
|
|
|
|
AlertSettingsWrapper,
|
|
|
|
},
|
2020-08-19 12:10:17 +00:00
|
|
|
provide: {
|
|
|
|
prometheus: {
|
2020-11-04 12:09:14 +00:00
|
|
|
active: parseBoolean(prometheusActivated),
|
|
|
|
url: prometheusUrl,
|
2020-11-05 18:08:48 +00:00
|
|
|
token: prometheusAuthorizationKey,
|
2020-08-19 12:10:17 +00:00
|
|
|
prometheusFormPath,
|
|
|
|
prometheusResetKeyPath,
|
|
|
|
prometheusApiUrl,
|
|
|
|
},
|
|
|
|
generic: {
|
|
|
|
alertsSetupUrl,
|
|
|
|
alertsUsageUrl,
|
2020-11-04 12:09:14 +00:00
|
|
|
active: parseBoolean(activatedStr),
|
2020-08-19 12:10:17 +00:00
|
|
|
formPath,
|
2020-11-05 18:08:48 +00:00
|
|
|
token: authorizationKey,
|
2020-08-19 12:10:17 +00:00
|
|
|
url,
|
|
|
|
},
|
2020-10-29 18:09:11 +00:00
|
|
|
projectPath,
|
2020-11-09 12:09:24 +00:00
|
|
|
multiIntegrations: parseBoolean(multiIntegrations),
|
2020-08-19 12:10:17 +00:00
|
|
|
},
|
2020-10-29 18:09:11 +00:00
|
|
|
apolloProvider,
|
2020-07-02 21:09:14 +00:00
|
|
|
render(createElement) {
|
2021-02-04 21:09:06 +00:00
|
|
|
return createElement('alert-settings-wrapper', {
|
|
|
|
props: {
|
|
|
|
alertFields:
|
|
|
|
gon.features?.multipleHttpIntegrationsCustomMapping && parseBoolean(multiIntegrations)
|
|
|
|
? JSON.parse(alertFields)
|
|
|
|
: null,
|
|
|
|
},
|
|
|
|
});
|
2020-07-02 21:09:14 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|