Skip to content

Commit 233f3d6

Browse files
committed
add option
1 parent 852ddb4 commit 233f3d6

File tree

6 files changed

+74
-53
lines changed

6 files changed

+74
-53
lines changed

options/locale/locale_en-US.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3773,6 +3773,9 @@ variables.creation.success = The variable "%s" has been added.
37733773
variables.update.failed = Failed to edit variable.
37743774
variables.update.success = The variable has been edited.
37753775

3776+
logs.always_auto_scroll = Always auto scroll
3777+
logs.always_auto_expand = Always auto expand
3778+
37763779
[projects]
37773780
deleted.display_name = Deleted Project
37783781
type-1.display_name = Individual Project

routers/web/devtest/mock_actions.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ func MockActionsRunsJobs(ctx *context.Context) {
5656
resp.State.Run.Status = actions_model.StatusRunning.String()
5757
resp.State.Run.CanCancel = true
5858
resp.State.Run.CanDeleteArtifact = true
59+
resp.State.Run.WorkflowID = "workflow-id"
60+
resp.State.Run.WorkflowLink = "./workflow-link"
61+
resp.State.Run.Commit = actions.ViewCommit{
62+
ShortSha: "ccccdddd",
63+
Link: "./commit-link",
64+
Pusher: actions.ViewUser{
65+
DisplayName: "pusher user",
66+
Link: "./pusher-link",
67+
},
68+
Branch: actions.ViewBranch{
69+
Name: "commit-branch",
70+
Link: "./branch-link",
71+
IsDeleted: false,
72+
},
73+
}
5974
resp.Artifacts = append(resp.Artifacts, &actions.ArtifactsViewItem{
6075
Name: "artifact-a",
6176
Size: 100 * 1024,
Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
11
{{template "base/head" .}}
22
<div class="page-content">
3-
<div id="repo-action-view"
4-
data-run-index="1"
5-
data-job-index="2"
6-
data-actions-url="{{AppSubUrl}}/devtest/actions-mock"
7-
data-locale-approve="approve"
8-
data-locale-cancel="cancel"
9-
data-locale-rerun="re-run"
10-
data-locale-rerun-all="re-run all"
11-
data-locale-runs-scheduled="scheduled"
12-
data-locale-runs-commit="commit"
13-
data-locale-runs-pushed-by="pushed by"
14-
data-locale-status-unknown="unknown"
15-
data-locale-status-waiting="waiting"
16-
data-locale-status-running="running"
17-
data-locale-status-success="success"
18-
data-locale-status-failure="failure"
19-
data-locale-status-cancelled="cancelled"
20-
data-locale-status-skipped="skipped"
21-
data-locale-status-blocked="blocked"
22-
data-locale-artifacts-title="artifacts"
23-
data-locale-confirm-delete-artifact="confirm delete artifact"
24-
data-locale-show-timestamps="show timestamps"
25-
data-locale-show-log-seconds="show log seconds"
26-
data-locale-show-full-screen="show full screen"
27-
data-locale-download-logs="download logs"
28-
></div>
3+
{{template "repo/header" .}}
4+
{{template "repo/actions/view_component" (dict
5+
"RunIndex" 1
6+
"JobIndex" 2
7+
"ActionsURL" (print AppSubUrl "/devtest/actions-mock")
8+
)}}
299
</div>
3010
{{template "base/footer" .}}

templates/repo/actions/view.tmpl

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,11 @@
22

33
<div class="page-content repository">
44
{{template "repo/header" .}}
5-
<div id="repo-action-view"
6-
data-run-index="{{.RunIndex}}"
7-
data-job-index="{{.JobIndex}}"
8-
data-actions-url="{{.ActionsURL}}"
9-
data-locale-approve="{{ctx.Locale.Tr "repo.diff.review.approve"}}"
10-
data-locale-cancel="{{ctx.Locale.Tr "cancel"}}"
11-
data-locale-rerun="{{ctx.Locale.Tr "rerun"}}"
12-
data-locale-rerun-all="{{ctx.Locale.Tr "rerun_all"}}"
13-
data-locale-runs-scheduled="{{ctx.Locale.Tr "actions.runs.scheduled"}}"
14-
data-locale-runs-commit="{{ctx.Locale.Tr "actions.runs.commit"}}"
15-
data-locale-runs-pushed-by="{{ctx.Locale.Tr "actions.runs.pushed_by"}}"
16-
data-locale-status-unknown="{{ctx.Locale.Tr "actions.status.unknown"}}"
17-
data-locale-status-waiting="{{ctx.Locale.Tr "actions.status.waiting"}}"
18-
data-locale-status-running="{{ctx.Locale.Tr "actions.status.running"}}"
19-
data-locale-status-success="{{ctx.Locale.Tr "actions.status.success"}}"
20-
data-locale-status-failure="{{ctx.Locale.Tr "actions.status.failure"}}"
21-
data-locale-status-cancelled="{{ctx.Locale.Tr "actions.status.cancelled"}}"
22-
data-locale-status-skipped="{{ctx.Locale.Tr "actions.status.skipped"}}"
23-
data-locale-status-blocked="{{ctx.Locale.Tr "actions.status.blocked"}}"
24-
data-locale-artifacts-title="{{ctx.Locale.Tr "artifacts"}}"
25-
data-locale-confirm-delete-artifact="{{ctx.Locale.Tr "confirm_delete_artifact"}}"
26-
data-locale-show-timestamps="{{ctx.Locale.Tr "show_timestamps"}}"
27-
data-locale-show-log-seconds="{{ctx.Locale.Tr "show_log_seconds"}}"
28-
data-locale-show-full-screen="{{ctx.Locale.Tr "show_full_screen"}}"
29-
data-locale-download-logs="{{ctx.Locale.Tr "download_logs"}}"
30-
>
31-
</div>
5+
{{template "repo/actions/view_component" (dict
6+
"RunIndex" .RunIndex
7+
"JobIndex" .JobIndex
8+
"ActionsURL" .ActionsURL
9+
)}}
3210
</div>
3311

3412
{{template "base/footer" .}}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<div id="repo-action-view"
2+
data-run-index="{{.RunIndex}}"
3+
data-job-index="{{.JobIndex}}"
4+
data-actions-url="{{.ActionsURL}}"
5+
6+
data-locale-approve="{{ctx.Locale.Tr "repo.diff.review.approve"}}"
7+
data-locale-cancel="{{ctx.Locale.Tr "cancel"}}"
8+
data-locale-rerun="{{ctx.Locale.Tr "rerun"}}"
9+
data-locale-rerun-all="{{ctx.Locale.Tr "rerun_all"}}"
10+
data-locale-runs-scheduled="{{ctx.Locale.Tr "actions.runs.scheduled"}}"
11+
data-locale-runs-commit="{{ctx.Locale.Tr "actions.runs.commit"}}"
12+
data-locale-runs-pushed-by="{{ctx.Locale.Tr "actions.runs.pushed_by"}}"
13+
data-locale-status-unknown="{{ctx.Locale.Tr "actions.status.unknown"}}"
14+
data-locale-status-waiting="{{ctx.Locale.Tr "actions.status.waiting"}}"
15+
data-locale-status-running="{{ctx.Locale.Tr "actions.status.running"}}"
16+
data-locale-status-success="{{ctx.Locale.Tr "actions.status.success"}}"
17+
data-locale-status-failure="{{ctx.Locale.Tr "actions.status.failure"}}"
18+
data-locale-status-cancelled="{{ctx.Locale.Tr "actions.status.cancelled"}}"
19+
data-locale-status-skipped="{{ctx.Locale.Tr "actions.status.skipped"}}"
20+
data-locale-status-blocked="{{ctx.Locale.Tr "actions.status.blocked"}}"
21+
data-locale-artifacts-title="{{ctx.Locale.Tr "artifacts"}}"
22+
data-locale-confirm-delete-artifact="{{ctx.Locale.Tr "confirm_delete_artifact"}}"
23+
data-locale-show-timestamps="{{ctx.Locale.Tr "show_timestamps"}}"
24+
data-locale-show-log-seconds="{{ctx.Locale.Tr "show_log_seconds"}}"
25+
data-locale-show-full-screen="{{ctx.Locale.Tr "show_full_screen"}}"
26+
data-locale-download-logs="{{ctx.Locale.Tr "download_logs"}}"
27+
data-locale-logs-always-auto-scroll="{{ctx.Locale.Tr "actions.logs.always_auto_scroll"}}"
28+
data-locale-logs-always-auto-expand="{{ctx.Locale.Tr "actions.logs.always_auto_expand"}}"
29+
>
30+
</div>

web_src/js/components/RepoActionView.vue

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ const sfc = {
6565
'log-time-stamp': false,
6666
'log-time-seconds': false,
6767
},
68+
optionAlwaysAutoExpand: false,
69+
optionAlwaysAutoScroll: false,
6870
6971
// provided by backend
7072
run: {
@@ -399,6 +401,8 @@ export function initRepositoryActionView() {
399401
skipped: el.getAttribute('data-locale-status-skipped'),
400402
blocked: el.getAttribute('data-locale-status-blocked'),
401403
},
404+
logsAlwaysAutoScroll: el.getAttribute('data-locale-logs-always-auto-scroll'),
405+
logsAlwaysAutoExpand: el.getAttribute('data-locale-logs-always-auto-expand'),
402406
},
403407
});
404408
view.mount(el);
@@ -501,6 +505,17 @@ export function initRepositoryActionView() {
501505
<i class="icon"><SvgIcon :name="isFullScreen ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
502506
{{ locale.showFullScreen }}
503507
</a>
508+
509+
<div class="divider"/>
510+
<a class="item" @click="optionAlwaysAutoScroll = !optionAlwaysAutoScroll">
511+
<i class="icon"><SvgIcon :name="optionAlwaysAutoScroll ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
512+
{{ locale.logsAlwaysAutoScroll }}
513+
</a>
514+
<a class="item" @click="optionAlwaysAutoExpand = !optionAlwaysAutoExpand">
515+
<i class="icon"><SvgIcon :name="optionAlwaysAutoExpand ? 'octicon-check' : 'gitea-empty-checkbox'"/></i>
516+
{{ locale.logsAlwaysAutoExpand }}
517+
</a>
518+
504519
<div class="divider"/>
505520
<a :class="['item', !currentJob.steps.length ? 'disabled' : '']" :href="run.link+'/jobs/'+jobIndex+'/logs'" target="_blank">
506521
<i class="icon"><SvgIcon name="octicon-download"/></i>

0 commit comments

Comments
 (0)