aboutsummaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorqwerty287 <80460567+qwerty287@users.noreply.github.com>2023-03-28 19:23:25 +0200
committerGitHub <noreply@github.com>2023-03-28 13:23:25 -0400
commit3cab9c6b0c050bfcb9f2f067e7dc1b0242875254 (patch)
tree0a781efb66090c244fece965cd7dfe3c57c6cb5e /templates
parent85e8c837b8472ec20e657d2a7ebc6c78c04bffae (diff)
downloadgitea-3cab9c6b0c050bfcb9f2f067e7dc1b0242875254.tar.gz
gitea-3cab9c6b0c050bfcb9f2f067e7dc1b0242875254.zip
Add API to manage issue dependencies (#17935)
Adds API endpoints to manage issue/PR dependencies * `GET /repos/{owner}/{repo}/issues/{index}/blocks` List issues that are blocked by this issue * `POST /repos/{owner}/{repo}/issues/{index}/blocks` Block the issue given in the body by the issue in path * `DELETE /repos/{owner}/{repo}/issues/{index}/blocks` Unblock the issue given in the body by the issue in path * `GET /repos/{owner}/{repo}/issues/{index}/dependencies` List an issue's dependencies * `POST /repos/{owner}/{repo}/issues/{index}/dependencies` Create a new issue dependencies * `DELETE /repos/{owner}/{repo}/issues/{index}/dependencies` Remove an issue dependency Closes https://github.com/go-gitea/gitea/issues/15393 Closes #22115 Co-authored-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'templates')
-rw-r--r--templates/repo/issue/view_content/sidebar.tmpl39
-rw-r--r--templates/swagger/v1_json.tmpl310
2 files changed, 346 insertions, 3 deletions
diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl
index 0deb0a1891..25df29e5fb 100644
--- a/templates/repo/issue/view_content/sidebar.tmpl
+++ b/templates/repo/issue/view_content/sidebar.tmpl
@@ -420,7 +420,7 @@
<div class="ui divider"></div>
<div class="ui depending">
- {{if (and (not .BlockedByDependencies) (not .BlockingDependencies))}}
+ {{if (and (not .BlockedByDependencies) (not .BlockedByDependenciesNotPermitted) (not .BlockingDependencies) (not .BlockingDependenciesNotPermitted))}}
<span class="text"><strong>{{.locale.Tr "repo.issues.dependency.title"}}</strong></span>
<br>
<p>
@@ -432,7 +432,7 @@
</p>
{{end}}
- {{if .BlockingDependencies}}
+ {{if or .BlockingDependencies .BlockingDependenciesNotPermitted}}
<span class="text" data-tooltip-content="{{if .Issue.IsPull}}{{.locale.Tr "repo.issues.dependency.pr_close_blocks"}}{{else}}{{.locale.Tr "repo.issues.dependency.issue_close_blocks"}}{{end}}">
<strong>{{.locale.Tr "repo.issues.dependency.blocks_short"}}</strong>
</span>
@@ -456,10 +456,15 @@
</div>
</div>
{{end}}
+ {{if .BlockingDependenciesNotPermitted}}
+ <div class="item gt-df gt-ac gt-sb">
+ <span>{{$.locale.TrN (len .BlockingDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockingDependenciesNotPermitted)}}</span>
+ </div>
+ {{end}}
</div>
{{end}}
- {{if .BlockedByDependencies}}
+ {{if or .BlockedByDependencies .BlockedByDependenciesNotPermitted}}
<span class="text" data-tooltip-content="{{if .Issue.IsPull}}{{.locale.Tr "repo.issues.dependency.pr_closing_blockedby"}}{{else}}{{.locale.Tr "repo.issues.dependency.issue_closing_blockedby"}}{{end}}">
<strong>{{.locale.Tr "repo.issues.dependency.blocked_by_short"}}</strong>
</span>
@@ -483,6 +488,34 @@
</div>
</div>
{{end}}
+ {{if $.CanCreateIssueDependencies}}
+ {{range .BlockedByDependenciesNotPermitted}}
+ <div class="item dependency{{if .Issue.IsClosed}} is-closed{{end}} gt-df gt-ac gt-sb">
+ <div class="item-left gt-df gt-jc gt-fc gt-f1">
+ <div>
+ <span data-tooltip-content="{{$.locale.Tr "repo.issues.dependency.no_permission.can_remove"}}">{{svg "octicon-lock" 16}}</span>
+ <span class="title" data-tooltip-content="#{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}">
+ #{{.Issue.Index}} {{.Issue.Title | RenderEmoji $.Context}}
+ </span>
+ </div>
+ <div class="text small">
+ {{.Repository.OwnerName}}/{{.Repository.Name}}
+ </div>
+ </div>
+ <div class="item-right gt-df gt-ac">
+ {{if and $.CanCreateIssueDependencies (not $.Repository.IsArchived)}}
+ <a class="delete-dependency-button ci muted" data-id="{{.Issue.ID}}" data-type="blocking" data-tooltip-content="{{$.locale.Tr "repo.issues.dependency.remove_info"}}">
+ {{svg "octicon-trash" 16}}
+ </a>
+ {{end}}
+ </div>
+ </div>
+ {{end}}
+ {{else if .BlockedByDependenciesNotPermitted}}
+ <div class="item gt-df gt-ac gt-sb">
+ <span>{{$.locale.TrN (len .BlockedByDependenciesNotPermitted) "repo.issues.dependency.no_permission_1" "repo.issues.dependency.no_permission_n" (len .BlockedByDependenciesNotPermitted)}}</span>
+ </div>
+ {{end}}
</div>
{{end}}
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index 0f7e60c598..2401b5d15e 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -6256,6 +6256,151 @@
}
}
},
+ "/repos/{owner}/{repo}/issues/{index}/blocks": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "issue"
+ ],
+ "summary": "List issues that are blocked by this issue",
+ "operationId": "issueListBlocks",
+ "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
+ },
+ {
+ "type": "string",
+ "description": "index of the issue",
+ "name": "index",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page number of results to return (1-based)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size of results",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/IssueList"
+ }
+ }
+ },
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "issue"
+ ],
+ "summary": "Block the issue given in the body by the issue in path",
+ "operationId": "issueCreateIssueBlocking",
+ "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
+ },
+ {
+ "type": "string",
+ "description": "index of the issue",
+ "name": "index",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/IssueMeta"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/Issue"
+ },
+ "404": {
+ "description": "the issue does not exist"
+ }
+ }
+ },
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "issue"
+ ],
+ "summary": "Unblock the issue given in the body by the issue in path",
+ "operationId": "issueRemoveIssueBlocking",
+ "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
+ },
+ {
+ "type": "string",
+ "description": "index of the issue",
+ "name": "index",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/IssueMeta"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/Issue"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/issues/{index}/comments": {
"get": {
"produces": [
@@ -6538,6 +6683,151 @@
}
}
},
+ "/repos/{owner}/{repo}/issues/{index}/dependencies": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "issue"
+ ],
+ "summary": "List an issue's dependencies, i.e all issues that block this issue.",
+ "operationId": "issueListIssueDependencies",
+ "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
+ },
+ {
+ "type": "string",
+ "description": "index of the issue",
+ "name": "index",
+ "in": "path",
+ "required": true
+ },
+ {
+ "type": "integer",
+ "description": "page number of results to return (1-based)",
+ "name": "page",
+ "in": "query"
+ },
+ {
+ "type": "integer",
+ "description": "page size of results",
+ "name": "limit",
+ "in": "query"
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/IssueList"
+ }
+ }
+ },
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "issue"
+ ],
+ "summary": "Make the issue in the url depend on the issue in the form.",
+ "operationId": "issueCreateIssueDependencies",
+ "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
+ },
+ {
+ "type": "string",
+ "description": "index of the issue",
+ "name": "index",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/IssueMeta"
+ }
+ }
+ ],
+ "responses": {
+ "201": {
+ "$ref": "#/responses/Issue"
+ },
+ "404": {
+ "description": "the issue does not exist"
+ }
+ }
+ },
+ "delete": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "issue"
+ ],
+ "summary": "Remove an issue dependency",
+ "operationId": "issueRemoveIssueDependencies",
+ "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
+ },
+ {
+ "type": "string",
+ "description": "index of the issue",
+ "name": "index",
+ "in": "path",
+ "required": true
+ },
+ {
+ "name": "body",
+ "in": "body",
+ "schema": {
+ "$ref": "#/definitions/IssueMeta"
+ }
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/Issue"
+ }
+ }
+ }
+ },
"/repos/{owner}/{repo}/issues/{index}/labels": {
"get": {
"produces": [
@@ -17932,6 +18222,26 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
+ "IssueMeta": {
+ "description": "IssueMeta basic issue information",
+ "type": "object",
+ "properties": {
+ "index": {
+ "type": "integer",
+ "format": "int64",
+ "x-go-name": "Index"
+ },
+ "owner": {
+ "type": "string",
+ "x-go-name": "Owner"
+ },
+ "repo": {
+ "type": "string",
+ "x-go-name": "Name"
+ }
+ },
+ "x-go-package": "code.gitea.io/gitea/modules/structs"
+ },
"IssueTemplate": {
"description": "IssueTemplate represents an issue template for a repository",
"type": "object",