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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

46 lines
984 B
JavaScript
Raw Normal View History

2022-11-25 23:54:43 +05:30
import Vue from 'vue';
import FormUrlApp from './components/form_url_app.vue';
2023-04-23 21:23:45 +05:30
import TestDropdown from './components/test_dropdown.vue';
2022-11-25 23:54:43 +05:30
export default () => {
const el = document.querySelector('.js-vue-webhook-form');
if (!el) {
return null;
}
const { url: initialUrl, urlVariables } = el.dataset;
return new Vue({
el,
name: 'WebhookFormRoot',
render(createElement) {
return createElement(FormUrlApp, {
props: {
initialUrl,
2023-01-13 00:05:48 +05:30
initialUrlVariables: JSON.parse(urlVariables),
2022-11-25 23:54:43 +05:30
},
});
},
});
};
2023-04-23 21:23:45 +05:30
const initHookTestDropdown = (el) => {
const { items, size } = el.dataset;
return new Vue({
el,
render(h) {
return h(TestDropdown, {
props: {
items: JSON.parse(items),
size,
},
});
},
});
};
export const initHookTestDropdowns = (selector = '.js-webhook-test-dropdown') =>
document.querySelectorAll(selector).forEach(initHookTestDropdown);