From d8196351cadb135652974721f4a89e3782f51963 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 9 Aug 2022 19:33:19 +0200 Subject: [PATCH 01/10] Fix commit status popover and switch to svg icons --- templates/repo/commit_status.tmpl | 10 +++++----- templates/repo/commit_statuses.tmpl | 4 ++-- web_src/js/features/repo-commit.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/templates/repo/commit_status.tmpl b/templates/repo/commit_status.tmpl index 75ab6b4e1c39b..b23c7af894372 100644 --- a/templates/repo/commit_status.tmpl +++ b/templates/repo/commit_status.tmpl @@ -1,15 +1,15 @@ {{if eq .State "pending"}} - + {{svg "octicon-dot-fill" 18 "commit-status icon text yellow"}} {{end}} {{if eq .State "success"}} - + {{svg "octicon-check" 18 "commit-status icon text green"}} {{end}} {{if eq .State "error"}} - + {{svg "octicon-x" 18 "commit-status icon text red"}} {{end}} {{if eq .State "failure"}} - + {{svg "octicon-x" 18 "commit-status icon text red"}} {{end}} {{if eq .State "warning"}} - + {{svg "octicon-alert" 18 "commit-status icon text yellow"}} {{end}} diff --git a/templates/repo/commit_statuses.tmpl b/templates/repo/commit_statuses.tmpl index 893887736ca70..32f3e502749e1 100644 --- a/templates/repo/commit_statuses.tmpl +++ b/templates/repo/commit_statuses.tmpl @@ -4,9 +4,9 @@ {{range .Statuses}}
{{template "repo/commit_status" .}} - {{.Context}} {{.Description}} + {{.Context}} {{.Description}} {{if .TargetURL}} - + {{$.root.locale.Tr "repo.pulls.status_checks_details"}} {{end}}
{{end}} diff --git a/web_src/js/features/repo-commit.js b/web_src/js/features/repo-commit.js index aac734de261f4..c90c4355ab93a 100644 --- a/web_src/js/features/repo-commit.js +++ b/web_src/js/features/repo-commit.js @@ -62,7 +62,7 @@ export function initCommitStatuses() { createTippy(this, { trigger: 'click', - content: this.nextSibling, + content: this.nextElementSibling, placement: positionRight ? 'right' : 'left', interactive: true, }); From 6fd1c675e66b286421d3a9ca11c7511477c85d6a Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 9 Aug 2022 19:50:32 +0200 Subject: [PATCH 02/10] margin tweak --- templates/repo/commit_statuses.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/commit_statuses.tmpl b/templates/repo/commit_statuses.tmpl index 32f3e502749e1..ff1eb2e2af386 100644 --- a/templates/repo/commit_statuses.tmpl +++ b/templates/repo/commit_statuses.tmpl @@ -3,8 +3,8 @@
{{range .Statuses}}
- {{template "repo/commit_status" .}} - {{.Context}} {{.Description}} + {{template "repo/commit_status" .}} + {{.Context}} {{.Description}} {{if .TargetURL}} {{$.root.locale.Tr "repo.pulls.status_checks_details"}} {{end}} From b6b05097126551042952b492abe3a033face6547 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 9 Aug 2022 20:28:49 +0200 Subject: [PATCH 03/10] fix integration, use warning sign for error to match previous --- integrations/pull_status_test.go | 14 +++++++------- templates/repo/commit_status.tmpl | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/integrations/pull_status_test.go b/integrations/pull_status_test.go index 33a27cd81275a..0c8e0e16556e9 100644 --- a/integrations/pull_status_test.go +++ b/integrations/pull_status_test.go @@ -56,11 +56,11 @@ func TestPullCreate_CommitStatus(t *testing.T) { } statesIcons := map[api.CommitStatusState]string{ - api.CommitStatusPending: "circle icon yellow", - api.CommitStatusSuccess: "check icon green", - api.CommitStatusError: "warning icon red", - api.CommitStatusFailure: "remove icon red", - api.CommitStatusWarning: "warning sign icon yellow", + api.CommitStatusPending: "octicon-dot-fill", + api.CommitStatusSuccess: "octicon-check", + api.CommitStatusError: "octicon-alert", + api.CommitStatusFailure: "octicon-x", + api.CommitStatusWarning: "octicon-alert", } testCtx := NewAPITestContext(t, "user1", "repo1") @@ -80,9 +80,9 @@ func TestPullCreate_CommitStatus(t *testing.T) { assert.NotEmpty(t, commitURL) assert.EqualValues(t, commitID, path.Base(commitURL)) - cls, ok := doc.doc.Find("#commits-table tbody tr td.message i.commit-status").Last().Attr("class") + cls, ok := doc.doc.Find("#commits-table tbody tr td.message .commit-status").Last().Attr("class") assert.True(t, ok) - assert.EqualValues(t, "commit-status "+statesIcons[status], cls) + assert.Contains(t, cls, statesIcons[status]) } }) } diff --git a/templates/repo/commit_status.tmpl b/templates/repo/commit_status.tmpl index b23c7af894372..d6d30c3a749f9 100644 --- a/templates/repo/commit_status.tmpl +++ b/templates/repo/commit_status.tmpl @@ -5,7 +5,7 @@ {{svg "octicon-check" 18 "commit-status icon text green"}} {{end}} {{if eq .State "error"}} - {{svg "octicon-x" 18 "commit-status icon text red"}} + {{svg "octicon-alert" 18 "commit-status icon text red"}} {{end}} {{if eq .State "failure"}} {{svg "octicon-x" 18 "commit-status icon text red"}} From 0a9f883149f6c17d93d4d3f2ac4e4a9121675864 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 9 Aug 2022 20:31:13 +0200 Subject: [PATCH 04/10] remove fix from here, will be a new pr --- web_src/js/features/repo-commit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/repo-commit.js b/web_src/js/features/repo-commit.js index c90c4355ab93a..aac734de261f4 100644 --- a/web_src/js/features/repo-commit.js +++ b/web_src/js/features/repo-commit.js @@ -62,7 +62,7 @@ export function initCommitStatuses() { createTippy(this, { trigger: 'click', - content: this.nextElementSibling, + content: this.nextSibling, placement: positionRight ? 'right' : 'left', interactive: true, }); From 8628692914b3c8b8e788d321081402be6c3cf94e Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 9 Aug 2022 20:45:54 +0200 Subject: [PATCH 05/10] use top/bottom positioning --- web_src/js/features/repo-commit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_src/js/features/repo-commit.js b/web_src/js/features/repo-commit.js index aac734de261f4..308554a305db3 100644 --- a/web_src/js/features/repo-commit.js +++ b/web_src/js/features/repo-commit.js @@ -58,12 +58,12 @@ export function initRepoCommitLastCommitLoader() { export function initCommitStatuses() { $('.commit-statuses-trigger').each(function () { - const positionRight = $('.repository.file.list').length > 0 || $('.repository.diff').length > 0; + const top = $('.repository.file.list').length > 0 || $('.repository.diff').length > 0; createTippy(this, { trigger: 'click', content: this.nextSibling, - placement: positionRight ? 'right' : 'left', + placement: top ? 'top-start' : 'bottom-start', interactive: true, }); }); From 573c46fbdd0fcd3893373d333e67cf6a4bc64a1e Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 9 Aug 2022 20:54:59 +0200 Subject: [PATCH 06/10] vertically center --- templates/repo/commit_statuses.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/commit_statuses.tmpl b/templates/repo/commit_statuses.tmpl index ff1eb2e2af386..fe3598d755624 100644 --- a/templates/repo/commit_statuses.tmpl +++ b/templates/repo/commit_statuses.tmpl @@ -1,4 +1,4 @@ -{{template "repo/commit_status" .Status}} +{{template "repo/commit_status" .Status}}
{{range .Statuses}} From 71f96ebe1942f2a14c27c28c4db4d2ff3143d14a Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 9 Aug 2022 21:03:00 +0200 Subject: [PATCH 07/10] use no-entry over alert oction --- integrations/pull_status_test.go | 4 ++-- templates/repo/commit_status.tmpl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integrations/pull_status_test.go b/integrations/pull_status_test.go index 0c8e0e16556e9..117ee8386b8bd 100644 --- a/integrations/pull_status_test.go +++ b/integrations/pull_status_test.go @@ -58,9 +58,9 @@ func TestPullCreate_CommitStatus(t *testing.T) { statesIcons := map[api.CommitStatusState]string{ api.CommitStatusPending: "octicon-dot-fill", api.CommitStatusSuccess: "octicon-check", - api.CommitStatusError: "octicon-alert", + api.CommitStatusError: "octicon-no-entry", api.CommitStatusFailure: "octicon-x", - api.CommitStatusWarning: "octicon-alert", + api.CommitStatusWarning: "octicon-no-entry", } testCtx := NewAPITestContext(t, "user1", "repo1") diff --git a/templates/repo/commit_status.tmpl b/templates/repo/commit_status.tmpl index d6d30c3a749f9..7bf45ccd83189 100644 --- a/templates/repo/commit_status.tmpl +++ b/templates/repo/commit_status.tmpl @@ -5,11 +5,11 @@ {{svg "octicon-check" 18 "commit-status icon text green"}} {{end}} {{if eq .State "error"}} - {{svg "octicon-alert" 18 "commit-status icon text red"}} + {{svg "octicon-no-entry" 18 "commit-status icon text red"}} {{end}} {{if eq .State "failure"}} {{svg "octicon-x" 18 "commit-status icon text red"}} {{end}} {{if eq .State "warning"}} - {{svg "octicon-alert" 18 "commit-status icon text yellow"}} + {{svg "octicon-no-entry" 18 "commit-status icon text yellow"}} {{end}} From 1db68c792f400a7a310f8f7e2ac7bf4ce01d77a4 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 9 Aug 2022 21:25:03 +0200 Subject: [PATCH 08/10] add exclamation icon --- integrations/pull_status_test.go | 4 ++-- public/img/svg/gitea-exclamation.svg | 1 + templates/repo/commit_status.tmpl | 4 ++-- web_src/svg/gitea-exclamation.svg | 1 + 4 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 public/img/svg/gitea-exclamation.svg create mode 100644 web_src/svg/gitea-exclamation.svg diff --git a/integrations/pull_status_test.go b/integrations/pull_status_test.go index 117ee8386b8bd..d38d90169bffa 100644 --- a/integrations/pull_status_test.go +++ b/integrations/pull_status_test.go @@ -58,9 +58,9 @@ func TestPullCreate_CommitStatus(t *testing.T) { statesIcons := map[api.CommitStatusState]string{ api.CommitStatusPending: "octicon-dot-fill", api.CommitStatusSuccess: "octicon-check", - api.CommitStatusError: "octicon-no-entry", + api.CommitStatusError: "gitea-exclamation", api.CommitStatusFailure: "octicon-x", - api.CommitStatusWarning: "octicon-no-entry", + api.CommitStatusWarning: "gitea-exclamation", } testCtx := NewAPITestContext(t, "user1", "repo1") diff --git a/public/img/svg/gitea-exclamation.svg b/public/img/svg/gitea-exclamation.svg new file mode 100644 index 0000000000000..22176010dc9fa --- /dev/null +++ b/public/img/svg/gitea-exclamation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/templates/repo/commit_status.tmpl b/templates/repo/commit_status.tmpl index 7bf45ccd83189..fbf064527da46 100644 --- a/templates/repo/commit_status.tmpl +++ b/templates/repo/commit_status.tmpl @@ -5,11 +5,11 @@ {{svg "octicon-check" 18 "commit-status icon text green"}} {{end}} {{if eq .State "error"}} - {{svg "octicon-no-entry" 18 "commit-status icon text red"}} + {{svg "gitea-exclamation" 18 "commit-status icon text red"}} {{end}} {{if eq .State "failure"}} {{svg "octicon-x" 18 "commit-status icon text red"}} {{end}} {{if eq .State "warning"}} - {{svg "octicon-no-entry" 18 "commit-status icon text yellow"}} + {{svg "gitea-exclamation" 18 "commit-status icon text yellow"}} {{end}} diff --git a/web_src/svg/gitea-exclamation.svg b/web_src/svg/gitea-exclamation.svg new file mode 100644 index 0000000000000..c83cb4158efc8 --- /dev/null +++ b/web_src/svg/gitea-exclamation.svg @@ -0,0 +1 @@ + \ No newline at end of file From 61b302b3604336b090e29892ea9a06d8d71c40c9 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 9 Aug 2022 22:11:25 +0200 Subject: [PATCH 09/10] fix test selector --- integrations/repo_commits_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/repo_commits_test.go b/integrations/repo_commits_test.go index 7107f43b0fed3..66715a2cb6fec 100644 --- a/integrations/repo_commits_test.go +++ b/integrations/repo_commits_test.go @@ -55,7 +55,7 @@ func doTestRepoCommitWithStatus(t *testing.T, state string, classes ...string) { doc = NewHTMLParser(t, resp.Body) // Check if commit status is displayed in message column - sel := doc.doc.Find("#commits-table tbody tr td.message a.commit-statuses-trigger i.commit-status") + sel := doc.doc.Find("#commits-table tbody tr td.message a.commit-statuses-trigger .commit-status") assert.Equal(t, 1, sel.Length()) for _, class := range classes { assert.True(t, sel.HasClass(class)) From e9c0216b54a106df4e4d13d900f4f89419bf1b47 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 9 Aug 2022 22:15:24 +0200 Subject: [PATCH 10/10] more test fixes --- integrations/repo_commits_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/integrations/repo_commits_test.go b/integrations/repo_commits_test.go index 66715a2cb6fec..b18b35da1e653 100644 --- a/integrations/repo_commits_test.go +++ b/integrations/repo_commits_test.go @@ -96,21 +96,21 @@ func testRepoCommitsWithStatus(t *testing.T, resp, respOne *httptest.ResponseRec } func TestRepoCommitsWithStatusPending(t *testing.T) { - doTestRepoCommitWithStatus(t, "pending", "circle", "yellow") + doTestRepoCommitWithStatus(t, "pending", "octicon-dot-fill", "yellow") } func TestRepoCommitsWithStatusSuccess(t *testing.T) { - doTestRepoCommitWithStatus(t, "success", "check", "green") + doTestRepoCommitWithStatus(t, "success", "octicon-check", "green") } func TestRepoCommitsWithStatusError(t *testing.T) { - doTestRepoCommitWithStatus(t, "error", "warning", "red") + doTestRepoCommitWithStatus(t, "error", "gitea-exclamation", "red") } func TestRepoCommitsWithStatusFailure(t *testing.T) { - doTestRepoCommitWithStatus(t, "failure", "remove", "red") + doTestRepoCommitWithStatus(t, "failure", "octicon-x", "red") } func TestRepoCommitsWithStatusWarning(t *testing.T) { - doTestRepoCommitWithStatus(t, "warning", "warning", "sign", "yellow") + doTestRepoCommitWithStatus(t, "warning", "gitea-exclamation", "yellow") }