-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Archive labels UI #26502
Archive labels UI #26502
Conversation
…/Archive-labels-ui
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
…list and show them different pages
This PR was rebased to #26478. So thats why it contains previous commits. |
if isArchived && l.ArchivedUnix.IsZero() { | ||
l.ArchivedUnix = timeutil.TimeStampNow() | ||
} else { |
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.
Yep, you're absolutely right.
I missed that edge case.
l.ArchivedUnix = timeutil.TimeStamp(0) | ||
} else if isArchived && l.ArchivedUnix.IsZero() { |
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.
} else if isArchived && l.ArchivedUnix.IsZero() { | |
} else if l.ArchivedUnix.IsZero() { // Only change the date when it is newly archived. |
<a class="{{if or (eq .SortType "alphabetically") (not .SortType)}}active {{end}}item" href="{{$.Link}}?sort=alphabetically&state={{$.State}}&archived_label={{if .IsPageArchivedLabels}}true{{end}}">{{.locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> | ||
<a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="{{$.Link}}?sort=reversealphabetically&state={{$.State}}&archived_label={{if .IsPageArchivedLabels}}true{{end}}">{{.locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> | ||
<a class="{{if eq .SortType "leastissues"}}active {{end}}item" href="{{$.Link}}?sort=leastissues&state={{$.State}}&archived_label={{if .IsPageArchivedLabels}}true{{end}}">{{.locale.Tr "repo.milestones.filter_sort.least_issues"}}</a> | ||
<a class="{{if eq .SortType "mostissues"}}active {{end}}item" href="{{$.Link}}?sort=mostissues&state={{$.State}}&archived_label={{if .IsPageArchivedLabels}}true{{end}}">{{.locale.Tr "repo.milestones.filter_sort.most_issues"}}</a> |
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.
<a class="{{if or (eq .SortType "alphabetically") (not .SortType)}}active {{end}}item" href="{{$.Link}}?sort=alphabetically&state={{$.State}}&archived_label={{if .IsPageArchivedLabels}}true{{end}}">{{.locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> | |
<a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="{{$.Link}}?sort=reversealphabetically&state={{$.State}}&archived_label={{if .IsPageArchivedLabels}}true{{end}}">{{.locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> | |
<a class="{{if eq .SortType "leastissues"}}active {{end}}item" href="{{$.Link}}?sort=leastissues&state={{$.State}}&archived_label={{if .IsPageArchivedLabels}}true{{end}}">{{.locale.Tr "repo.milestones.filter_sort.least_issues"}}</a> | |
<a class="{{if eq .SortType "mostissues"}}active {{end}}item" href="{{$.Link}}?sort=mostissues&state={{$.State}}&archived_label={{if .IsPageArchivedLabels}}true{{end}}">{{.locale.Tr "repo.milestones.filter_sort.most_issues"}}</a> | |
<a class="{{if or (eq .SortType "alphabetically") (not .SortType)}}active {{end}}item" href="{{$.Link}}?sort=alphabetically&state={{$.State}}{{if .IsPageArchivedLabels}}&archived_label=true{{end}}">{{.locale.Tr "repo.issues.label.filter_sort.alphabetically"}}</a> | |
<a class="{{if eq .SortType "reversealphabetically"}}active {{end}}item" href="{{$.Link}}?sort=reversealphabetically&state={{$.State}}{{if .IsPageArchivedLabels}}&archived_label=true{{end}}">{{.locale.Tr "repo.issues.label.filter_sort.reverse_alphabetically"}}</a> | |
<a class="{{if eq .SortType "leastissues"}}active {{end}}item" href="{{$.Link}}?sort=leastissues&state={{$.State}}{{if .IsPageArchivedLabels}}&archived_label=true{{end}}">{{.locale.Tr "repo.milestones.filter_sort.least_issues"}}</a> | |
<a class="{{if eq .SortType "mostissues"}}active {{end}}item" href="{{$.Link}}?sort=mostissues&state={{$.State}}{{if .IsPageArchivedLabels}}&archived_label=true{{end}}">{{.locale.Tr "repo.milestones.filter_sort.most_issues"}}</a> |
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.
Hmm… I've thought about what the best design for it is.
I think the winner is the following design:
(That can be created with the following changes:
<h4 class="ui top attached header gt-df">
<span class="gt-f1">18 labels</span>
<label class="gt-f1"><input type="checkbox" class="show-archived-labels-checkbox"> Show archived labels</label>
<div class="gt-f1">…
</h4>
)
Where we only show the middle checkbox if there are archived labels.
It needs the following JS pseudocode:
document.querySelector('.show-archived-labels-checkbox').addEventListener('input',
e => for(const archivedLabel of document.querySelectorAll('.archived-label'))
toggleElem(archivedLabel, e.target.checked)
)
);
We should highlight the archived labels, i.e. by using a different background for them.
Other than that, archived labels should not be treated differently on this page.
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.
That way, we don't need a separate page, hide unnecessary information by default, add no technical debt but still allow configuring anything the user wants to configure.
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.
Correct, this UI is good and easy to use. here is the implementation https://github.com/go-gitea/gitea/pull/26511/files
Followup #26478
Archived labels UI
Added:
Changed:
Outsourced:
Note:
The Label page now showcases archived labels distinctly from unarchived/active labels. Sorting functionality is also extended to both categories, enhancing user experience and management of labels.
When no labels
When all labels are unarchived/active
When we have archived and unarchived labels both but unarchived/active label tab is active
When we have archived and unarchived labels both but unarchived label tab is active
Marking again archived label unarchive.
Sort Archived Label
reversealphabetically
Tool Tip added for new feature indication near Archived Label Count on both archived and active/unarchived page
Part of #25237