Skip to content

Commit b136a66

Browse files
bircniclaudewxiaoguangsilverwind
authored
Restyle Workflow Graph (#36912)
Follow GitHub's style and fine tune colors & layouts. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: silverwind <me@silverwind.io>
1 parent 896e483 commit b136a66

11 files changed

Lines changed: 383 additions & 487 deletions

File tree

routers/web/devtest/mock_actions.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func MockActionsRunsJobs(ctx *context.Context) {
6868
runID := ctx.PathParamInt64("run")
6969

7070
resp := &actions.ViewResponse{}
71+
resp.State.Run.RepoID = 12345
7172
resp.State.Run.TitleHTML = `mock run title <a href="/">link</a>`
7273
resp.State.Run.Link = setting.AppSubURL + "/devtest/repo-action-view/runs/" + strconv.FormatInt(runID, 10)
7374
resp.State.Run.Status = actions_model.StatusRunning.String()
@@ -135,12 +136,36 @@ func MockActionsRunsJobs(ctx *context.Context) {
135136
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &actions.ViewJob{
136137
ID: runID*10 + 2,
137138
JobID: "job-102",
138-
Name: "job 102",
139+
Name: "ULTRA LOOOOOOOOOOOONG job name 102 that exceeds the limit",
139140
Status: actions_model.StatusFailure.String(),
140141
CanRerun: false,
141142
Duration: "3h",
142143
Needs: []string{"job-100", "job-101"},
143144
})
145+
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &actions.ViewJob{
146+
ID: runID*10 + 3,
147+
JobID: "job-103",
148+
Name: "job 103",
149+
Status: actions_model.StatusCancelled.String(),
150+
CanRerun: false,
151+
Duration: "2m",
152+
Needs: []string{"job-100"},
153+
})
154+
155+
// add more jobs to a run for UI testing
156+
if resp.State.Run.CanCancel {
157+
for i := range 10 {
158+
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &actions.ViewJob{
159+
ID: runID*1000 + int64(i),
160+
JobID: "job-dup-test-" + strconv.Itoa(i),
161+
Name: "job dup test " + strconv.Itoa(i),
162+
Status: actions_model.StatusSuccess.String(),
163+
CanRerun: false,
164+
Duration: "2m",
165+
Needs: []string{"job-103", "job-101", "job-100"},
166+
})
167+
}
168+
}
144169

145170
fillViewRunResponseCurrentJob(ctx, resp)
146171
ctx.JSON(http.StatusOK, resp)

