Skip to content

Commit cb38bd0

Browse files
authored
Merge branch 'main' into lunny/handle_error
2 parents c8e150a + 11ee7ff commit cb38bd0

File tree

7 files changed

+54
-51
lines changed

7 files changed

+54
-51
lines changed

routers/api/v1/org/action.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,13 @@ func (Action) CreateVariable(ctx *context.APIContext) {
384384
// "$ref": "#/definitions/CreateVariableOption"
385385
// responses:
386386
// "201":
387-
// description: response when creating an org-level variable
388-
// "204":
389-
// description: response when creating an org-level variable
387+
// description: successfully created the org-level variable
390388
// "400":
391389
// "$ref": "#/responses/error"
392-
// "404":
393-
// "$ref": "#/responses/notFound"
390+
// "409":
391+
// description: variable name already exists.
392+
// "500":
393+
// "$ref": "#/responses/error"
394394

395395
opt := web.GetForm(ctx).(*api.CreateVariableOption)
396396

@@ -419,7 +419,7 @@ func (Action) CreateVariable(ctx *context.APIContext) {
419419
return
420420
}
421421

422-
ctx.Status(http.StatusNoContent)
422+
ctx.Status(http.StatusCreated)
423423
}
424424

425425
// UpdateVariable update an org-level variable

routers/api/v1/repo/action.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,12 @@ func (Action) CreateVariable(ctx *context.APIContext) {
339339
// responses:
340340
// "201":
341341
// description: response when creating a repo-level variable
342-
// "204":
343-
// description: response when creating a repo-level variable
344342
// "400":
345343
// "$ref": "#/responses/error"
346-
// "404":
347-
// "$ref": "#/responses/notFound"
344+
// "409":
345+
// description: variable name already exists.
346+
// "500":
347+
// "$ref": "#/responses/error"
348348

349349
opt := web.GetForm(ctx).(*api.CreateVariableOption)
350350

@@ -373,7 +373,7 @@ func (Action) CreateVariable(ctx *context.APIContext) {
373373
return
374374
}
375375

376-
ctx.Status(http.StatusNoContent)
376+
ctx.Status(http.StatusCreated)
377377
}
378378

379379
// UpdateVariable update a repo-level variable

routers/api/v1/user/action.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,11 @@ func CreateVariable(ctx *context.APIContext) {
127127
// "$ref": "#/definitions/CreateVariableOption"
128128
// responses:
129129
// "201":
130-
// description: response when creating a variable
131-
// "204":
132-
// description: response when creating a variable
130+
// description: successfully created the user-level variable
133131
// "400":
134132
// "$ref": "#/responses/error"
135-
// "404":
136-
// "$ref": "#/responses/notFound"
133+
// "409":
134+
// description: variable name already exists.
137135

138136
opt := web.GetForm(ctx).(*api.CreateVariableOption)
139137

@@ -162,7 +160,7 @@ func CreateVariable(ctx *context.APIContext) {
162160
return
163161
}
164162

165-
ctx.Status(http.StatusNoContent)
163+
ctx.Status(http.StatusCreated)
166164
}
167165

168166
// UpdateVariable update a user-level variable which is created by current doer

