forgejo/web_src/js/components/ActionJobStepList.vue
Mathieu Fenniak 34af1330c2
Some checks are pending
/ release (push) Waiting to run
testing-integration / test-unit (push) Waiting to run
testing-integration / test-sqlite (push) Waiting to run
testing-integration / test-mariadb (v10.6) (push) Waiting to run
testing-integration / test-mariadb (v11.8) (push) Waiting to run
testing / backend-checks (push) Waiting to run
testing / frontend-checks (push) Waiting to run
testing / test-unit (push) Blocked by required conditions
testing / test-e2e (push) Blocked by required conditions
testing / test-remote-cacher (redis) (push) Blocked by required conditions
testing / test-remote-cacher (valkey) (push) Blocked by required conditions
testing / test-remote-cacher (garnet) (push) Blocked by required conditions
testing / test-remote-cacher (redict) (push) Blocked by required conditions
testing / test-mysql (push) Blocked by required conditions
testing / test-pgsql (push) Blocked by required conditions
testing / test-sqlite (push) Blocked by required conditions
testing / security-check (push) Blocked by required conditions
refactor: split ActionJobStepList out of RepoActionView (#10537)
Continuing refactor work to split functionality out of `RepoActionView` and into more testable, more manageable sub-components.  #9768 will eventually result in some updates to this view for new functionality, and before more complexity is added I'd like to clean it up to a more maintainable state.

Previous refactor step: #10366

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [x] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] 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] I do not want this change to show in the release notes.
- [ ] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10537
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Mathieu Fenniak <mathieu@fenniak.net>
Co-committed-by: Mathieu Fenniak <mathieu@fenniak.net>
2025-12-22 04:14:11 +01:00

108 lines
2.6 KiB
Vue

<!--
Copyright 2025 The Forgejo Authors. All rights reserved.
SPDX-License-Identifier: GPL-3.0-or-later
-->
<script>
import ActionJobStep from './ActionJobStep.vue';
import {toggleElem} from '../utils/dom.js';
export default {
name: 'ActionJobStepList',
components: {
// SvgIcon,
ActionJobStep,
},
props: {
steps: {
// Array of { status: string, summary: string, duration: string }
type: Array,
required: true,
},
stepStates: {
// Array of { cursor: Number | null, expanded: boolean }. Array length must match `steps`.
type: Array,
required: true,
},
runStatus: {
type: String,
required: true,
},
isExpandable: {
type: Function,
required: true,
},
isDone: {
type: Function,
required: true,
},
timeVisibleTimestamp: {
type: Boolean,
required: true,
},
timeVisibleSeconds: {
type: Boolean,
required: true,
},
},
emits: ['toggleStepLogs'],
watch: {
timeVisibleTimestamp(_oldVisible, _newVisible) {
for (const el of this.$refs.steps.querySelectorAll(`.log-time-stamp`)) {
toggleElem(el, this.timeVisibleTimestamp);
}
},
timeVisibleSeconds(_oldVisible, _newVisible) {
for (const el of this.$refs.steps.querySelectorAll(`.log-time-seconds`)) {
toggleElem(el, this.timeVisibleSeconds);
}
},
},
methods: {
appendLogs(stepIndex, logLines, startTime) {
this.$refs.jobSteps[stepIndex].appendLogs(logLines, startTime);
},
scrollIntoView(stepIndex, lineID) {
this.$refs.jobSteps[stepIndex].scrollIntoView(lineID);
},
},
};
</script>
<template>
<div class="job-step-container" ref="steps" v-if="steps.length">
<div class="job-step-section" v-for="(jobStep, i) in steps" :key="i">
<ActionJobStep
ref="jobSteps"
:run-status="runStatus"
:is-expandable="isExpandable"
:is-done="isDone"
:step-id="i"
:status="jobStep.status"
:summary="jobStep.summary"
:duration="jobStep.duration"
:expanded="stepStates[i].expanded"
:cursor="stepStates[i].cursor"
:time-visible-timestamp="timeVisibleTimestamp"
:time-visible-seconds="timeVisibleSeconds"
@toggle="() => $emit('toggleStepLogs', i)"
/>
</div>
</div>
</template>
<style scoped>
.job-step-container {
max-height: 100%;
border-radius: 0 0 var(--border-radius) var(--border-radius);
border-top: 1px solid var(--color-console-border);
z-index: 0;
}
.job-step-section {
margin: 10px;
}
</style>