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

44 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-01-29 00:20:46 +05:30
import { GlToast } from '@gitlab/ui';
2021-03-11 19:13:27 +05:30
import Vue from 'vue';
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';
2021-04-29 21:17:54 +05:30
import getCurrentIntegrationQuery from './graphql/queries/get_current_integration.query.graphql';
2021-01-29 00:20:46 +05:30
2021-04-29 21:17:54 +05:30
apolloProvider.clients.defaultClient.cache.writeQuery({
query: getCurrentIntegrationQuery,
2021-01-29 00:20:46 +05:30
data: {
currentIntegration: null,
},
});
2021-04-29 21:17:54 +05:30
2021-01-29 00:20:46 +05:30
Vue.use(GlToast);
2020-07-28 23:09:34 +05:30
2021-03-08 18:12:59 +05:30
export default (el) => {
2020-07-28 23:09:34 +05:30
if (!el) {
return null;
}
2021-04-29 21:17:54 +05:30
const { alertsUsageUrl, projectPath, multiIntegrations, alertFields } = el.dataset;
2020-07-28 23:09:34 +05:30
return new Vue({
el,
2021-03-08 18:12:59 +05:30
components: {
AlertSettingsWrapper,
},
2020-10-24 23:57:45 +05:30
provide: {
2021-04-29 21:17:54 +05:30
alertsUsageUrl,
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-07-28 23:09:34 +05:30
render(createElement) {
2021-03-11 19:13:27 +05:30
return createElement('alert-settings-wrapper', {
props: {
2021-04-17 20:07:23 +05:30
alertFields: parseBoolean(multiIntegrations) ? JSON.parse(alertFields) : null,
2021-03-11 19:13:27 +05:30
},
});
2020-07-28 23:09:34 +05:30
},
});
};