templates/repo/actions/runs_list.tmpl

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,23 @@
3636
<div class="run-list-meta">{{svg "octicon-calendar" 16}}{{DateUtils.TimeSince $run.Updated}}</div>
3737
<div class="run-list-meta">{{svg "octicon-stopwatch" 16}}{{$run.Duration}}</div>
3838
</div>
39-
{{if and ($.AllowDeleteWorkflowRuns) ($run.Status.IsDone)}}
40-
<button class="btn interact-bg link-action tw-p-2"
41-
data-url="{{$run.Link}}/delete"
42-
data-modal-confirm="{{ctx.Locale.Tr "actions.runs.delete.description"}}"
43-
data-tooltip-content="{{ctx.Locale.Tr "actions.runs.delete"}}"
44-
>
45-
{{svg "octicon-trash"}}
46-
</button>
47-
{{end}}
39+
<div class="ui dropdown jump tw-p-2">
40+
{{svg "octicon-kebab-horizontal"}}
41+
<div class="menu flex-items-menu">
42+
<!-- TODO: This redundant link should be replaced by something else in future,
43+
because have not figured out how to add "View Workflow" or anything similar to GitHub.
44+
Related: https://github.com/go-gitea/gitea/pull/34530 -->
45+
<a class="item" href="{{$run.Link}}">{{svg "octicon-play"}}{{ctx.Locale.Tr "view"}}</a>
46+
{{if and $.AllowDeleteWorkflowRuns $run.Status.IsDone}}
47+
<a class="item link-action"
48+
data-url="{{$run.Link}}/delete"
49+
data-modal-confirm="{{ctx.Locale.Tr "actions.runs.delete.description"}}"
50+
>
51+
{{svg "octicon-trash"}}{{ctx.Locale.Tr "actions.runs.delete"}}
52+
</a>
53+
{{end}}
54+
</div>
55+
</div>
4856
</div>
4957
</div>
5058
{{end}}

templates/swagger/v1_json.tmpl

Lines changed: 14 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/integration/api_repo_variables_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ func TestAPIRepoVariables(t *testing.T) {
3535
},
3636
{
3737
Name: "_",
38-
ExpectedStatus: http.StatusNoContent,
38+
ExpectedStatus: http.StatusCreated,
3939
},
4040
{
4141
Name: "TEST_VAR",
42-
ExpectedStatus: http.StatusNoContent,
42+
ExpectedStatus: http.StatusCreated,
4343
},
4444
{
4545
Name: "test_var",
@@ -81,7 +81,7 @@ func TestAPIRepoVariables(t *testing.T) {
8181
req := NewRequestWithJSON(t, "POST", url, api.CreateVariableOption{
8282
Value: "initial_val",
8383
}).AddTokenAuth(token)
84-
MakeRequest(t, req, http.StatusNoContent)
84+
MakeRequest(t, req, http.StatusCreated)
8585

8686
cases := []struct {
8787
Name string
@@ -138,7 +138,7 @@ func TestAPIRepoVariables(t *testing.T) {
138138
req := NewRequestWithJSON(t, "POST", url, api.CreateVariableOption{
139139
Value: "initial_val",
140140
}).AddTokenAuth(token)
141-
MakeRequest(t, req, http.StatusNoContent)
141+
MakeRequest(t, req, http.StatusCreated)
142142

143143
req = NewRequest(t, "DELETE", url).AddTokenAuth(token)
144144
MakeRequest(t, req, http.StatusNoContent)

tests/integration/api_user_variables_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ func TestAPIUserVariables(t *testing.T) {
2929
},
3030
{
3131
Name: "_",
32-
ExpectedStatus: http.StatusNoContent,
32+
ExpectedStatus: http.StatusCreated,
3333
},
3434
{
3535
Name: "TEST_VAR",
36-
ExpectedStatus: http.StatusNoContent,
36+
ExpectedStatus: http.StatusCreated,
3737
},
3838
{
3939
Name: "test_var",
@@ -75,7 +75,7 @@ func TestAPIUserVariables(t *testing.T) {
7575
req := NewRequestWithJSON(t, "POST", url, api.CreateVariableOption{
7676
Value: "initial_val",
7777
}).AddTokenAuth(token)
78-
MakeRequest(t, req, http.StatusNoContent)
78+
MakeRequest(t, req, http.StatusCreated)
7979

8080
cases := []struct {
8181
Name string
@@ -132,7 +132,7 @@ func TestAPIUserVariables(t *testing.T) {
132132
req := NewRequestWithJSON(t, "POST", url, api.CreateVariableOption{
133133
Value: "initial_val",
134134
}).AddTokenAuth(token)
135-
MakeRequest(t, req, http.StatusNoContent)
135+
MakeRequest(t, req, http.StatusCreated)
136136

137137
req = NewRequest(t, "DELETE", url).AddTokenAuth(token)
138138
MakeRequest(t, req, http.StatusNoContent)

0 commit comments

Comments
 (0)