2021-01-29 16:09:34 -05:00
|
|
|
import { GlToast } from '@gitlab/ui';
|
2021-02-14 13:09:20 -05:00
|
|
|
import Vue from 'vue';
|
2021-01-29 16:09:34 -05:00
|
|
|
import { parseBoolean } from '~/lib/utils/common_utils';
|
|
|
|
import NotificationsDropdown from './components/notifications_dropdown.vue';
|
|
|
|
|
|
|
|
Vue.use(GlToast);
|
|
|
|
|
|
|
|
export default () => {
|
2021-02-03 10:09:24 -05:00
|
|
|
const containers = document.querySelectorAll('.js-vue-notification-dropdown');
|
2021-01-29 16:09:34 -05:00
|
|
|
|
2021-02-03 10:09:24 -05:00
|
|
|
if (!containers.length) return false;
|
2021-01-29 16:09:34 -05:00
|
|
|
|
2021-02-03 10:09:24 -05:00
|
|
|
return containers.forEach((el) => {
|
|
|
|
const {
|
2021-01-29 16:09:34 -05:00
|
|
|
containerClass,
|
|
|
|
buttonSize,
|
2021-02-03 10:09:24 -05:00
|
|
|
disabled,
|
|
|
|
dropdownItems,
|
|
|
|
notificationLevel,
|
2021-02-05 10:09:28 -05:00
|
|
|
helpPagePath,
|
2021-01-29 16:09:34 -05:00
|
|
|
projectId,
|
|
|
|
groupId,
|
2021-02-03 10:09:24 -05:00
|
|
|
showLabel,
|
|
|
|
} = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
|
|
|
provide: {
|
|
|
|
containerClass,
|
|
|
|
buttonSize,
|
|
|
|
disabled: parseBoolean(disabled),
|
|
|
|
dropdownItems: JSON.parse(dropdownItems),
|
|
|
|
initialNotificationLevel: notificationLevel,
|
2021-02-05 10:09:28 -05:00
|
|
|
helpPagePath,
|
2021-02-03 10:09:24 -05:00
|
|
|
projectId,
|
|
|
|
groupId,
|
|
|
|
showLabel: parseBoolean(showLabel),
|
|
|
|
},
|
|
|
|
render(h) {
|
|
|
|
return h(NotificationsDropdown);
|
|
|
|
},
|
|
|
|
});
|
2021-01-29 16:09:34 -05:00
|
|
|
});
|
|
|
|
};
|