Skip to content

Commit be1090c

Browse files
GiteaBotNorthRealmwxiaoguang
authored
Grey out expired artifact on Artifacts list (#34314) (#34404)
Backport #34314 by @NorthRealm Grey out expired artifact on Artifacts list. ![1](https://github.com/user-attachments/assets/79c00e39-29f5-4264-b7b2-7ed638ab71c1) ![2](https://github.com/user-attachments/assets/686b745f-d6d7-4921-8e1b-3472ac8b6c17) Co-authored-by: NorthRealm <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
1 parent c8f3402 commit be1090c

File tree

5 files changed

+32
-12
lines changed

5 files changed

+32
-12
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ pin = Pin
130130
unpin = Unpin
131131

132132
artifacts = Artifacts
133+
expired = Expired
133134
confirm_delete_artifact = Are you sure you want to delete the artifact '%s' ?
134135

135136
archived = Archived

routers/web/devtest/mock_actions.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ func MockActionsRunsJobs(ctx *context.Context) {
9494
Size: 1024 * 1024,
9595
Status: "completed",
9696
})
97+
resp.Artifacts = append(resp.Artifacts, &actions.ArtifactsViewItem{
98+
Name: "artifact-very-loooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
99+
Size: 100 * 1024,
100+
Status: "expired",
101+
})
102+
resp.Artifacts = append(resp.Artifacts, &actions.ArtifactsViewItem{
103+
Name: "artifact-really-loooooooooooooooooooooooooooooooooooooooooooooooooooooooong",
104+
Size: 1024 * 1024,
105+
Status: "completed",
106+
})
97107

98108
resp.State.Run.Jobs = append(resp.State.Run.Jobs, &actions.ViewJob{
99109
ID: runID * 10,

templates/repo/actions/view_component.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
data-locale-status-skipped="{{ctx.Locale.Tr "actions.status.skipped"}}"
2020
data-locale-status-blocked="{{ctx.Locale.Tr "actions.status.blocked"}}"
2121
data-locale-artifacts-title="{{ctx.Locale.Tr "artifacts"}}"
22+
data-locale-artifact-expired="{{ctx.Locale.Tr "expired"}}"
2223
data-locale-confirm-delete-artifact="{{ctx.Locale.Tr "confirm_delete_artifact"}}"
2324
data-locale-show-timestamps="{{ctx.Locale.Tr "show_timestamps"}}"
2425
data-locale-show-log-seconds="{{ctx.Locale.Tr "show_log_seconds"}}"

web_src/js/components/RepoActionView.vue

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -495,14 +495,24 @@ export default defineComponent({
495495
{{ locale.artifactsTitle }}
496496
</div>
497497
<ul class="job-artifacts-list">
498-
<li class="job-artifacts-item" v-for="artifact in artifacts" :key="artifact.name">
499-
<a class="job-artifacts-link" target="_blank" :href="run.link+'/artifacts/'+artifact.name">
500-
<SvgIcon name="octicon-file" class="ui text black job-artifacts-icon"/>{{ artifact.name }}
501-
</a>
502-
<a v-if="run.canDeleteArtifact" @click="deleteArtifact(artifact.name)" class="job-artifacts-delete">
503-
<SvgIcon name="octicon-trash" class="ui text black job-artifacts-icon"/>
504-
</a>
505-
</li>
498+
<template v-for="artifact in artifacts" :key="artifact.name">
499+
<li class="job-artifacts-item">
500+
<template v-if="artifact.status !== 'expired'">
501+
<a class="flex-text-inline" target="_blank" :href="run.link+'/artifacts/'+artifact.name">
502+
<SvgIcon name="octicon-file" class="text black"/>
503+
<span class="gt-ellipsis">{{ artifact.name }}</span>
504+
</a>
505+
<a v-if="run.canDeleteArtifact" @click="deleteArtifact(artifact.name)">
506+
<SvgIcon name="octicon-trash" class="text black"/>
507+
</a>
508+
</template>
509+
<span v-else class="flex-text-inline text light grey">
510+
<SvgIcon name="octicon-file"/>
511+
<span class="gt-ellipsis">{{ artifact.name }}</span>
512+
<span class="ui label text light grey tw-flex-shrink-0">{{ locale.artifactExpired }}</span>
513+
</span>
514+
</li>
515+
</template>
506516
</ul>
507517
</div>
508518
</div>
@@ -664,17 +674,14 @@ export default defineComponent({
664674
padding: 6px;
665675
display: flex;
666676
justify-content: space-between;
677+
align-items: center;
667678
}
668679
669680
.job-artifacts-list {
670681
padding-left: 12px;
671682
list-style: none;
672683
}
673684
674-
.job-artifacts-icon {
675-
padding-right: 3px;
676-
}
677-
678685
.job-brief-list {
679686
display: flex;
680687
flex-direction: column;

web_src/js/features/repo-actions.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export function initRepositoryActionView() {
2424
pushedBy: el.getAttribute('data-locale-runs-pushed-by'),
2525
artifactsTitle: el.getAttribute('data-locale-artifacts-title'),
2626
areYouSure: el.getAttribute('data-locale-are-you-sure'),
27+
artifactExpired: el.getAttribute('data-locale-artifact-expired'),
2728
confirmDeleteArtifact: el.getAttribute('data-locale-confirm-delete-artifact'),
2829
showTimeStamps: el.getAttribute('data-locale-show-timestamps'),
2930
showLogSeconds: el.getAttribute('data-locale-show-log-seconds'),

0 commit comments

Comments
 (0)