debian-mirror-gitlab/app/assets/javascripts/super_sidebar/super_sidebar_bundle.js

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

46 lines
1 KiB
JavaScript
Raw Normal View History

2023-03-17 16:20:25 +05:30
import Vue from 'vue';
2023-05-27 22:25:52 +05:30
import VueApollo from 'vue-apollo';
import createDefaultClient from '~/lib/graphql';
import { initStatusTriggers } from '../header';
import {
bindSuperSidebarCollapsedEvents,
initSuperSidebarCollapsedState,
} from './super_sidebar_collapsed_state_manager';
2023-03-17 16:20:25 +05:30
import SuperSidebar from './components/super_sidebar.vue';
2023-05-27 22:25:52 +05:30
Vue.use(VueApollo);
const apolloProvider = new VueApollo({
defaultClient: createDefaultClient(),
});
2023-03-17 16:20:25 +05:30
export const initSuperSidebar = () => {
const el = document.querySelector('.js-super-sidebar');
if (!el) return false;
2023-05-27 22:25:52 +05:30
bindSuperSidebarCollapsedEvents();
initSuperSidebarCollapsedState();
2023-03-17 16:20:25 +05:30
const { rootPath, sidebar, toggleNewNavEndpoint } = el.dataset;
return new Vue({
el,
name: 'SuperSidebarRoot',
2023-05-27 22:25:52 +05:30
apolloProvider,
2023-03-17 16:20:25 +05:30
provide: {
rootPath,
toggleNewNavEndpoint,
},
render(h) {
return h(SuperSidebar, {
props: {
sidebarData: JSON.parse(sidebar),
},
});
},
});
};
2023-05-27 22:25:52 +05:30
requestIdleCallback(initStatusTriggers);