mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2026-07-18 07:28:47 +00:00
Fixes #11036. This adds a link from a CI run to the file that its workflow was taken from. | Before | After | |---------|---------| |  |  | Before: * the `test.yml` link points to the list of other runs (`/org123/repo2/actions?workflow=test.yml`) After: * the `test.yml` link points to the workflow definition (`/org123/repo2/src/commit/55b048363c8cfa7d9e8b5cade5c75681bd0c7328/.forgejo/workflows/test.yml`) * the `all runs` link points to the list of other runs (`/org123/repo2/actions?workflow=test.yml`) I have tried to retain the existing link to the list of workflow runs (moving it to a separate link), but I am not sure if this link should be retained at all and if so how. ## Checklist ### Tests - I added test coverage for Go changes... - [x] in their respective `*_test.go` for unit tests. - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server. - I added test coverage for JavaScript changes... - [ ] in `web_src/js/*.test.js` if it can be unit tested. - [x] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)). ### Documentation - [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change. - [x] I did not document these changes and I do not expect someone else to do it. ### Release notes - [x] This change will be noticed by a Forgejo user or admin (feature, bug fix, performance, etc.). I suggest to include a release note for this change. - [ ] This change is not visible to a Forgejo user or admin (refactor, dependency upgrade, etc.). I think there is no need to add a release note for this change. <!--start release-notes-assistant--> ## Release notes <!--URL:https://codeberg.org/forgejo/forgejo--> - Features - [PR](https://codeberg.org/forgejo/forgejo/pulls/11216): <!--number 11216 --><!--line 0 --><!--description bGluayBDSSBqb2IgdG8gaXRzIGRlZmluaW5nIHdvcmtmbG93IGZpbGU=-->link CI job to its defining workflow file<!--description--> <!--end release-notes-assistant--> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11216 Reviewed-by: Andreas Ahlenstorf <aahlenst@noreply.codeberg.org> Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org> Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu> Co-committed-by: Antonin Delpeuch <antonin@delpeuch.eu>
57 lines
2.9 KiB
TypeScript
57 lines
2.9 KiB
TypeScript
import {createApp} from 'vue';
|
|
|
|
export async function initRepositoryActionView() {
|
|
const el = document.getElementById('repo-action-view');
|
|
if (!el) return;
|
|
|
|
const {default: RepoActionView} = await import(/* webpackChunkName: "repo-action-view" */'../components/RepoActionView.vue');
|
|
|
|
// 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('body > div.full.height') as HTMLDivElement;
|
|
if (parentFullHeight) parentFullHeight.style.paddingBottom = '0';
|
|
|
|
const initialJobData = JSON.parse(el.getAttribute('data-initial-post-response'));
|
|
const initialArtifactData = JSON.parse(el.getAttribute('data-initial-artifacts-response'));
|
|
|
|
const view = createApp(RepoActionView, {
|
|
initialJobData,
|
|
initialArtifactData,
|
|
runIndex: el.getAttribute('data-run-index'),
|
|
runID: el.getAttribute('data-run-id'),
|
|
jobIndex: el.getAttribute('data-job-index'),
|
|
attemptNumber: el.getAttribute('data-attempt-number'),
|
|
actionsURL: el.getAttribute('data-actions-url'),
|
|
workflowName: el.getAttribute('data-workflow-name'),
|
|
workflowURL: el.getAttribute('data-workflow-url'),
|
|
workflowSourceURL: el.getAttribute('data-workflow-source-url'),
|
|
locale: {
|
|
approve: el.getAttribute('data-locale-approve'),
|
|
cancel: el.getAttribute('data-locale-cancel'),
|
|
rerun: el.getAttribute('data-locale-rerun'),
|
|
artifactsTitle: el.getAttribute('data-locale-artifacts-title'),
|
|
areYouSure: el.getAttribute('data-locale-are-you-sure'),
|
|
confirmDeleteArtifact: el.getAttribute('data-locale-confirm-delete-artifact'),
|
|
rerun_all: el.getAttribute('data-locale-rerun-all'),
|
|
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'),
|
|
runAttemptLabel: el.getAttribute('data-locale-run-attempt-label'),
|
|
viewingOutOfDateRun: el.getAttribute('data-locale-viewing-out-of-date-run'),
|
|
viewMostRecentRun: el.getAttribute('data-locale-view-most-recent-run'),
|
|
preExecutionError: el.getAttribute('data-locale-pre-execution-error'),
|
|
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'),
|
|
},
|
|
},
|
|
});
|
|
view.mount(el);
|
|
}
|