mirror of
https://github.com/go-gitea/gitea
synced 2025-01-21 23:24:29 +00:00
4b21a6c792
- Enable https://www.typescriptlang.org/tsconfig/#noImplicitThis - Wrap Vue Template-Syntax SFCs in [`defineComponent`](https://vuejs.org/api/general#definecomponent) which makes type inference and linter work better - Move `createApp` calls outside the SFCs into separate files - Use [`PropType`](https://vuejs.org/api/utility-types#proptype-t) where appropriate - Some top-level component properties changed order as dictated by the linter - Fix all tsc and lint issues that popped up during these refactors
48 lines
2.4 KiB
TypeScript
48 lines
2.4 KiB
TypeScript
import {createApp} from 'vue';
|
|
import RepoActionView from '../components/RepoActionView.vue';
|
|
|
|
export function initRepositoryActionView() {
|
|
const el = document.querySelector('#repo-action-view');
|
|
if (!el) return;
|
|
|
|
// TODO: the parent element's full height doesn't work well now,
|
|
// but we can not pollute the global style at the moment, only fix the height problem for pages with this component
|
|
const parentFullHeight = document.querySelector<HTMLElement>('body > div.full.height');
|
|
if (parentFullHeight) parentFullHeight.style.paddingBottom = '0';
|
|
|
|
const view = createApp(RepoActionView, {
|
|
runIndex: el.getAttribute('data-run-index'),
|
|
jobIndex: el.getAttribute('data-job-index'),
|
|
actionsURL: el.getAttribute('data-actions-url'),
|
|
locale: {
|
|
approve: el.getAttribute('data-locale-approve'),
|
|
cancel: el.getAttribute('data-locale-cancel'),
|
|
rerun: el.getAttribute('data-locale-rerun'),
|
|
rerun_all: el.getAttribute('data-locale-rerun-all'),
|
|
scheduled: el.getAttribute('data-locale-runs-scheduled'),
|
|
commit: el.getAttribute('data-locale-runs-commit'),
|
|
pushedBy: el.getAttribute('data-locale-runs-pushed-by'),
|
|
artifactsTitle: el.getAttribute('data-locale-artifacts-title'),
|
|
areYouSure: el.getAttribute('data-locale-are-you-sure'),
|
|
confirmDeleteArtifact: el.getAttribute('data-locale-confirm-delete-artifact'),
|
|
showTimeStamps: el.getAttribute('data-locale-show-timestamps'),
|
|
showLogSeconds: el.getAttribute('data-locale-show-log-seconds'),
|
|
showFullScreen: el.getAttribute('data-locale-show-full-screen'),
|
|
downloadLogs: el.getAttribute('data-locale-download-logs'),
|
|
status: {
|
|
unknown: el.getAttribute('data-locale-status-unknown'),
|
|
waiting: el.getAttribute('data-locale-status-waiting'),
|
|
running: el.getAttribute('data-locale-status-running'),
|
|
success: el.getAttribute('data-locale-status-success'),
|
|
failure: el.getAttribute('data-locale-status-failure'),
|
|
cancelled: el.getAttribute('data-locale-status-cancelled'),
|
|
skipped: el.getAttribute('data-locale-status-skipped'),
|
|
blocked: el.getAttribute('data-locale-status-blocked'),
|
|
},
|
|
logsAlwaysAutoScroll: el.getAttribute('data-locale-logs-always-auto-scroll'),
|
|
logsAlwaysExpandRunning: el.getAttribute('data-locale-logs-always-expand-running'),
|
|
},
|
|
});
|
|
view.mount(el);
|
|
}
|