aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2024-11-27 05:41:06 +0100
committerGitHub <noreply@github.com>2024-11-27 05:41:06 +0100
commit846f6187168c807e1353d46d5d2260bf077b43cd (patch)
treec3c36ad22c01cdaeaa71fd5e7e9fd0cb7738538f /templates
parent3fc1bbe971db0b1591d32c4f561fdccc9c34daf4 (diff)
downloadgitea-846f6187168c807e1353d46d5d2260bf077b43cd.tar.gz
gitea-846f6187168c807e1353d46d5d2260bf077b43cd.zip
Add priority to protected branch (#32286)
## Solves Currently for rules to re-order them you have to alter the creation date. so you basicly have to delete and recreate them in the right order. This is more than just inconvinient ... ## Solution Add a new col for prioritization ## Demo WebUI Video https://github.com/user-attachments/assets/92182a31-9705-4ac5-b6e3-9bb74108cbd1 --- *Sponsored by Kithara Software GmbH*
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/settings/branches.tmpl7
-rw-r--r--templates/swagger/v1_json.tmpl82
2 files changed, 87 insertions, 2 deletions
diff --git a/templates/repo/settings/branches.tmpl b/templates/repo/settings/branches.tmpl
index 6f070ba61c..57d9f2c5a8 100644
--- a/templates/repo/settings/branches.tmpl
+++ b/templates/repo/settings/branches.tmpl
@@ -37,9 +37,12 @@
</h4>
<div class="ui attached segment">
- <div class="flex-list">
+ <div class="flex-list" id="protected-branches-list" data-update-priority-url="{{$.Repository.Link}}/settings/branches/priority">
{{range .ProtectedBranches}}
- <div class="flex-item tw-items-center">
+ <div class="flex-item tw-items-center item" data-id="{{.ID}}" >
+ <div class="drag-handle tw-cursor-grab">
+ {{svg "octicon-grabber" 16}}
+ </div>
<div class="flex-item-main">
<div class="flex-item-title">
<div class="ui basic primary label">{{.RuleName}}</div>
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index a6dcba4f19..c06c0ad154 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -4666,6 +4666,58 @@
}
}
},
+ "/repos/{owner}/{repo}/branch_protections/priority": {
+ "post": {
+ "consumes": [
+ "application/json"
+ ],
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "repository"
+ ],
+ "summary": "Update the priorities of branch protections for a repository.",
+ "operationId": "repoUpdateBranchProtectionPriories",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "owner of the repo",
+ "name": "owner",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "string",
+ "description": "name of the repo",
+ "name": "repo",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/UpdateBranchProtectionPriories"
+ }
+ }
+ ],
+ "responses": {
+ "204": {
+ "$ref": "#/responses/empty"
+ },
+ "404": {
+ "$ref": "#/responses/notFound"
+ },
+ "422": {
+ "$ref": "#/responses/validationError"
+ },
+ "423": {
+ "$ref": "#/responses/repoArchivedError"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/branch_protections/{name}": {
"get": {
"produces": [
@@ -18874,6 +18926,11 @@
},
"x-go-name": "MergeWhitelistUsernames"
},
+ "priority": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "Priority"
+ },
"protected_file_patterns": {
"type": "string",
"x-go-name": "ProtectedFilePatterns"
@@ -19568,6 +19625,11 @@
},
"x-go-name": "MergeWhitelistUsernames"
},
+ "priority": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "Priority"
+ },
"protected_file_patterns": {
"type": "string",
"x-go-name": "ProtectedFilePatterns"
@@ -20800,6 +20862,11 @@
},
"x-go-name": "MergeWhitelistUsernames"
},
+ "priority": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "Priority"
+ },
"protected_file_patterns": {
"type": "string",
"x-go-name": "ProtectedFilePatterns"
@@ -24886,6 +24953,21 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "UpdateBranchProtectionPriories": {
+ "description": "UpdateBranchProtectionPriories a list to update the branch protection rule priorities",
+ "type": "object",
+ "properties": {
+ "ids": {
+ "type": "array",
+ "items": {
+ "type": "integer",
+ "format": "int64"
+ },
+ "x-go-name": "IDs"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"UpdateFileOptions": {
"description": "UpdateFileOptions options for updating files\nNote: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)",
"type": "object",