All files / ee/app/assets/javascripts/approvals mount_mr_edit.js

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

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                                                                                 
import Vue from 'vue';
import { parseBoolean } from '~/lib/utils/common_utils';
import MrEditApp from './components/mr_edit/app.vue';
import createStore from './stores';
import mrEditModule from './stores/modules/mr_edit';
 
export default function mountApprovalInput(el) {
  if (!el) {
    return null;
  }
 
  const targetBranchTitle = document.querySelector('#js-target-branch-title');
  const targetBranch =
    targetBranchTitle?.dataset?.branchName ||
    targetBranchTitle?.textContent ||
    document.querySelector('#merge_request_target_branch')?.value;
 
  const store = createStore(
    { approvals: mrEditModule() },
    {
      ...el.dataset,
      prefix: 'mr-edit',
      canEdit: parseBoolean(el.dataset.canEdit),
      canUpdateApprovers: parseBoolean(el.dataset.canUpdateApprovers),
      showCodeOwnerTip: parseBoolean(el.dataset.showCodeOwnerTip),
      allowMultiRule: parseBoolean(el.dataset.allowMultiRule),
      canOverride: parseBoolean(el.dataset.canOverride),
    },
  );
 
  store.dispatch('setTargetBranch', targetBranch);
 
  return new Vue({
    el,
    store,
    render(h) {
      return h(MrEditApp);
    },
  });
}