gitea源码

contributors.ts 1.2KB

12345678910111213141516171819202122232425262728293031
  1. import {createApp} from 'vue';
  2. export async function initRepoContributors() {
  3. const el = document.querySelector('#repo-contributors-chart');
  4. if (!el) return;
  5. const {default: RepoContributors} = await import(/* webpackChunkName: "contributors-graph" */'../components/RepoContributors.vue');
  6. try {
  7. const View = createApp(RepoContributors, {
  8. repoLink: el.getAttribute('data-repo-link'),
  9. repoDefaultBranchName: el.getAttribute('data-repo-default-branch-name'),
  10. locale: {
  11. filterLabel: el.getAttribute('data-locale-filter-label'),
  12. contributionType: {
  13. commits: el.getAttribute('data-locale-contribution-type-commits'),
  14. additions: el.getAttribute('data-locale-contribution-type-additions'),
  15. deletions: el.getAttribute('data-locale-contribution-type-deletions'),
  16. },
  17. loadingTitle: el.getAttribute('data-locale-loading-title'),
  18. loadingTitleFailed: el.getAttribute('data-locale-loading-title-failed'),
  19. loadingInfo: el.getAttribute('data-locale-loading-info'),
  20. },
  21. });
  22. View.mount(el);
  23. } catch (err) {
  24. console.error('RepoContributors failed to load', err);
  25. el.textContent = el.getAttribute('data-locale-component-failed-to-load');
  26. }
  27. }