Skip to content

Commit 63a401a

Browse files
HesterGwxiaoguang
andauthored
Move secrets and runners settings to actions settings (go-gitea#24200)
This PR moves the secrets and runners settings to actions settings on all settings(repo,org,user,admin) levels. After this PR, if [ENABLED](https://github.com/go-gitea/gitea/blob/5e7543fcf441afb30aba6188edac754ef32b9ac3/custom/conf/app.example.ini#L2604) inside `app.ini` under `[actions]` is set to `false`, the "Actions" tab (including runners management and secrets management) will not be shown. After, the settings under actions settings for each level: 1. Admin Level "Runners Management" <img width="1437" alt="Screen Shot 2023-04-26 at 14 34 20" src="https://user-images.githubusercontent.com/17645053/234489731-15822d21-38e1-4560-8bbe-69f122376abc.png"> 2. User Level "Secrets Management" <img width="1427" alt="Screen Shot 2023-04-26 at 14 34 30" src="https://user-images.githubusercontent.com/17645053/234489795-68c9c0cb-24f8-4f09-95c6-458ab914c313.png"> 3. Repo and Organization Levels "Runners Management" and "Secrets Management" Org: <img width="1437" alt="Screen Shot 2023-04-26 at 14 35 07" src="https://user-images.githubusercontent.com/17645053/234489996-f3af5ebb-d354-46ca-9087-a0b586845281.png"> <img width="1433" alt="Screen Shot 2023-04-26 at 14 35 14" src="https://user-images.githubusercontent.com/17645053/234490004-3abf8fed-81fd-4ce2-837a-935dade1793d.png"> Repo: <img width="1419" alt="Screen Shot 2023-04-26 at 14 34 50" src="https://user-images.githubusercontent.com/17645053/234489904-80c11038-4b58-462c-9d0b-8b7cf70bc2b3.png"> <img width="1430" alt="Screen Shot 2023-04-26 at 14 34 57" src="https://user-images.githubusercontent.com/17645053/234489918-4e8d1fe2-9bcd-4d8a-96c1-238a8088d92e.png"> It also finished these tasks : - [x] rename routers function "runners" to "actions", and refactor related file names - [x] check and modify part of the runners related functions to match their name - [x] Fix backend check caused by fmt check --------- Co-authored-by: wxiaoguang <[email protected]>
1 parent 6dfc0c8 commit 63a401a

40 files changed

+445
-504
lines changed

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3357,6 +3357,7 @@ deletion = Remove secret
33573357
deletion.description = Removing a secret is permanent and cannot be undone. Continue?
33583358
deletion.success = The secret has been removed.
33593359
deletion.failed = Failed to remove secret.
3360+
management = Secrets Management
33603361
33613362
[actions]
33623363
actions = Actions

routers/web/admin/admin.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ func updateSystemStatus() {
113113
// Dashboard show admin panel dashboard
114114
func Dashboard(ctx *context.Context) {
115115
ctx.Data["Title"] = ctx.Tr("admin.dashboard")
116-
ctx.Data["PageIsAdmin"] = true
117116
ctx.Data["PageIsAdminDashboard"] = true
118117
ctx.Data["Stats"] = activities_model.GetStatistic()
119118
ctx.Data["NeedUpdate"] = updatechecker.GetNeedUpdate()
@@ -129,7 +128,6 @@ func Dashboard(ctx *context.Context) {
129128
func DashboardPost(ctx *context.Context) {
130129
form := web.GetForm(ctx).(*forms.AdminDashboardForm)
131130
ctx.Data["Title"] = ctx.Tr("admin.dashboard")
132-
ctx.Data["PageIsAdmin"] = true
133131
ctx.Data["PageIsAdminDashboard"] = true
134132
ctx.Data["Stats"] = activities_model.GetStatistic()
135133
updateSystemStatus()
@@ -155,7 +153,6 @@ func DashboardPost(ctx *context.Context) {
155153
// Monitor show admin monitor page
156154
func Monitor(ctx *context.Context) {
157155
ctx.Data["Title"] = ctx.Tr("admin.monitor")
158-
ctx.Data["PageIsAdmin"] = true
159156
ctx.Data["PageIsAdminMonitor"] = true
160157
ctx.Data["Processes"], ctx.Data["ProcessCount"] = process.GetManager().Processes(false, true)
161158
ctx.Data["Entries"] = cron.ListTasks()
@@ -167,7 +164,6 @@ func Monitor(ctx *context.Context) {
167164
// GoroutineStacktrace show admin monitor goroutines page
168165
func GoroutineStacktrace(ctx *context.Context) {
169166
ctx.Data["Title"] = ctx.Tr("admin.monitor")
170-
ctx.Data["PageIsAdmin"] = true
171167
ctx.Data["PageIsAdminMonitor"] = true
172168

173169
processStacks, processCount, goroutineCount, err := process.GetManager().ProcessStacktraces(false, false)
@@ -202,7 +198,6 @@ func Queue(ctx *context.Context) {
202198
return
203199
}
204200
ctx.Data["Title"] = ctx.Tr("admin.monitor.queue", mq.Name)
205-
ctx.Data["PageIsAdmin"] = true
206201
ctx.Data["PageIsAdminMonitor"] = true
207202
ctx.Data["Queue"] = mq
208203
ctx.HTML(http.StatusOK, tplQueue)

routers/web/admin/applications.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ func newOAuth2CommonHandlers() *user_setting.OAuth2CommonHandlers {
3131
// Applications render org applications page (for org, at the moment, there are only OAuth2 applications)
3232
func Applications(ctx *context.Context) {
3333
ctx.Data["Title"] = ctx.Tr("settings.applications")
34-
ctx.Data["PageIsAdmin"] = true
3534
ctx.Data["PageIsAdminApplications"] = true
3635

3736
apps, err := auth.GetOAuth2ApplicationsByUserID(ctx, 0)
@@ -47,7 +46,6 @@ func Applications(ctx *context.Context) {
4746
// ApplicationsPost response for adding an oauth2 application
4847
func ApplicationsPost(ctx *context.Context) {
4948
ctx.Data["Title"] = ctx.Tr("settings.applications")
50-
ctx.Data["PageIsAdmin"] = true
5149
ctx.Data["PageIsAdminApplications"] = true
5250

5351
oa := newOAuth2CommonHandlers()
@@ -56,7 +54,6 @@ func ApplicationsPost(ctx *context.Context) {
5654

5755
// EditApplication displays the given application
5856
func EditApplication(ctx *context.Context) {
59-
ctx.Data["PageIsAdmin"] = true
6057
ctx.Data["PageIsAdminApplications"] = true
6158

6259
oa := newOAuth2CommonHandlers()
@@ -66,7 +63,6 @@ func EditApplication(ctx *context.Context) {
6663
// EditApplicationPost response for editing oauth2 application
6764
func EditApplicationPost(ctx *context.Context) {
6865
ctx.Data["Title"] = ctx.Tr("settings.applications")
69-
ctx.Data["PageIsAdmin"] = true
7066
ctx.Data["PageIsAdminApplications"] = true
7167

7268
oa := newOAuth2CommonHandlers()
@@ -76,7 +72,6 @@ func EditApplicationPost(ctx *context.Context) {
7672
// ApplicationsRegenerateSecret handles the post request for regenerating the secret
7773
func ApplicationsRegenerateSecret(ctx *context.Context) {
7874
ctx.Data["Title"] = ctx.Tr("settings")
79-
ctx.Data["PageIsAdmin"] = true
8075
ctx.Data["PageIsAdminApplications"] = true
8176

8277
oa := newOAuth2CommonHandlers()

routers/web/admin/auths.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ var (
4545
// Authentications show authentication config page
4646
func Authentications(ctx *context.Context) {
4747
ctx.Data["Title"] = ctx.Tr("admin.authentication")
48-
ctx.Data["PageIsAdmin"] = true
4948
ctx.Data["PageIsAdminAuthentications"] = true
5049

5150
var err error
@@ -89,7 +88,6 @@ var (
8988
// NewAuthSource render adding a new auth source page
9089
func NewAuthSource(ctx *context.Context) {
9190
ctx.Data["Title"] = ctx.Tr("admin.auths.new")
92-
ctx.Data["PageIsAdmin"] = true
9391
ctx.Data["PageIsAdminAuthentications"] = true
9492

9593
ctx.Data["type"] = auth.LDAP.Int()
@@ -237,7 +235,6 @@ func parseSSPIConfig(ctx *context.Context, form forms.AuthenticationForm) (*sspi
237235
func NewAuthSourcePost(ctx *context.Context) {
238236
form := *web.GetForm(ctx).(*forms.AuthenticationForm)
239237
ctx.Data["Title"] = ctx.Tr("admin.auths.new")
240-
ctx.Data["PageIsAdmin"] = true
241238
ctx.Data["PageIsAdminAuthentications"] = true
242239

243240
ctx.Data["CurrentTypeName"] = auth.Type(form.Type).String()
@@ -333,7 +330,6 @@ func NewAuthSourcePost(ctx *context.Context) {
333330
// EditAuthSource render editing auth source page
334331
func EditAuthSource(ctx *context.Context) {
335332
ctx.Data["Title"] = ctx.Tr("admin.auths.edit")
336-
ctx.Data["PageIsAdmin"] = true
337333
ctx.Data["PageIsAdminAuthentications"] = true
338334

339335
ctx.Data["SecurityProtocols"] = securityProtocols
@@ -369,7 +365,6 @@ func EditAuthSource(ctx *context.Context) {
369365
func EditAuthSourcePost(ctx *context.Context) {
370366
form := *web.GetForm(ctx).(*forms.AuthenticationForm)
371367
ctx.Data["Title"] = ctx.Tr("admin.auths.edit")
372-
ctx.Data["PageIsAdmin"] = true
373368
ctx.Data["PageIsAdminAuthentications"] = true
374369

375370
ctx.Data["SMTPAuths"] = smtp.Authenticators

routers/web/admin/config.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ func shadowPassword(provider, cfgItem string) string {
100100
// Config show admin config page
101101
func Config(ctx *context.Context) {
102102
ctx.Data["Title"] = ctx.Tr("admin.config")
103-
ctx.Data["PageIsAdmin"] = true
104103
ctx.Data["PageIsAdminConfig"] = true
105104

106105
systemSettings, err := system_model.GetAllSettings(ctx)

routers/web/admin/emails.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const (
2424
// Emails show all emails
2525
func Emails(ctx *context.Context) {
2626
ctx.Data["Title"] = ctx.Tr("admin.emails")
27-
ctx.Data["PageIsAdmin"] = true
2827
ctx.Data["PageIsAdminEmails"] = true
2928

3029
opts := &user_model.SearchEmailOptions{

routers/web/admin/notice.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const (
2222
// Notices show notices for admin
2323
func Notices(ctx *context.Context) {
2424
ctx.Data["Title"] = ctx.Tr("admin.notices")
25-
ctx.Data["PageIsAdmin"] = true
2625
ctx.Data["PageIsAdminNotices"] = true
2726

2827
total := system_model.CountNotices()

routers/web/admin/orgs.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const (
2121
// Organizations show all the organizations
2222
func Organizations(ctx *context.Context) {
2323
ctx.Data["Title"] = ctx.Tr("admin.organizations")
24-
ctx.Data["PageIsAdmin"] = true
2524
ctx.Data["PageIsAdminOrganizations"] = true
2625

2726
explore.RenderUserSearch(ctx, &user_model.SearchUserOptions{

routers/web/admin/packages.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ func Packages(ctx *context.Context) {
6464
}
6565

6666
ctx.Data["Title"] = ctx.Tr("packages.title")
67-
ctx.Data["PageIsAdmin"] = true
6867
ctx.Data["PageIsAdminPackages"] = true
6968
ctx.Data["Query"] = query
7069
ctx.Data["PackageType"] = packageType

routers/web/admin/repos.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const (
2929
// Repos show all the repositories
3030
func Repos(ctx *context.Context) {
3131
ctx.Data["Title"] = ctx.Tr("admin.repositories")
32-
ctx.Data["PageIsAdmin"] = true
3332
ctx.Data["PageIsAdminRepositories"] = true
3433

3534
explore.RenderRepoSearch(ctx, &explore.RepoSearchOptions{
@@ -67,7 +66,6 @@ func DeleteRepo(ctx *context.Context) {
6766
// UnadoptedRepos lists the unadopted repositories
6867
func UnadoptedRepos(ctx *context.Context) {
6968
ctx.Data["Title"] = ctx.Tr("admin.repositories")
70-
ctx.Data["PageIsAdmin"] = true
7169
ctx.Data["PageIsAdminRepositories"] = true
7270

7371
opts := db.ListOptions{

0 commit comments

Comments
 (0)