gitea源码

repo-actions.ts 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {createApp} from 'vue';
  2. import RepoActionView from '../components/RepoActionView.vue';
  3. export function initRepositoryActionView() {
  4. const el = document.querySelector('#repo-action-view');
  5. if (!el) return;
  6. // TODO: the parent element's full height doesn't work well now,
  7. // but we can not pollute the global style at the moment, only fix the height problem for pages with this component
  8. const parentFullHeight = document.querySelector<HTMLElement>('body > div.full.height');
  9. if (parentFullHeight) parentFullHeight.style.paddingBottom = '0';
  10. const view = createApp(RepoActionView, {
  11. runIndex: el.getAttribute('data-run-index'),
  12. jobIndex: el.getAttribute('data-job-index'),
  13. actionsURL: el.getAttribute('data-actions-url'),
  14. locale: {
  15. approve: el.getAttribute('data-locale-approve'),
  16. cancel: el.getAttribute('data-locale-cancel'),
  17. rerun: el.getAttribute('data-locale-rerun'),
  18. rerun_all: el.getAttribute('data-locale-rerun-all'),
  19. scheduled: el.getAttribute('data-locale-runs-scheduled'),
  20. commit: el.getAttribute('data-locale-runs-commit'),
  21. pushedBy: el.getAttribute('data-locale-runs-pushed-by'),
  22. artifactsTitle: el.getAttribute('data-locale-artifacts-title'),
  23. areYouSure: el.getAttribute('data-locale-are-you-sure'),
  24. artifactExpired: el.getAttribute('data-locale-artifact-expired'),
  25. confirmDeleteArtifact: el.getAttribute('data-locale-confirm-delete-artifact'),
  26. showTimeStamps: el.getAttribute('data-locale-show-timestamps'),
  27. showLogSeconds: el.getAttribute('data-locale-show-log-seconds'),
  28. showFullScreen: el.getAttribute('data-locale-show-full-screen'),
  29. downloadLogs: el.getAttribute('data-locale-download-logs'),
  30. status: {
  31. unknown: el.getAttribute('data-locale-status-unknown'),
  32. waiting: el.getAttribute('data-locale-status-waiting'),
  33. running: el.getAttribute('data-locale-status-running'),
  34. success: el.getAttribute('data-locale-status-success'),
  35. failure: el.getAttribute('data-locale-status-failure'),
  36. cancelled: el.getAttribute('data-locale-status-cancelled'),
  37. skipped: el.getAttribute('data-locale-status-skipped'),
  38. blocked: el.getAttribute('data-locale-status-blocked'),
  39. },
  40. logsAlwaysAutoScroll: el.getAttribute('data-locale-logs-always-auto-scroll'),
  41. logsAlwaysExpandRunning: el.getAttribute('data-locale-logs-always-expand-running'),
  42. },
  43. });
  44. view.mount(el);
  45. }