routers/web/repo/actions/view.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ type ViewResponse struct {
129129

130130
State struct {
131131
Run struct {
132+
RepoID int64 `json:"repoId"`
132133
Link string `json:"link"`
133134
Title string `json:"title"`
134135
TitleHTML template.HTML `json:"titleHTML"`
@@ -252,6 +253,7 @@ func fillViewRunResponseSummary(ctx *context_module.Context, resp *ViewResponse,
252253
return
253254
}
254255

256+
resp.State.Run.RepoID = ctx.Repo.Repository.ID
255257
// the title for the "run" is from the commit message
256258
resp.State.Run.Title = run.Title
257259
resp.State.Run.TitleHTML = templates.NewRenderUtils(ctx).RenderCommitMessage(run.Title, ctx.Repo.Repository)

web_src/css/base.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,9 +808,7 @@ table th[data-sortt-desc] .svg {
808808

809809
.btn,
810810
.ui.ui.dropdown,
811-
.flex-text-inline,
812-
.flex-text-inline > a,
813-
.flex-text-inline > span {
811+
.flex-text-inline {
814812
display: inline-flex;
815813
align-items: center;
816814
gap: var(--gap-inline);

web_src/css/themes/theme-gitea-dark.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ gitea-theme-meta-info {
208208
--color-input-toggle-background: #2e353c;
209209
--color-input-border: var(--color-secondary-dark-1);
210210
--color-light: #00001728;
211-
--color-light-mimic-enabled: rgba(0, 0, 0, calc(40 / 255 * 222 / 255 / var(--opacity-disabled)));
212211
--color-light-border: #e8f3ff28;
213212
--color-hover: #e8f3ff19;
214213
--color-hover-opaque: #21252a; /* TODO: color-mix(in srgb, var(--color-body), var(--color-hover)); */
@@ -249,6 +248,7 @@ gitea-theme-meta-info {
249248
--color-danger: var(--color-red);
250249
--color-transparency-grid-light: #2a2a2a;
251250
--color-transparency-grid-dark: #1a1a1a;
251+
--color-workflow-edge-hover: #616e78;
252252
accent-color: var(--color-accent);
253253
color-scheme: dark;
254254
}

web_src/css/themes/theme-gitea-light.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ gitea-theme-meta-info {
208208
--color-input-toggle-background: #d0d7de;
209209
--color-input-border: var(--color-secondary-dark-1);
210210
--color-light: #00001706;
211-
--color-light-mimic-enabled: rgba(0, 0, 0, calc(6 / 255 * 222 / 255 / var(--opacity-disabled)));
212211
--color-light-border: #0000171d;
213212
--color-hover: #00001708;
214213
--color-hover-opaque: #f1f3f5; /* TODO: color-mix(in srgb, var(--color-body), var(--color-hover)); */
@@ -249,6 +248,7 @@ gitea-theme-meta-info {
249248
--color-danger: var(--color-red);
250249
--color-transparency-grid-light: #fafafa;
251250
--color-transparency-grid-dark: #e2e2e2;
251+
--color-workflow-edge-hover: #b1b7bd;
252252
accent-color: var(--color-accent);
253253
color-scheme: light;
254254
}

web_src/js/components/ActionRunSummaryView.vue

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,42 @@ onBeforeUnmount(() => {
2929
});
3030
</script>
3131
<template>
32-
<div>
32+
<div class="action-run-summary-view">
3333
<div class="action-run-summary-block">
34-
<p class="action-run-summary-trigger">
35-
{{ locale.triggeredVia.replace('%s', run.triggerEvent) }}
36-
&nbsp;&nbsp;<relative-time :datetime="runTriggeredAtIso" prefix=" "/>
37-
</p>
38-
<p class="tw-mb-0">
34+
<div class="flex-text-block">
35+
{{ locale.triggeredVia.replace('%s', run.triggerEvent) }} • <relative-time :datetime="runTriggeredAtIso" prefix=""/>
36+
</div>
37+
<div class="flex-text-block">
3938
<ActionRunStatus :locale-status="locale.status[run.status]" :status="run.status" :size="16"/>
40-
<span class="tw-ml-2">{{ locale.status[run.status] }}</span>
41-
<span class="tw-ml-3">{{ locale.totalDuration }} {{ run.duration || '–' }}</span>
42-
</p>
39+
<span>{{ locale.status[run.status] }}</span> • <span>{{ locale.totalDuration }} {{ run.duration || '–' }}</span>
40+
</div>
4341
</div>
4442
<WorkflowGraph
4543
v-if="run.jobs.length > 0"
44+
:store="store"
4645
:jobs="run.jobs"
4746
:run-link="run.link"
4847
:workflow-id="run.workflowID"
49-
class="workflow-graph-container"
5048
/>
5149
</div>
5250
</template>
5351
<style scoped>
52+
.action-run-summary-view {
53+
flex: 1;
54+
display: flex;
55+
flex-direction: column;
56+
color: var(--color-text-light-1);
57+
}
58+
5459
.action-run-summary-block {
60+
display: flex;
61+
justify-content: space-between;
62+
align-items: center;
63+
flex-wrap: wrap;
64+
gap: 6px;
5565
padding: 12px;
5666
border-bottom: 1px solid var(--color-secondary);
57-
}
58-
59-
.action-run-summary-trigger {
60-
margin-bottom: 6px;
61-
color: var(--color-text-light-2);
67+
border-radius: var(--border-radius) var(--border-radius) 0 0;
68+
background: var(--color-box-header);
6269
}
6370
</style>

web_src/js/components/ActionRunView.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ export function createLogLineMessage(line: LogLine, cmd: LogLineCommand | null)
8989

9090
export function createEmptyActionsRun(): ActionsRun {
9191
return {
92+
repoId: 0,
9293
link: '',
9394
title: '',
9495
titleHTML: '',

web_src/js/components/RepoActionView.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,11 @@ async function deleteArtifact(name: string) {
222222
max-width: 400px;
223223
position: sticky;
224224
top: 12px;
225-
max-height: 100vh;
225+
226+
/* about 12px top padding + 12px bottom padding + 37px footer height,
227+
TODO: need to use JS to calculate the height for better scrolling experience*/
228+
max-height: calc(100vh - 62px);
229+
226230
overflow-y: auto;
227231
background: var(--color-body);
228232
z-index: 2; /* above .job-info-header */
@@ -231,12 +235,13 @@ async function deleteArtifact(name: string) {
231235
@media (max-width: 767.98px) {
232236
.action-view-left {
233237
position: static; /* can not sticky because multiple jobs would overlap into right view */
238+
max-height: unset;
234239
}
235240
}
236241
237242
.left-list-header {
238-
font-size: 12px;
239-
color: var(--color-grey);
243+
font-size: 13px;
244+
color: var(--color-text-light-2);
240245
}
241246
242247
.job-artifacts-item {
@@ -299,7 +304,6 @@ async function deleteArtifact(name: string) {
299304
300305
.job-brief-item .job-brief-item-left .job-brief-name {
301306
display: block;
302-
width: 70%;
303307
}
304308
305309
.job-brief-item .job-brief-item-right {
@@ -320,7 +324,6 @@ async function deleteArtifact(name: string) {
320324
border: 1px solid var(--color-console-border);
321325
border-radius: var(--border-radius);
322326
background: var(--color-console-bg);
323-
align-self: flex-start;
324327
}
325328
326329
/* begin fomantic button overrides */

0 commit comments

Comments
 (0)