All files / ee/app/assets/javascripts/oncall_schedules index.js

0% Statements 0/8
0% Branches 0/2
0% Functions 0/2
0% Lines 0/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47                                                                                             
import Vue from 'vue';
import VueApollo from 'vue-apollo';
import { parseBoolean } from '~/lib/utils/common_utils';
import OnCallSchedulesWrapper from './components/oncall_schedules_wrapper.vue';
import apolloProvider from './graphql';
import getTimelineWidthQuery from './graphql/queries/get_timeline_width.query.graphql';
 
Vue.use(VueApollo);
 
export default () => {
  const el = document.querySelector('#js-oncall_schedule');
 
  if (!el) return null;
 
  const {
    projectPath,
    emptyOncallSchedulesSvgPath,
    timezones,
    escalationPoliciesPath,
    userCanCreateSchedule,
    accessLevelDescriptionPath,
  } = el.dataset;
 
  apolloProvider.clients.defaultClient.cache.writeQuery({
    query: getTimelineWidthQuery,
    data: {
      timelineWidth: 0,
    },
  });
 
  return new Vue({
    el,
    apolloProvider,
    provide: {
      projectPath,
      emptyOncallSchedulesSvgPath,
      timezones: JSON.parse(timezones),
      escalationPoliciesPath,
      userCanCreateSchedule: parseBoolean(userCanCreateSchedule),
      accessLevelDescriptionPath,
    },
    render(createElement) {
      return createElement(OnCallSchedulesWrapper);
    },
  });
};