debian-mirror-gitlab/app/assets/javascripts/groups/settings/init_access_dropdown.js

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

37 lines
767 B
JavaScript
Raw Normal View History

2022-07-23 23:45:48 +05:30
import * as Sentry from '@sentry/browser';
import Vue from 'vue';
import AccessDropdown from './components/access_dropdown.vue';
export const initAccessDropdown = (el) => {
if (!el) {
return false;
}
const { label, disabled, preselectedItems } = el.dataset;
let preselected = [];
try {
preselected = JSON.parse(preselectedItems);
} catch (e) {
Sentry.captureException(e);
}
return new Vue({
el,
render(createElement) {
const vm = this;
return createElement(AccessDropdown, {
props: {
preselectedItems: preselected,
label,
disabled,
},
on: {
select(selected) {
vm.$emit('select', selected);
},
},
});
},
});
};