deletion.description = Removing a secret is permanent and cannot be undone. Continue?
deletion.success = The secret has been removed.
deletion.failed = Failed to remove secret.
+management = Secrets Management
[actions]
actions = Actions
// Dashboard show admin panel dashboard
func Dashboard(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.dashboard")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminDashboard"] = true
ctx.Data["Stats"] = activities_model.GetStatistic()
ctx.Data["NeedUpdate"] = updatechecker.GetNeedUpdate()
func DashboardPost(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.AdminDashboardForm)
ctx.Data["Title"] = ctx.Tr("admin.dashboard")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminDashboard"] = true
ctx.Data["Stats"] = activities_model.GetStatistic()
updateSystemStatus()
// Monitor show admin monitor page
func Monitor(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.monitor")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminMonitor"] = true
ctx.Data["Processes"], ctx.Data["ProcessCount"] = process.GetManager().Processes(false, true)
ctx.Data["Entries"] = cron.ListTasks()
// GoroutineStacktrace show admin monitor goroutines page
func GoroutineStacktrace(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.monitor")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminMonitor"] = true
processStacks, processCount, goroutineCount, err := process.GetManager().ProcessStacktraces(false, false)
return
}
ctx.Data["Title"] = ctx.Tr("admin.monitor.queue", mq.Name)
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminMonitor"] = true
ctx.Data["Queue"] = mq
ctx.HTML(http.StatusOK, tplQueue)
// Applications render org applications page (for org, at the moment, there are only OAuth2 applications)
func Applications(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings.applications")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminApplications"] = true
apps, err := auth.GetOAuth2ApplicationsByUserID(ctx, 0)
// ApplicationsPost response for adding an oauth2 application
func ApplicationsPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings.applications")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminApplications"] = true
oa := newOAuth2CommonHandlers()
// EditApplication displays the given application
func EditApplication(ctx *context.Context) {
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminApplications"] = true
oa := newOAuth2CommonHandlers()
// EditApplicationPost response for editing oauth2 application
func EditApplicationPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings.applications")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminApplications"] = true
oa := newOAuth2CommonHandlers()
// ApplicationsRegenerateSecret handles the post request for regenerating the secret
func ApplicationsRegenerateSecret(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminApplications"] = true
oa := newOAuth2CommonHandlers()
// Authentications show authentication config page
func Authentications(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.authentication")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminAuthentications"] = true
var err error
// NewAuthSource render adding a new auth source page
func NewAuthSource(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.auths.new")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminAuthentications"] = true
ctx.Data["type"] = auth.LDAP.Int()
func NewAuthSourcePost(ctx *context.Context) {
form := *web.GetForm(ctx).(*forms.AuthenticationForm)
ctx.Data["Title"] = ctx.Tr("admin.auths.new")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminAuthentications"] = true
ctx.Data["CurrentTypeName"] = auth.Type(form.Type).String()
// EditAuthSource render editing auth source page
func EditAuthSource(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.auths.edit")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminAuthentications"] = true
ctx.Data["SecurityProtocols"] = securityProtocols
func EditAuthSourcePost(ctx *context.Context) {
form := *web.GetForm(ctx).(*forms.AuthenticationForm)
ctx.Data["Title"] = ctx.Tr("admin.auths.edit")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminAuthentications"] = true
ctx.Data["SMTPAuths"] = smtp.Authenticators
// Config show admin config page
func Config(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.config")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminConfig"] = true
systemSettings, err := system_model.GetAllSettings(ctx)
// Emails show all emails
func Emails(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.emails")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminEmails"] = true
opts := &user_model.SearchEmailOptions{
// Notices show notices for admin
func Notices(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.notices")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminNotices"] = true
total := system_model.CountNotices()
// Organizations show all the organizations
func Organizations(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.organizations")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminOrganizations"] = true
explore.RenderUserSearch(ctx, &user_model.SearchUserOptions{
}
ctx.Data["Title"] = ctx.Tr("packages.title")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminPackages"] = true
ctx.Data["Query"] = query
ctx.Data["PackageType"] = packageType
// Repos show all the repositories
func Repos(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.repositories")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminRepositories"] = true
explore.RenderRepoSearch(ctx, &explore.RepoSearchOptions{
// UnadoptedRepos lists the unadopted repositories
func UnadoptedRepos(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.repositories")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminRepositories"] = true
opts := db.ListOptions{
package admin
import (
- "net/url"
-
- actions_model "code.gitea.io/gitea/models/actions"
- "code.gitea.io/gitea/models/db"
- "code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
- actions_shared "code.gitea.io/gitea/routers/web/shared/actions"
-)
-
-const (
- tplRunners base.TplName = "admin/runners/base"
- tplRunnerEdit base.TplName = "admin/runners/edit"
)
-// Runners show all the runners
-func Runners(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("actions.runners")
- ctx.Data["PageIsAdmin"] = true
- ctx.Data["PageIsAdminRunners"] = true
-
- page := ctx.FormInt("page")
- if page <= 1 {
- page = 1
- }
-
- opts := actions_model.FindRunnerOptions{
- ListOptions: db.ListOptions{
- Page: page,
- PageSize: 100,
- },
- Sort: ctx.Req.URL.Query().Get("sort"),
- Filter: ctx.Req.URL.Query().Get("q"),
- }
-
- actions_shared.RunnersList(ctx, tplRunners, opts)
-}
-
-// EditRunner show editing runner page
-func EditRunner(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("actions.runners.edit_runner")
- ctx.Data["PageIsAdmin"] = true
- ctx.Data["PageIsAdminRunners"] = true
-
- page := ctx.FormInt("page")
- if page <= 1 {
- page = 1
- }
-
- actions_shared.RunnerDetails(ctx, tplRunnerEdit, page, ctx.ParamsInt64(":runnerid"), 0, 0)
-}
-
-// EditRunnerPost response for editing runner
-func EditRunnerPost(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("actions.runners.edit")
- ctx.Data["PageIsAdmin"] = true
- ctx.Data["PageIsAdminRunners"] = true
- actions_shared.RunnerDetailsEditPost(ctx, ctx.ParamsInt64(":runnerid"), 0, 0,
- setting.AppSubURL+"/admin/runners/"+url.PathEscape(ctx.Params(":runnerid")))
-}
-
-// DeleteRunnerPost response for deleting a runner
-func DeleteRunnerPost(ctx *context.Context) {
- actions_shared.RunnerDeletePost(ctx, ctx.ParamsInt64(":runnerid"),
- setting.AppSubURL+"/admin/runners/",
- setting.AppSubURL+"/admin/runners/"+url.PathEscape(ctx.Params(":runnerid")),
- )
-}
-
-func ResetRunnerRegistrationToken(ctx *context.Context) {
- actions_shared.RunnerResetRegistrationToken(ctx, 0, 0, setting.AppSubURL+"/admin/runners/")
+func RedirectToDefaultSetting(ctx *context.Context) {
+ ctx.Redirect(setting.AppSubURL + "/admin/actions/runners")
}
// Users show all the users
func Users(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.users")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminUsers"] = true
extraParamStrings := map[string]string{}
// NewUser render adding a new user page
func NewUser(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.users.new_account")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminUsers"] = true
ctx.Data["DefaultUserVisibilityMode"] = setting.Service.DefaultUserVisibilityMode
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()
func NewUserPost(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.AdminCreateUserForm)
ctx.Data["Title"] = ctx.Tr("admin.users.new_account")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminUsers"] = true
ctx.Data["DefaultUserVisibilityMode"] = setting.Service.DefaultUserVisibilityMode
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()
// EditUser show editing user page
func EditUser(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.users.edit_account")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminUsers"] = true
ctx.Data["DisableRegularOrgCreation"] = setting.Admin.DisableRegularOrgCreation
ctx.Data["DisableMigrations"] = setting.Repository.DisableMigrations
func EditUserPost(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.AdminEditUserForm)
ctx.Data["Title"] = ctx.Tr("admin.users.edit_account")
- ctx.Data["PageIsAdmin"] = true
ctx.Data["PageIsAdminUsers"] = true
ctx.Data["DisableMigrations"] = setting.Repository.DisableMigrations
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()
+++ /dev/null
-// Copyright 2022 The Gitea Authors. All rights reserved.
-// SPDX-License-Identifier: MIT
-
-package org
-
-import (
- "net/url"
-
- actions_model "code.gitea.io/gitea/models/actions"
- "code.gitea.io/gitea/models/db"
- "code.gitea.io/gitea/modules/context"
- actions_shared "code.gitea.io/gitea/routers/web/shared/actions"
-)
-
-// Runners render runners page
-func Runners(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("org.runners")
- ctx.Data["PageIsOrgSettings"] = true
- ctx.Data["PageIsOrgSettingsRunners"] = true
-
- page := ctx.FormInt("page")
- if page <= 1 {
- page = 1
- }
-
- opts := actions_model.FindRunnerOptions{
- ListOptions: db.ListOptions{
- Page: page,
- PageSize: 100,
- },
- Sort: ctx.Req.URL.Query().Get("sort"),
- Filter: ctx.Req.URL.Query().Get("q"),
- OwnerID: ctx.Org.Organization.ID,
- WithAvailable: true,
- }
-
- actions_shared.RunnersList(ctx, tplSettingsRunners, opts)
-}
-
-// ResetRunnerRegistrationToken reset runner registration token
-func ResetRunnerRegistrationToken(ctx *context.Context) {
- actions_shared.RunnerResetRegistrationToken(ctx,
- ctx.Org.Organization.ID, 0,
- ctx.Org.OrgLink+"/settings/runners")
-}
-
-// RunnersEdit render runner edit page
-func RunnersEdit(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("org.runners.edit")
- ctx.Data["PageIsOrgSettings"] = true
- ctx.Data["PageIsOrgSettingsRunners"] = true
- page := ctx.FormInt("page")
- if page <= 1 {
- page = 1
- }
-
- actions_shared.RunnerDetails(ctx, tplSettingsRunnersEdit, page,
- ctx.ParamsInt64(":runnerid"), ctx.Org.Organization.ID, 0,
- )
-}
-
-// RunnersEditPost response for editing runner
-func RunnersEditPost(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("org.runners.edit")
- ctx.Data["PageIsOrgSettings"] = true
- ctx.Data["PageIsOrgSettingsRunners"] = true
- actions_shared.RunnerDetailsEditPost(ctx, ctx.ParamsInt64(":runnerid"),
- ctx.Org.Organization.ID, 0,
- ctx.Org.OrgLink+"/settings/runners/"+url.PathEscape(ctx.Params(":runnerid")))
-}
-
-// RunnerDeletePost response for deleting runner
-func RunnerDeletePost(ctx *context.Context) {
- actions_shared.RunnerDeletePost(ctx,
- ctx.ParamsInt64(":runnerid"),
- ctx.Org.OrgLink+"/settings/runners",
- ctx.Org.OrgLink+"/settings/runners/"+url.PathEscape(ctx.Params(":runnerid")))
-}
tplSettingsHooks base.TplName = "org/settings/hooks"
// tplSettingsLabels template path for render labels settings
tplSettingsLabels base.TplName = "org/settings/labels"
- // tplSettingsRunners template path for render runners settings
- tplSettingsRunners base.TplName = "org/settings/runners"
- // tplSettingsRunnersEdit template path for render runners edit settings
- tplSettingsRunnersEdit base.TplName = "org/settings/runners_edit"
)
// Settings render the main settings page
--- /dev/null
+// Copyright 2022 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package setting
+
+import (
+ "code.gitea.io/gitea/modules/context"
+)
+
+func RedirectToDefaultSetting(ctx *context.Context) {
+ ctx.Redirect(ctx.Org.OrgLink + "/settings/actions/runners")
+}
+++ /dev/null
-// Copyright 2022 The Gitea Authors. All rights reserved.
-// SPDX-License-Identifier: MIT
-
-package org
-
-import (
- "net/http"
-
- "code.gitea.io/gitea/modules/base"
- "code.gitea.io/gitea/modules/context"
- shared "code.gitea.io/gitea/routers/web/shared/secrets"
-)
-
-const (
- tplSettingsSecrets base.TplName = "org/settings/secrets"
-)
-
-// Secrets render organization secrets page
-func Secrets(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("secrets.secrets")
- ctx.Data["PageIsOrgSettings"] = true
- ctx.Data["PageIsOrgSettingsSecrets"] = true
-
- shared.SetSecretsContext(ctx, ctx.ContextUser.ID, 0)
- if ctx.Written() {
- return
- }
-
- ctx.HTML(http.StatusOK, tplSettingsSecrets)
-}
-
-// SecretsPost add secrets
-func SecretsPost(ctx *context.Context) {
- shared.PerformSecretsPost(
- ctx,
- ctx.ContextUser.ID,
- 0,
- ctx.Org.OrgLink+"/settings/secrets",
- )
-}
-
-// SecretsDelete delete secrets
-func SecretsDelete(ctx *context.Context) {
- shared.PerformSecretsDelete(
- ctx,
- ctx.ContextUser.ID,
- 0,
- ctx.Org.OrgLink+"/settings/secrets",
- )
-}
+++ /dev/null
-// Copyright 2022 The Gitea Authors. All rights reserved.
-// SPDX-License-Identifier: MIT
-
-package repo
-
-import (
- "net/url"
-
- actions_model "code.gitea.io/gitea/models/actions"
- "code.gitea.io/gitea/models/db"
- "code.gitea.io/gitea/modules/context"
- actions_shared "code.gitea.io/gitea/routers/web/shared/actions"
-)
-
-const (
- tplRunners = "repo/settings/runners"
- tplRunnerEdit = "repo/settings/runner_edit"
-)
-
-// Runners render runners page
-func Runners(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("actions.runners")
- ctx.Data["PageIsSettingsRunners"] = true
-
- page := ctx.FormInt("page")
- if page <= 1 {
- page = 1
- }
-
- opts := actions_model.FindRunnerOptions{
- ListOptions: db.ListOptions{
- Page: page,
- PageSize: 100,
- },
- Sort: ctx.Req.URL.Query().Get("sort"),
- Filter: ctx.Req.URL.Query().Get("q"),
- RepoID: ctx.Repo.Repository.ID,
- WithAvailable: true,
- }
-
- actions_shared.RunnersList(ctx, tplRunners, opts)
-}
-
-func RunnersEdit(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("actions.runners")
- ctx.Data["PageIsSettingsRunners"] = true
- page := ctx.FormInt("page")
- if page <= 1 {
- page = 1
- }
-
- actions_shared.RunnerDetails(ctx, tplRunnerEdit, page,
- ctx.ParamsInt64(":runnerid"), 0, ctx.Repo.Repository.ID,
- )
-}
-
-func RunnersEditPost(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("actions.runners")
- ctx.Data["PageIsSettingsRunners"] = true
- actions_shared.RunnerDetailsEditPost(ctx, ctx.ParamsInt64(":runnerid"),
- 0, ctx.Repo.Repository.ID,
- ctx.Repo.RepoLink+"/settings/runners/"+url.PathEscape(ctx.Params(":runnerid")))
-}
-
-func ResetRunnerRegistrationToken(ctx *context.Context) {
- actions_shared.RunnerResetRegistrationToken(ctx,
- 0, ctx.Repo.Repository.ID,
- ctx.Repo.RepoLink+"/settings/runners")
-}
-
-// RunnerDeletePost response for deleting runner
-func RunnerDeletePost(ctx *context.Context) {
- actions_shared.RunnerDeletePost(ctx, ctx.ParamsInt64(":runnerid"),
- ctx.Repo.RepoLink+"/settings/runners",
- ctx.Repo.RepoLink+"/settings/runners/"+url.PathEscape(ctx.Params(":runnerid")))
-}
--- /dev/null
+// Copyright 2022 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package setting
+
+import (
+ "errors"
+ "net/http"
+ "net/url"
+
+ actions_model "code.gitea.io/gitea/models/actions"
+ "code.gitea.io/gitea/models/db"
+ "code.gitea.io/gitea/modules/base"
+ "code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/setting"
+ actions_shared "code.gitea.io/gitea/routers/web/shared/actions"
+)
+
+const (
+ // TODO: Separate secrets from runners when layout is ready
+ tplRepoRunners base.TplName = "repo/settings/actions"
+ tplOrgRunners base.TplName = "org/settings/actions"
+ tplAdminRunners base.TplName = "admin/actions"
+ tplRepoRunnerEdit base.TplName = "repo/settings/runner_edit"
+ tplOrgRunnerEdit base.TplName = "org/settings/runners_edit"
+ tplAdminRunnerEdit base.TplName = "admin/runners/edit"
+)
+
+type runnersCtx struct {
+ OwnerID int64
+ RepoID int64
+ IsRepo bool
+ IsOrg bool
+ IsAdmin bool
+ RunnersTemplate base.TplName
+ RunnerEditTemplate base.TplName
+ RedirectLink string
+}
+
+func getRunnersCtx(ctx *context.Context) (*runnersCtx, error) {
+ if ctx.Data["PageIsRepoSettings"] == true {
+ return &runnersCtx{
+ RepoID: ctx.Repo.Repository.ID,
+ OwnerID: 0,
+ IsRepo: true,
+ RunnersTemplate: tplRepoRunners,
+ RunnerEditTemplate: tplRepoRunnerEdit,
+ RedirectLink: ctx.Repo.RepoLink + "/settings/actions/runners/",
+ }, nil
+ }
+
+ if ctx.Data["PageIsOrgSettings"] == true {
+ return &runnersCtx{
+ RepoID: 0,
+ OwnerID: ctx.Org.Organization.ID,
+ IsOrg: true,
+ RunnersTemplate: tplOrgRunners,
+ RunnerEditTemplate: tplOrgRunnerEdit,
+ RedirectLink: ctx.Org.OrgLink + "/settings/actions/runners/",
+ }, nil
+ }
+
+ if ctx.Data["PageIsAdmin"] == true {
+ return &runnersCtx{
+ RepoID: 0,
+ OwnerID: 0,
+ IsAdmin: true,
+ RunnersTemplate: tplAdminRunners,
+ RunnerEditTemplate: tplAdminRunnerEdit,
+ RedirectLink: setting.AppSubURL + "/admin/actions/runners/",
+ }, nil
+ }
+
+ return nil, errors.New("unable to set Runners context")
+}
+
+// Runners render settings/actions/runners page for repo level
+func Runners(ctx *context.Context) {
+ ctx.Data["PageIsSharedSettingsRunners"] = true
+ ctx.Data["Title"] = ctx.Tr("actions.actions")
+ ctx.Data["PageType"] = "runners"
+
+ rCtx, err := getRunnersCtx(ctx)
+ if err != nil {
+ ctx.ServerError("getRunnersCtx", err)
+ return
+ }
+
+ page := ctx.FormInt("page")
+ if page <= 1 {
+ page = 1
+ }
+
+ opts := actions_model.FindRunnerOptions{
+ ListOptions: db.ListOptions{
+ Page: page,
+ PageSize: 100,
+ },
+ Sort: ctx.Req.URL.Query().Get("sort"),
+ Filter: ctx.Req.URL.Query().Get("q"),
+ }
+ if rCtx.IsRepo {
+ opts.RepoID = rCtx.RepoID
+ opts.WithAvailable = true
+ } else if rCtx.IsOrg {
+ opts.OwnerID = rCtx.OwnerID
+ opts.WithAvailable = true
+ }
+ actions_shared.RunnersList(ctx, opts)
+
+ ctx.HTML(http.StatusOK, rCtx.RunnersTemplate)
+}
+
+// RunnersEdit renders runner edit page for repository level
+func RunnersEdit(ctx *context.Context) {
+ ctx.Data["PageIsSharedSettingsRunners"] = true
+ ctx.Data["Title"] = ctx.Tr("actions.runners.edit_runner")
+ rCtx, err := getRunnersCtx(ctx)
+ if err != nil {
+ ctx.ServerError("getRunnersCtx", err)
+ return
+ }
+
+ page := ctx.FormInt("page")
+ if page <= 1 {
+ page = 1
+ }
+
+ actions_shared.RunnerDetails(ctx, page,
+ ctx.ParamsInt64(":runnerid"), rCtx.OwnerID, rCtx.RepoID,
+ )
+ ctx.HTML(http.StatusOK, rCtx.RunnerEditTemplate)
+}
+
+func RunnersEditPost(ctx *context.Context) {
+ rCtx, err := getRunnersCtx(ctx)
+ if err != nil {
+ ctx.ServerError("getRunnersCtx", err)
+ return
+ }
+ actions_shared.RunnerDetailsEditPost(ctx, ctx.ParamsInt64(":runnerid"),
+ rCtx.OwnerID, rCtx.RepoID,
+ rCtx.RedirectLink+url.PathEscape(ctx.Params(":runnerid")))
+}
+
+func ResetRunnerRegistrationToken(ctx *context.Context) {
+ rCtx, err := getRunnersCtx(ctx)
+ if err != nil {
+ ctx.ServerError("getRunnersCtx", err)
+ return
+ }
+ actions_shared.RunnerResetRegistrationToken(ctx, rCtx.OwnerID, rCtx.RepoID, rCtx.RedirectLink)
+}
+
+// RunnerDeletePost response for deleting runner
+func RunnerDeletePost(ctx *context.Context) {
+ rCtx, err := getRunnersCtx(ctx)
+ if err != nil {
+ ctx.ServerError("getRunnersCtx", err)
+ return
+ }
+ actions_shared.RunnerDeletePost(ctx, ctx.ParamsInt64(":runnerid"), rCtx.RedirectLink, rCtx.RedirectLink+url.PathEscape(ctx.Params(":runnerid")))
+}
+
+func RedirectToDefaultSetting(ctx *context.Context) {
+ ctx.Redirect(ctx.Repo.RepoLink + "/settings/actions/runners")
+}
--- /dev/null
+// Copyright 2022 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package setting
+
+import (
+ "errors"
+ "net/http"
+
+ "code.gitea.io/gitea/modules/base"
+ "code.gitea.io/gitea/modules/context"
+ "code.gitea.io/gitea/modules/setting"
+ shared "code.gitea.io/gitea/routers/web/shared/secrets"
+)
+
+const (
+ // TODO: Separate secrets from runners when layout is ready
+ tplRepoSecrets base.TplName = "repo/settings/actions"
+ tplOrgSecrets base.TplName = "org/settings/actions"
+ tplUserSecrets base.TplName = "user/settings/actions"
+)
+
+type secretsCtx struct {
+ OwnerID int64
+ RepoID int64
+ IsRepo bool
+ IsOrg bool
+ IsUser bool
+ SecretsTemplate base.TplName
+ RedirectLink string
+}
+
+func getSecretsCtx(ctx *context.Context) (*secretsCtx, error) {
+ if ctx.Data["PageIsRepoSettings"] == true {
+ return &secretsCtx{
+ OwnerID: 0,
+ RepoID: ctx.Repo.Repository.ID,
+ IsRepo: true,
+ SecretsTemplate: tplRepoSecrets,
+ RedirectLink: ctx.Repo.RepoLink + "/settings/actions/secrets",
+ }, nil
+ }
+
+ if ctx.Data["PageIsOrgSettings"] == true {
+ return &secretsCtx{
+ OwnerID: ctx.ContextUser.ID,
+ RepoID: 0,
+ IsOrg: true,
+ SecretsTemplate: tplOrgSecrets,
+ RedirectLink: ctx.Org.OrgLink + "/settings/actions/secrets",
+ }, nil
+ }
+
+ if ctx.Data["PageIsUserSettings"] == true {
+ return &secretsCtx{
+ OwnerID: ctx.Doer.ID,
+ RepoID: 0,
+ IsUser: true,
+ SecretsTemplate: tplUserSecrets,
+ RedirectLink: setting.AppSubURL + "/user/settings/actions/secrets",
+ }, nil
+ }
+
+ return nil, errors.New("unable to set Secrets context")
+}
+
+func Secrets(ctx *context.Context) {
+ ctx.Data["Title"] = ctx.Tr("actions.actions")
+ ctx.Data["PageType"] = "secrets"
+ ctx.Data["PageIsSharedSettingsSecrets"] = true
+
+ sCtx, err := getSecretsCtx(ctx)
+ if err != nil {
+ ctx.ServerError("getSecretsCtx", err)
+ return
+ }
+
+ if sCtx.IsRepo {
+ ctx.Data["DisableSSH"] = setting.SSH.Disabled
+ }
+
+ shared.SetSecretsContext(ctx, sCtx.OwnerID, sCtx.RepoID)
+ if ctx.Written() {
+ return
+ }
+ ctx.HTML(http.StatusOK, sCtx.SecretsTemplate)
+}
+
+func SecretsPost(ctx *context.Context) {
+ sCtx, err := getSecretsCtx(ctx)
+ if err != nil {
+ ctx.ServerError("getSecretsCtx", err)
+ return
+ }
+ shared.PerformSecretsPost(
+ ctx,
+ sCtx.OwnerID,
+ sCtx.RepoID,
+ sCtx.RedirectLink,
+ )
+}
+
+func SecretsDelete(ctx *context.Context) {
+ sCtx, err := getSecretsCtx(ctx)
+ if err != nil {
+ ctx.ServerError("getSecretsCtx", err)
+ return
+ }
+ shared.PerformSecretsDelete(
+ ctx,
+ sCtx.OwnerID,
+ sCtx.RepoID,
+ sCtx.RedirectLink,
+ )
+}
+++ /dev/null
-// Copyright 2022 The Gitea Authors. All rights reserved.
-// SPDX-License-Identifier: MIT
-
-package repo
-
-import (
- "net/http"
-
- "code.gitea.io/gitea/modules/base"
- "code.gitea.io/gitea/modules/context"
- "code.gitea.io/gitea/modules/setting"
- shared "code.gitea.io/gitea/routers/web/shared/secrets"
-)
-
-const (
- tplSecrets base.TplName = "repo/settings/secrets"
-)
-
-func Secrets(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("secrets.secrets")
- ctx.Data["PageIsSettingsSecrets"] = true
- ctx.Data["DisableSSH"] = setting.SSH.Disabled
-
- shared.SetSecretsContext(ctx, 0, ctx.Repo.Repository.ID)
- if ctx.Written() {
- return
- }
-
- ctx.HTML(http.StatusOK, tplSecrets)
-}
-
-func SecretsPost(ctx *context.Context) {
- shared.PerformSecretsPost(
- ctx,
- 0,
- ctx.Repo.Repository.ID,
- ctx.Repo.RepoLink+"/settings/secrets",
- )
-}
-
-func DeleteSecret(ctx *context.Context) {
- shared.PerformSecretsDelete(
- ctx,
- 0,
- ctx.Repo.Repository.ID,
- ctx.Repo.RepoLink+"/settings/secrets",
- )
-}
// getOwnerRepoCtx determines whether this is a repo, owner, or admin (both default and system) context.
func getOwnerRepoCtx(ctx *context.Context) (*ownerRepoCtx, error) {
- if is, ok := ctx.Data["IsRepositoryWebhook"]; ok && is.(bool) {
+ if ctx.Data["PageIsRepoSettings"] == true {
return &ownerRepoCtx{
RepoID: ctx.Repo.Repository.ID,
Link: path.Join(ctx.Repo.RepoLink, "settings/hooks"),
}, nil
}
- if is, ok := ctx.Data["IsOrganizationWebhook"]; ok && is.(bool) {
+ if ctx.Data["PageIsOrgSettings"] == true {
return &ownerRepoCtx{
OwnerID: ctx.ContextUser.ID,
Link: path.Join(ctx.Org.OrgLink, "settings/hooks"),
}, nil
}
- if is, ok := ctx.Data["IsUserWebhook"]; ok && is.(bool) {
+ if ctx.Data["PageIsUserSettings"] == true {
return &ownerRepoCtx{
OwnerID: ctx.Doer.ID,
Link: path.Join(setting.AppSubURL, "/user/settings/hooks"),
}, nil
}
- if ctx.Doer.IsAdmin {
+ if ctx.Data["PageIsAdmin"] == true {
return &ownerRepoCtx{
IsAdmin: true,
IsSystemWebhook: ctx.Params(":configType") == "system-hooks",
actions_model "code.gitea.io/gitea/models/actions"
"code.gitea.io/gitea/models/db"
- "code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/services/forms"
)
-// RunnersList render common runners list page
-func RunnersList(ctx *context.Context, tplName base.TplName, opts actions_model.FindRunnerOptions) {
+// RunnersList prepares data for runners list
+func RunnersList(ctx *context.Context, opts actions_model.FindRunnerOptions) {
count, err := actions_model.CountRunners(ctx, opts)
if err != nil {
ctx.ServerError("CountRunners", err)
ctx.Data["RunnerRepoID"] = opts.RepoID
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
- ctx.Data["Page"] = pager
- ctx.HTML(http.StatusOK, tplName)
+ ctx.Data["Page"] = pager
}
-// RunnerDetails render runner details page
-func RunnerDetails(ctx *context.Context, tplName base.TplName, page int, runnerID, ownerID, repoID int64) {
+// RunnerDetails prepares data for runners edit page
+func RunnerDetails(ctx *context.Context, page int, runnerID, ownerID, repoID int64) {
runner, err := actions_model.GetRunnerByID(ctx, runnerID)
if err != nil {
ctx.ServerError("GetRunnerByID", err)
ctx.Data["Tasks"] = tasks
pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)
ctx.Data["Page"] = pager
-
- ctx.HTML(http.StatusOK, tplName)
}
// RunnerDetailsEditPost response for edit runner details
package setting
import (
- "net/http"
-
- "code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/setting"
- shared "code.gitea.io/gitea/routers/web/shared/secrets"
-)
-
-const (
- tplSettingsSecrets base.TplName = "user/settings/secrets"
)
-func Secrets(ctx *context.Context) {
- ctx.Data["Title"] = ctx.Tr("secrets.secrets")
- ctx.Data["PageIsSettingsSecrets"] = true
-
- shared.SetSecretsContext(ctx, ctx.Doer.ID, 0)
- if ctx.Written() {
- return
- }
-
- ctx.HTML(http.StatusOK, tplSettingsSecrets)
-}
-
-func SecretsPost(ctx *context.Context) {
- shared.PerformSecretsPost(
- ctx,
- ctx.Doer.ID,
- 0,
- setting.AppSubURL+"/user/settings/secrets",
- )
-}
-
-func SecretsDelete(ctx *context.Context) {
- shared.PerformSecretsDelete(
- ctx,
- ctx.Doer.ID,
- 0,
- setting.AppSubURL+"/user/settings/secrets",
- )
+func RedirectToDefaultSetting(ctx *context.Context) {
+ ctx.Redirect(setting.AppSubURL + "/user/settings/actions/secrets")
}
"code.gitea.io/gitea/routers/web/healthcheck"
"code.gitea.io/gitea/routers/web/misc"
"code.gitea.io/gitea/routers/web/org"
+ org_setting "code.gitea.io/gitea/routers/web/org/setting"
"code.gitea.io/gitea/routers/web/repo"
"code.gitea.io/gitea/routers/web/repo/actions"
+ repo_setting "code.gitea.io/gitea/routers/web/repo/setting"
"code.gitea.io/gitea/routers/web/user"
user_setting "code.gitea.io/gitea/routers/web/user/setting"
"code.gitea.io/gitea/routers/web/user/setting/security"
return group
}
+func ctxDataSet(args ...any) func(ctx *context.Context) {
+ return func(ctx *context.Context) {
+ for i := 0; i < len(args); i += 2 {
+ ctx.Data[args[i].(string)] = args[i+1]
+ }
+ }
+}
+
// Routes returns all web routes
func Routes(ctx gocontext.Context) *web.Route {
routes := web.NewRoute()
m.Post("/packagist/{id}", web.Bind(forms.NewPackagistHookForm{}), repo.PackagistHooksEditPost)
}
+ addSettingsSecretsRoutes := func() {
+ m.Group("/secrets", func() {
+ m.Get("", repo_setting.Secrets)
+ m.Post("", web.Bind(forms.AddSecretForm{}), repo_setting.SecretsPost)
+ m.Post("/delete", repo_setting.SecretsDelete)
+ })
+ }
+
+ addSettingsRunnersRoutes := func() {
+ m.Group("/runners", func() {
+ m.Get("", repo_setting.Runners)
+ m.Combo("/{runnerid}").Get(repo_setting.RunnersEdit).
+ Post(web.Bind(forms.EditRunnerForm{}), repo_setting.RunnersEditPost)
+ m.Post("/{runnerid}/delete", repo_setting.RunnerDeletePost)
+ m.Get("/reset_registration_token", repo_setting.ResetRunnerRegistrationToken)
+ })
+ }
+
// FIXME: not all routes need go through same middleware.
// Especially some AJAX requests, we can reduce middleware number to improve performance.
// Routers.
})
m.Post("/chef/regenerate_keypair", user_setting.RegenerateChefKeyPair)
}, packagesEnabled)
- m.Group("/secrets", func() {
- m.Get("", user_setting.Secrets)
- m.Post("", web.Bind(forms.AddSecretForm{}), user_setting.SecretsPost)
- m.Post("/delete", user_setting.SecretsDelete)
- })
+
+ m.Group("/actions", func() {
+ m.Get("", user_setting.RedirectToDefaultSetting)
+ addSettingsSecretsRoutes()
+ }, actions.MustEnableActions)
+
m.Get("/organization", user_setting.Organization)
m.Get("/repos", user_setting.Repos)
m.Post("/repos/unadopted", user_setting.AdoptOrDeleteRepository)
m.Post("/replay/{uuid}", repo.ReplayWebhook)
})
addWebhookEditRoutes()
- }, webhooksEnabled, func(ctx *context.Context) {
- ctx.Data["IsUserWebhook"] = true
- })
- }, reqSignIn, func(ctx *context.Context) {
- ctx.Data["PageIsUserSettings"] = true
- ctx.Data["AllThemes"] = setting.UI.Themes
- ctx.Data["EnablePackages"] = setting.Packages.Enabled
- })
+ }, webhooksEnabled)
+ }, reqSignIn, ctxDataSet("PageIsUserSettings", true, "AllThemes", setting.UI.Themes, "EnablePackages", setting.Packages.Enabled))
m.Group("/user", func() {
// r.Get("/feeds", binding.Bind(auth.FeedsForm{}), user.Feeds)
}
})
- m.Group("/runners", func() {
- m.Get("", admin.Runners)
- m.Get("/reset_registration_token", admin.ResetRunnerRegistrationToken)
- m.Combo("/{runnerid}").Get(admin.EditRunner).Post(web.Bind(forms.EditRunnerForm{}), admin.EditRunnerPost)
- m.Post("/{runnerid}/delete", admin.DeleteRunnerPost)
- }, actions.MustEnableActions)
- }, func(ctx *context.Context) {
- ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable
- ctx.Data["EnablePackages"] = setting.Packages.Enabled
- }, adminReq)
+ m.Group("/actions", func() {
+ m.Get("", admin.RedirectToDefaultSetting)
+ addSettingsRunnersRoutes()
+ })
+ }, adminReq, ctxDataSet("EnableOAuth2", setting.OAuth2.Enable, "EnablePackages", setting.Packages.Enabled))
// ***** END: Admin *****
m.Group("", func() {
m.Post("/replay/{uuid}", repo.ReplayWebhook)
})
addWebhookEditRoutes()
- }, webhooksEnabled, func(ctx *context.Context) {
- ctx.Data["IsOrganizationWebhook"] = true
- })
+ }, webhooksEnabled)
m.Group("/labels", func() {
m.Get("", org.RetrieveLabels, org.Labels)
m.Post("/initialize", web.Bind(forms.InitializeLabelsForm{}), org.InitializeLabels)
})
- m.Group("/runners", func() {
- m.Get("", org.Runners)
- m.Combo("/{runnerid}").Get(org.RunnersEdit).
- Post(web.Bind(forms.EditRunnerForm{}), org.RunnersEditPost)
- m.Post("/{runnerid}/delete", org.RunnerDeletePost)
- m.Get("/reset_registration_token", org.ResetRunnerRegistrationToken)
+ m.Group("/actions", func() {
+ m.Get("", org_setting.RedirectToDefaultSetting)
+ addSettingsRunnersRoutes()
+ addSettingsSecretsRoutes()
}, actions.MustEnableActions)
- m.Group("/secrets", func() {
- m.Get("", org.Secrets)
- m.Post("", web.Bind(forms.AddSecretForm{}), org.SecretsPost)
- m.Post("/delete", org.SecretsDelete)
- })
-
m.RouteMethods("/delete", "GET,POST", org.SettingsDelete)
m.Group("/packages", func() {
m.Post("/rebuild", org.RebuildCargoIndex)
})
}, packagesEnabled)
- }, func(ctx *context.Context) {
- ctx.Data["EnableOAuth2"] = setting.OAuth2.Enable
- ctx.Data["EnablePackages"] = setting.Packages.Enabled
- })
+ }, ctxDataSet("EnableOAuth2", setting.OAuth2.Enable, "EnablePackages", setting.Packages.Enabled, "PageIsOrgSettings", true))
}, context.OrgAssignment(true, true))
}, reqSignIn)
// ***** END: Organization *****
m.Post("/replay/{uuid}", repo.ReplayWebhook)
})
addWebhookEditRoutes()
- }, webhooksEnabled, func(ctx *context.Context) {
- ctx.Data["IsRepositoryWebhook"] = true
- })
+ }, webhooksEnabled)
m.Group("/keys", func() {
m.Combo("").Get(repo.DeployKeys).
m.Post("/delete", repo.DeleteDeployKey)
})
- m.Group("/secrets", func() {
- m.Get("", repo.Secrets)
- m.Post("", web.Bind(forms.AddSecretForm{}), repo.SecretsPost)
- m.Post("/delete", repo.DeleteSecret)
- })
-
m.Group("/lfs", func() {
m.Get("/", repo.LFSFiles)
m.Get("/show/{oid}", repo.LFSFileGet)
m.Post("/{lid}/unlock", repo.LFSUnlock)
})
})
-
- m.Group("/runners", func() {
- m.Get("", repo.Runners)
- m.Combo("/{runnerid}").Get(repo.RunnersEdit).
- Post(web.Bind(forms.EditRunnerForm{}), repo.RunnersEditPost)
- m.Post("/{runnerid}/delete", repo.RunnerDeletePost)
- m.Get("/reset_registration_token", repo.ResetRunnerRegistrationToken)
+ m.Group("/actions", func() {
+ m.Get("", repo_setting.RedirectToDefaultSetting)
+ addSettingsRunnersRoutes()
+ addSettingsSecretsRoutes()
}, actions.MustEnableActions)
- }, func(ctx *context.Context) {
- ctx.Data["PageIsSettings"] = true
- ctx.Data["LFSStartServer"] = setting.LFS.StartServer
- })
+ }, ctxDataSet("PageIsRepoSettings", true, "LFSStartServer", setting.LFS.StartServer))
}, reqSignIn, context.RepoAssignment, context.UnitTypes(), reqRepoAdmin, context.RepoRef())
m.Post("/{username}/{reponame}/action/{action}", reqSignIn, context.RepoAssignment, context.UnitTypes(), repo.Action)
m.Get("", repo.TagsList)
m.Get(".rss", feedEnabled, repo.TagsListFeedRSS)
m.Get(".atom", feedEnabled, repo.TagsListFeedAtom)
- }, func(ctx *context.Context) {
- ctx.Data["EnableFeed"] = setting.Other.EnableFeed
- }, repo.MustBeNotEmpty, reqRepoCodeReader, context.RepoRefByType(context.RepoRefTag, true))
+ }, ctxDataSet("EnableFeed", setting.Other.EnableFeed),
+ repo.MustBeNotEmpty, reqRepoCodeReader, context.RepoRefByType(context.RepoRefTag, true))
m.Post("/tags/delete", repo.DeleteTag, reqSignIn,
repo.MustBeNotEmpty, context.RepoMustNotBeArchived(), reqRepoCodeWriter, context.RepoRef())
}, reqSignIn, context.RepoAssignment, context.UnitTypes())
m.Get("/latest", repo.LatestRelease)
m.Get(".rss", feedEnabled, repo.ReleasesFeedRSS)
m.Get(".atom", feedEnabled, repo.ReleasesFeedAtom)
- }, func(ctx *context.Context) {
- ctx.Data["EnableFeed"] = setting.Other.EnableFeed
- }, repo.MustBeNotEmpty, reqRepoReleaseReader, context.RepoRefByType(context.RepoRefTag, true))
+ }, ctxDataSet("EnableFeed", setting.Other.EnableFeed),
+ repo.MustBeNotEmpty, reqRepoReleaseReader, context.RepoRefByType(context.RepoRefTag, true))
m.Get("/releases/attachments/{uuid}", repo.GetAttachment, repo.MustBeNotEmpty, reqRepoReleaseReader)
m.Group("/releases", func() {
m.Get("/new", repo.NewRelease)
})
return
}
- ctx.Data["PageIsAdmin"] = true
}
}
}
--- /dev/null
+{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin actions")}}
+ <div class="admin-setting-content">
+ {{if eq .PageType "runners"}}
+ {{template "shared/actions/runner_list" .}}
+ {{end}}
+ </div>
+{{template "admin/layout_footer" .}}
</a>
{{end}}
{{if .EnableActions}}
- <a class="{{if .PageIsAdminRunners}}active {{end}}item" href="{{AppSubUrl}}/admin/runners">
- {{.locale.Tr "actions.runners"}}
- </a>
+ <div class="item">
+ {{.locale.Tr "actions.actions"}}
+ <div class="menu">
+ <a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{AppSubUrl}}/admin/actions/runners">
+ {{.locale.Tr "actions.runners"}}
+ </a>
+ </div>
+ </div>
{{end}}
<a class="{{if .PageIsAdminConfig}}active {{end}}item" href="{{AppSubUrl}}/admin/config">
{{.locale.Tr "admin.config"}}
+++ /dev/null
-{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin runners")}}
- <div class="admin-setting-content">
- {{template "shared/actions/runner_list" .}}
- </div>
-{{template "admin/layout_footer" .}}
--- /dev/null
+{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings actions")}}
+ <div class="org-setting-content">
+ {{if eq .PageType "runners"}}
+ {{template "shared/actions/runner_list" .}}
+ {{else if eq .PageType "secrets"}}
+ {{template "shared/secrets/add_list" .}}
+ {{end}}
+ </div>
+{{template "org/settings/layout_footer" .}}
<a class="{{if .PageIsOrgSettingsLabels}}active {{end}}item" href="{{.OrgLink}}/settings/labels">
{{.locale.Tr "repo.labels"}}
</a>
- <a class="{{if .PageIsOrgSettingsSecrets}}active {{end}}item" href="{{.OrgLink}}/settings/secrets">
- {{.locale.Tr "secrets.secrets"}}
- </a>
{{if .EnableOAuth2}}
<a class="{{if .PageIsSettingsApplications}}active {{end}}item" href="{{.OrgLink}}/settings/applications">
{{.locale.Tr "settings.applications"}}
</a>
{{end}}
{{if .EnableActions}}
- <a class="{{if .PageIsOrgSettingsRunners}}active {{end}}item" href="{{.OrgLink}}/settings/runners">
- {{.locale.Tr "actions.runners"}}
- </a>
+ <div class="item">
+ {{.locale.Tr "actions.actions"}}
+ <div class="menu">
+ <a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{.OrgLink}}/settings/actions/runners">
+ {{.locale.Tr "actions.runners"}}
+ </a>
+ <a class="{{if .PageIsSharedSettingsSecrets}}active {{end}}item" href="{{.OrgLink}}/settings/actions/secrets">
+ {{.locale.Tr "secrets.secrets"}}
+ </a>
+ </div>
+ </div>
{{end}}
<a class="{{if .PageIsSettingsDelete}}active {{end}}item" href="{{.OrgLink}}/settings/delete">
{{.locale.Tr "org.settings.delete"}}
+++ /dev/null
-{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings runners")}}
- <div class="org-setting-content">
- {{template "shared/actions/runner_list" .}}
- </div>
-{{template "org/settings/layout_footer" .}}
+++ /dev/null
-{{template "org/settings/layout_head" (dict "ctxData" . "pageClass" "organization settings secrets")}}
- <div class="org-setting-content">
- {{template "shared/secrets/add_list" .}}
- </div>
-{{template "org/settings/layout_footer" .}}
{{if .Permission.IsAdmin}}
<div class="right menu">
- <a class="{{if .PageIsSettings}}active {{end}}item" href="{{.RepoLink}}/settings">
+ <a class="{{if .PageIsRepoSettings}}active {{end}}item" href="{{.RepoLink}}/settings">
{{svg "octicon-tools"}} {{.locale.Tr "repo.settings"}}
</a>
</div>
{{else if .Permission.IsAdmin}}
<div class="ui tabular stackable menu navbar">
<div class="right menu">
- <a class="{{if .PageIsSettings}}active {{end}}item" href="{{.RepoLink}}/settings">
+ <a class="{{if .PageIsRepoSettings}}active {{end}}item" href="{{.RepoLink}}/settings">
{{svg "octicon-tools"}} {{.locale.Tr "repo.settings"}}
</a>
</div>
--- /dev/null
+{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings actions")}}
+ <div class="repo-setting-content">
+ {{if eq .PageType "runners"}}
+ {{template "shared/actions/runner_list" .}}
+ {{else if eq .PageType "secrets"}}
+ {{template "shared/secrets/add_list" .}}
+ {{end}}
+ </div>
+{{template "repo/settings/layout_footer" .}}
<li {{if .PageIsSettingsGitHooks}}class="current"{{end}}><a href="{{.RepoLink}}/settings/hooks/git">{{.locale.Tr "repo.settings.githooks"}}</a></li>
{{end}}
<li {{if .PageIsSettingsKeys}}class="current"{{end}}><a href="{{.RepoLink}}/settings/keys">{{.locale.Tr "repo.settings.deploy_keys"}}</a></li>
- <li {{if .PageIsSettingsSecrets}}class="current"{{end}}><a href="{{.RepoLink}}/settings/secrets">{{.locale.Tr "secrets.secrets"}}</a></li>
+ <li {{if .PageIsSharedSettingsSecrets}}class="current"{{end}}><a href="{{.RepoLink}}/settings/secrets">{{.locale.Tr "secrets.secrets"}}</a></li>
</ul>
</div>
</div>
<a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{.RepoLink}}/settings/keys">
{{.locale.Tr "repo.settings.deploy_keys"}}
</a>
- <a class="{{if .PageIsSettingsSecrets}}active {{end}}item" href="{{.RepoLink}}/settings/secrets">
- {{.locale.Tr "secrets.secrets"}}
- </a>
{{if .LFSStartServer}}
<a class="{{if .PageIsSettingsLFS}}active {{end}}item" href="{{.RepoLink}}/settings/lfs">
{{.locale.Tr "repo.settings.lfs"}}
</a>
{{end}}
{{if and .EnableActions (not .UnitActionsGlobalDisabled) (.Permission.CanRead $.UnitTypeActions)}}
- <a class="{{if .PageIsSettingsRunners}}active {{end}}item" href="{{.RepoLink}}/settings/runners">
- {{.locale.Tr "actions.runners"}}
- </a>
+ <div class="item">
+ {{.locale.Tr "actions.actions"}}
+ <div class="menu">
+ <a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{.RepoLink}}/settings/actions/runners">
+ {{.locale.Tr "actions.runners"}}
+ </a>
+ <a class="{{if .PageIsSharedSettingsSecrets}}active {{end}}item" href="{{.RepoLink}}/settings/actions/secrets">
+ {{.locale.Tr "secrets.secrets"}}
+ </a>
+ </div>
+ </div>
{{end}}
</div>
</div>
+++ /dev/null
-{{template "repo/settings/layout_head" (dict "ctxData" . "pageClass" "repository settings runners")}}
- <div class="repo-setting-content">
- {{template "shared/actions/runner_list" .}}
- </div>
-{{template "repo/settings/layout_footer" .}}
<h4 class="ui top attached header">
- {{.locale.Tr "secrets.secrets"}}
+ {{.locale.Tr "secrets.management"}}
<div class="ui right">
<button class="ui primary tiny show-panel button" data-panel="#add-secret-panel">{{.locale.Tr "secrets.creation"}}</button>
</div>
--- /dev/null
+{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings actions")}}
+ <div class="user-setting-content">
+ {{if eq .PageType "secrets"}}
+ {{template "shared/secrets/add_list" .}}
+ {{end}}
+ </div>
+
+{{template "user/settings/layout_footer" .}}
<a class="{{if .PageIsSettingsKeys}}active {{end}}item" href="{{AppSubUrl}}/user/settings/keys">
{{.locale.Tr "settings.ssh_gpg_keys"}}
</a>
- <a class="{{if .PageIsSettingsSecrets}}active {{end}}item" href="{{AppSubUrl}}/user/settings/secrets">
- {{.locale.Tr "secrets.secrets"}}
- </a>
+ {{if .EnableActions}}
+ <div class="item">
+ {{.locale.Tr "actions.actions"}}
+ <div class="menu">
+ <a class="{{if .PageIsSharedSettingsSecrets}}active {{end}}item" href="{{AppSubUrl}}/user/settings/actions/secrets">
+ {{.locale.Tr "secrets.secrets"}}
+ </a>
+ </div>
+ </div>
+ {{end}}
{{if .EnablePackages}}
<a class="{{if .PageIsSettingsPackages}}active {{end}}item" href="{{AppSubUrl}}/user/settings/packages">
{{.locale.Tr "packages.title"}}
+++ /dev/null
-{{template "user/settings/layout_head" (dict "ctxData" . "pageClass" "user settings secrets")}}
- <div class="user-setting-content">
- {{template "shared/secrets/add_list" .}}
- </div>
-
-{{template "user/settings/layout_footer" .}}
color: var(--color-text-light-3);
}
+/* sub menu of vertical menu */
+.ui.vertical.menu .item .menu .item {
+ color: var(--color-text-light-2);
+ text-indent: 16px;
+}
+
+.ui.vertical.menu .item .menu .item:hover,
+.ui.vertical.menu .item .menu a.item:hover {
+ color: var(--color-text-light-1);
+}
+
+.ui.vertical.menu .item .menu .active.item {
+ color: var(--color-text);
+}
+
/* slightly more contrast for filters on issue list */
.ui.ui.menu .dropdown.item.disabled {
color: var(--color-text-light-2);
.settings.webhooks .list > .item:not(:first-child),
.settings.githooks .list > .item:not(:first-child),
-.settings.runners .list > .item:not(:first-child) {
+.settings.actions .list > .item:not(:first-child) {
padding: 0.25rem 1rem;
margin: 12px -1rem -1rem;
}