2021-11-11 11:23:49 +05:30
|
|
|
import Vue from 'vue';
|
|
|
|
import DiffStatsDropdown from '~/vue_shared/components/diff_stats_dropdown.vue';
|
|
|
|
|
2023-07-09 08:55:56 +05:30
|
|
|
export const initDiffStatsDropdown = () => {
|
2021-11-11 11:23:49 +05:30
|
|
|
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),
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
};
|