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';
|
2021-03-23 21:08:58 +00:00
|
|
|
import getCurrentIntegrationQuery from './graphql/queries/get_current_integration.query.graphql';
|
2020-07-02 21:09:14 +00:00
|
|
|
|
2021-03-23 21:08:58 +00:00
|
|
|
apolloProvider.clients.defaultClient.cache.writeQuery({
|
|
|
|
query: getCurrentIntegrationQuery,
|
2020-11-12 15:09:09 +00:00
|
|
|
data: {
|
|
|
|
currentIntegration: null,
|
|
|
|
},
|
|
|
|
});
|
2021-03-23 21:08:58 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-03-25 21:09:13 +00:00
|
|
|
const { alertsUsageUrl, projectPath, multiIntegrations, alertFields } = el.dataset;
|
2020-07-02 21:09:14 +00:00
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2021-01-11 21:10:36 +00:00
|
|
|
components: {
|
|
|
|
AlertSettingsWrapper,
|
|
|
|
},
|
2020-08-19 12:10:17 +00:00
|
|
|
provide: {
|
2021-03-25 21:09:13 +00:00
|
|
|
alertsUsageUrl,
|
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: {
|
2021-03-11 15:09:10 +00:00
|
|
|
alertFields: parseBoolean(multiIntegrations) ? JSON.parse(alertFields) : null,
|
2021-02-04 21:09:06 +00:00
|
|
|
},
|
|
|
|
});
|
2020-07-02 21:09:14 +00:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|