-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor issue filter (labels, poster, assignee) #32771
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f84d018
fix
wxiaoguang 65e7b8f
fix var name
wxiaoguang 1dbd446
fine tune
wxiaoguang 733cd48
fix typo
wxiaoguang c53fe2e
Merge branch 'main' into refactor-issue-filter
wxiaoguang c3cefdf
Merge branch 'main' into refactor-issue-filter
wxiaoguang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{{/* | ||
* "labels" from query string (needed by JS) | ||
* QueryLink | ||
* Labels | ||
* SupportArchivedLabel, if true, then it needs "archived_labels" from query string | ||
*/}} | ||
{{$queryLink := .QueryLink}} | ||
<div class="item ui dropdown jump {{if not .Labels}}disabled{{end}} label-filter"> | ||
<span class="text">{{ctx.Locale.Tr "repo.issues.filter_label"}}</span> | ||
{{svg "octicon-triangle-down" 14 "dropdown icon"}} | ||
<div class="menu flex-items-menu"> | ||
<div class="ui icon search input"> | ||
<i class="icon">{{svg "octicon-search" 16}}</i> | ||
<input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_label"}}"> | ||
</div> | ||
{{if .SupportArchivedLabel}}{{/* this checkbox has a hard dependency with the "labels" and "archived_label" query parameter */}} | ||
<label class="label-filter-archived-toggle flex-text-block"> | ||
<input type="checkbox"> {{ctx.Locale.Tr "repo.issues.label_archived_filter"}} | ||
<span data-tooltip-content={{ctx.Locale.Tr "repo.issues.label_archive_tooltip"}}>{{svg "octicon-info"}}</span> | ||
</label> | ||
{{end}} | ||
<span class="info">{{ctx.Locale.Tr "repo.issues.filter_label_exclude"}}</span> | ||
<div class="divider"></div> | ||
<a class="item label-filter-query-default" href="{{QueryBuild $queryLink "labels" NIL}}">{{ctx.Locale.Tr "repo.issues.filter_label_no_select"}}</a> | ||
<a class="item label-filter-query-not-set" href="{{QueryBuild $queryLink "labels" 0}}">{{ctx.Locale.Tr "repo.issues.filter_label_select_no_label"}}</a> | ||
{{$previousExclusiveScope := "_no_scope"}} | ||
{{range .Labels}} | ||
{{$exclusiveScope := .ExclusiveScope}} | ||
{{if and (ne $previousExclusiveScope $exclusiveScope)}} | ||
<div class="divider" data-scope="{{.ExclusiveScope}}"></div> | ||
{{end}} | ||
{{$previousExclusiveScope = $exclusiveScope}} | ||
<a class="item label-filter-query-item" data-label-id="{{.ID}}" data-scope="{{.ExclusiveScope}}" {{if .IsArchived}}data-is-archived{{end}} | ||
href="{{QueryBuild $queryLink "labels" .QueryString}}"> | ||
{{if .IsExcluded}} | ||
{{svg "octicon-circle-slash"}} | ||
{{else if .IsSelected}} | ||
{{Iif $exclusiveScope (svg "octicon-dot-fill") (svg "octicon-check")}} | ||
{{end}} | ||
{{ctx.RenderUtils.RenderLabel .}} | ||
<p class="tw-ml-auto">{{template "repo/issue/labels/label_archived" .}}</p> | ||
</a> | ||
{{end}} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{{/* This is a user list for filter, the data is provided by a local variable assignment | ||
* QueryParamKey: eg: "poster", "assignee" | ||
* QueryLink | ||
* UserSearchList | ||
* SelectedUserId: 0 or empty means default, -1 means "no user is set" | ||
* TextFilterTitle | ||
* TextZeroValue: the text for "all issues" | ||
* TextNegativeOne: the text for "issues with no assignee" | ||
*/}} | ||
{{$queryLink := .QueryLink}} | ||
<div class="item ui dropdown jump {{if not .UserSearchList}}disabled{{end}}"> | ||
{{$.TextFilterTitle}} {{svg "octicon-triangle-down" 14 "dropdown icon"}} | ||
<div class="menu"> | ||
<div class="ui icon search input"> | ||
<i class="icon">{{svg "octicon-search" 16}}</i> | ||
<input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_user_placeholder"}}"> | ||
</div> | ||
{{if $.TextZeroValue}} | ||
<a class="item {{if not .SelectedUserId}}selected{{end}}" href="{{QueryBuild $queryLink $.QueryParamKey NIL}}">{{$.TextZeroValue}}</a> | ||
{{end}} | ||
{{if $.TextNegativeOne}} | ||
<a class="item {{if eq .SelectedUserId -1}}selected{{end}}" href="{{QueryBuild $queryLink $.QueryParamKey -1}}">{{$.TextNegativeOne}}</a> | ||
{{end}} | ||
<div class="divider"></div> | ||
{{range .UserSearchList}} | ||
<a class="item {{if eq $.SelectedUserId .ID}}selected{{end}}" href="{{QueryBuild $queryLink $.QueryParamKey .ID}}"> | ||
{{ctx.AvatarUtils.Avatar . 20}}{{template "repo/search_name" .}} | ||
</a> | ||
{{end}} | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{{/* This is a user list for filter, the data is provided by a remote "fetch" request | ||
* QueryParamKey: eg: "poster", "assignee" | ||
* QueryLink | ||
* UserSearchUrl | ||
* SelectedUserId | ||
* TextFilterTitle | ||
*/}} | ||
{{$queryLink := .QueryLink}} | ||
<div class="item ui dropdown custom user-remote-search" data-tooltip-content="{{ctx.Locale.Tr "repo.user_search_tooltip"}}" | ||
data-search-url="{{$.UserSearchUrl}}" | ||
data-selected-user-id="{{$.SelectedUserId}}" | ||
data-action-jump-url="{{QueryBuild $queryLink $.QueryParamKey NIL}}&{{$.QueryParamKey}}={username}" | ||
> | ||
{{$.TextFilterTitle}} {{svg "octicon-triangle-down" 14 "dropdown icon"}} | ||
<div class="menu"> | ||
<div class="ui icon search input"> | ||
<i class="icon">{{svg "octicon-search" 16}}</i> | ||
<input type="text" placeholder="{{ctx.Locale.Tr "repo.issues.filter_user_placeholder"}}"> | ||
</div> | ||
<a class="item" data-value="">{{ctx.Locale.Tr "repo.issues.filter_user_no_select"}}</a> | ||
<a class="item item-from-input tw-hidden"></a> | ||
</div> | ||
</div> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need to panic? Is it possible to recover from a panic if necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Golang also does so.
No
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a user's perspective, no one wants to cause the entire system to panic because of a query. I think this is unreasonable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a variety of operations in Golang that may cause a panic. For this case, I think it is the developer's responsibility to check and ensure that the query does not cause a panic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it won't panic from "user's perspective". It only panics for developer's mistakes.
It is designed carefully and intentionally, I won't change it unless you could show a real case why end users would be affected.