debian-mirror-gitlab/app/assets/javascripts/init_diff_stats_dropdown.js
2023-07-09 08:55:56 +05:30

25 lines
613 B
JavaScript

import Vue from 'vue';
import DiffStatsDropdown from '~/vue_shared/components/diff_stats_dropdown.vue';
export const initDiffStatsDropdown = () => {
const el = document.querySelector('.js-diff-stats-dropdown');
if (!el) {
return false;
}
const { changed, added, deleted, files } = el.dataset;
return new Vue({
el,
render: (createElement) =>
createElement(DiffStatsDropdown, {
props: {
changed: parseInt(changed, 10),
added: parseInt(added, 10),
deleted: parseInt(deleted, 10),
files: JSON.parse(files),
},
}),
});
};