Skip to content

Commit f53b33b

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: Display owner of a runner as a tooltip instead of static text (go-gitea#24377) Remove highlight in repo list (go-gitea#24675) Update pin and add pin-slash (go-gitea#24669) Improve empty notifications display (go-gitea#24668)
2 parents 39754d7 + 4980813 commit f53b33b

File tree

16 files changed

+81
-31
lines changed

16 files changed

+81
-31
lines changed

models/actions/runner.go

+17-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"code.gitea.io/gitea/models/db"
1313
repo_model "code.gitea.io/gitea/models/repo"
14+
"code.gitea.io/gitea/models/shared/types"
1415
user_model "code.gitea.io/gitea/models/user"
1516
"code.gitea.io/gitea/modules/timeutil"
1617
"code.gitea.io/gitea/modules/translation"
@@ -28,7 +29,7 @@ type ActionRunner struct {
2829
Version string `xorm:"VARCHAR(64)"`
2930
OwnerID int64 `xorm:"index"` // org level runner, 0 means system
3031
Owner *user_model.User `xorm:"-"`
31-
RepoID int64 `xorm:"index"` // repo level runner, if orgid also is zero, then it's a global
32+
RepoID int64 `xorm:"index"` // repo level runner, if OwnerID also is zero, then it's a global
3233
Repo *repo_model.Repository `xorm:"-"`
3334
Description string `xorm:"TEXT"`
3435
Base int // 0 native 1 docker 2 virtual machine
@@ -52,14 +53,25 @@ type ActionRunner struct {
5253
Deleted timeutil.TimeStamp `xorm:"deleted"`
5354
}
5455

55-
func (r *ActionRunner) OwnType() string {
56+
// BelongsToOwnerName before calling, should guarantee that all attributes are loaded
57+
func (r *ActionRunner) BelongsToOwnerName() string {
5658
if r.RepoID != 0 {
57-
return fmt.Sprintf("Repo(%s)", r.Repo.FullName())
59+
return r.Repo.FullName()
5860
}
5961
if r.OwnerID != 0 {
60-
return fmt.Sprintf("Org(%s)", r.Owner.Name)
62+
return r.Owner.Name
6163
}
62-
return "Global"
64+
return ""
65+
}
66+
67+
func (r *ActionRunner) BelongsToOwnerType() types.OwnerType {
68+
if r.RepoID != 0 {
69+
return types.OwnerTypeRepository
70+
}
71+
if r.OwnerID != 0 {
72+
return types.OwnerTypeOrganization
73+
}
74+
return types.OwnerTypeSystemGlobal
6375
}
6476

6577
func (r *ActionRunner) Status() runnerv1.RunnerStatus {

models/shared/types/ownertype.go

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package types
5+
6+
import "code.gitea.io/gitea/modules/translation"
7+
8+
type OwnerType string
9+
10+
const (
11+
OwnerTypeSystemGlobal = "system-global"
12+
OwnerTypeIndividual = "individual"
13+
OwnerTypeRepository = "repository"
14+
OwnerTypeOrganization = "organization"
15+
)
16+
17+
func (o OwnerType) LocaleString(locale translation.Locale) string {
18+
switch o {
19+
case OwnerTypeSystemGlobal:
20+
return locale.Tr("concept_system_global")
21+
case OwnerTypeIndividual:
22+
return locale.Tr("concept_user_individual")
23+
case OwnerTypeRepository:
24+
return locale.Tr("concept_code_repository")
25+
case OwnerTypeOrganization:
26+
return locale.Tr("concept_user_organization")
27+
}
28+
return locale.Tr("unknown")
29+
}

options/locale/locale_en-US.ini

+5
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ unknown = Unknown
114114

115115
rss_feed = RSS Feed
116116

117+
concept_system_global = Global
118+
concept_user_individual = Individual
119+
concept_code_repository = Repository
120+
concept_user_organization = Organization
121+
117122
[aria]
118123
navbar = Navigation Bar
119124
footer = Footer

package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@github/relative-time-element": "4.3.0",
1717
"@github/text-expander-element": "2.3.0",
1818
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
19-
"@primer/octicons": "18.3.0",
19+
"@primer/octicons": "19.1.0",
2020
"@vue/compiler-sfc": "3.2.47",
2121
"@webcomponents/custom-elements": "1.6.0",
2222
"add-asset-webpack-plugin": "2.0.1",

public/img/svg/octicon-devices.svg

+1
Loading

public/img/svg/octicon-move-to-top.svg

+1-1
Loading

public/img/svg/octicon-pin-slash.svg

+1
Loading

public/img/svg/octicon-pin.svg

+1-1
Loading

templates/projects/view.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
data-modal-default-project-board-header="{{$.locale.Tr "repo.projects.column.unset_default"}}"
110110
data-modal-default-project-board-content="{{$.locale.Tr "repo.projects.column.unset_default_desc"}}"
111111
data-url="{{$.Link}}/{{.ID}}/unsetdefault">
112-
{{svg "octicon-pin"}}
112+
{{svg "octicon-pin-slash"}}
113113
{{$.locale.Tr "repo.projects.column.unset_default"}}
114114
</a>
115115
{{end}}

templates/repo/projects/view.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
data-modal-default-project-board-content="{{$.locale.Tr "repo.projects.column.unset_default_desc"}}"
116116
data-type="unset_default"
117117
data-url="{{$.Link}}/{{.ID}}/unsetdefault">
118-
{{svg "octicon-pin"}}
118+
{{svg "octicon-pin-slash"}}
119119
{{$.locale.Tr "repo.projects.column.unset_default"}}
120120
</a>
121121
{{end}}

templates/shared/actions/runner_edit.tmpl

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,25 @@
77
{{template "base/disable_form_autofill"}}
88
{{.CsrfTokenHtml}}
99
<div class="runner-basic-info">
10-
<div class="field gt-dib gt-mr-4 disabled">
10+
<div class="field gt-dib gt-mr-4">
1111
<label>{{.locale.Tr "actions.runners.status"}}</label>
1212
<span class="runner-status-{{if .Runner.IsOnline}}online{{else}}offline{{end}}">{{.Runner.StatusLocaleName $.locale}}</span>
1313
</div>
14-
<div class="field gt-dib gt-mr-4 disabled">
14+
<div class="field gt-dib gt-mr-4">
1515
<label>{{.locale.Tr "actions.runners.last_online"}}</label>
1616
<span>{{if .LastOnline}}{{TimeSinceUnix .LastOnline $.locale}}{{else}}{{$.locale.Tr "never"}}{{end}}</span>
1717
</div>
18-
<div class="field gt-dib gt-mr-4 disabled">
18+
<div class="field gt-dib gt-mr-4">
1919
<label>{{.locale.Tr "actions.runners.agent_labels"}}</label>
2020
<span>
2121
{{range .Runner.AgentLabels}}
2222
<span>{{.}}</span>
2323
{{end}}
2424
</span>
2525
</div>
26-
<div class="field gt-dib gt-mr-4 disabled">
26+
<div class="field gt-dib gt-mr-4">
2727
<label>{{.locale.Tr "actions.runners.owner_type"}}</label>
28-
<span>{{.Runner.OwnType}}</span>
28+
<span data-tooltip-content="{{.Runner.BelongsToOwnerName}}">{{.Runner.BelongsToOwnerType.LocaleString $.locale}}</span>
2929
</div>
3030
</div>
3131

templates/shared/actions/runner_list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
<td>{{.ID}}</td>
6666
<td><p data-tooltip-content="{{.Description}}">{{.Name}}</p></td>
6767
<td>{{if .Version}}{{.Version}}{{else}}{{$.locale.Tr "unknown"}}{{end}}</td>
68-
<td>{{.OwnType}}</td>
68+
<td><span data-tooltip-content="{{.BelongsToOwnerName}}">{{.BelongsToOwnerType.LocaleString $.locale}}<span></td>
6969
<td class="runner-tags">
7070
{{range .AllLabels}}<span class="ui label">{{.}}</span>{{end}}
7171
</td>

templates/user/notification/notification_div.tmpl

+12-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<div role="main" aria-label="{{.Title}}" class="page-content user notification" id="notification_div" data-params="{{.Page.GetParams}}" data-sequence-number="{{.SequenceNumber}}">
22
<div class="ui container">
3-
<h1 class="ui dividing header">{{.locale.Tr "notification.notifications"}}</h1>
3+
<h1 class="ui header gt-df gt-ac">
4+
{{svg "octicon-bell" 28 "gt-mr-3 gt-mt-1"}}
5+
{{.locale.Tr "notification.notifications"}}
6+
</h1>
47
<div class="ui top attached tabular menu">
58
{{$notificationUnreadCount := call .NotificationUnreadCount}}
69
<a href="{{AppSubUrl}}/notifications?q=unread" class="{{if eq .Status 1}}active {{end}}item">
@@ -23,11 +26,14 @@
2326
</div>
2427
<div class="ui bottom attached active tab segment gt-p-3">
2528
{{if eq (len .Notifications) 0}}
26-
{{if eq .Status 1}}
27-
{{.locale.Tr "notification.no_unread"}}
28-
{{else}}
29-
{{.locale.Tr "notification.no_read"}}
30-
{{end}}
29+
<div class="gt-df gt-ac gt-fc gt-p-4">
30+
{{svg "octicon-inbox" 56 "gt-mb-4"}}
31+
{{if eq .Status 1}}
32+
{{.locale.Tr "notification.no_unread"}}
33+
{{else}}
34+
{{.locale.Tr "notification.no_read"}}
35+
{{end}}
36+
</div>
3137
{{else}}
3238
<table class="ui unstackable very compact small table" id="notification_table">
3339
<tbody>

web_src/css/dashboard.css

-4
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,6 @@
171171
border-bottom: 1px solid var(--color-secondary);
172172
}
173173

174-
.feeds .list ul li.private {
175-
background-color: var(--color-box-body-highlight);
176-
}
177-
178174
.feeds .list ul li .repo-list-link {
179175
padding: 6px 1em;
180176
display: block;

web_src/js/components/DashboardRepoList.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
</div>
7171
<div v-if="repos.length" class="ui attached table segment gt-rounded-bottom">
7272
<ul class="repo-owner-name-list">
73-
<li v-for="repo in repos" :class="{'private': repo.private || repo.internal}" :key="repo.id">
73+
<li v-for="repo in repos" :key="repo.id">
7474
<a class="repo-list-link gt-df gt-ac gt-sb" :href="repo.link">
7575
<div class="item-name gt-df gt-ac gt-f1">
7676
<svg-icon :name="repoIcon(repo)" :size="16" class-name="gt-mr-2"/>

0 commit comments

Comments
 (0)