Skip to content
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

Closed
wants to merge 33 commits into from
Closed

Conversation

puni9869
Copy link
Member

@puni9869 puni9869 commented Aug 14, 2023

Followup #26478

Archived labels UI

Added:

  • Implemented the structural framework for the user interface to accommodate archived labels.
  • Introduced archived labels functionality to the UI, akin to the approach taken for closed milestones or projects. This functionality allows concealing information while retaining it, without resorting to deletion.
  • Particularly advantageous for managing outdated labels that are no longer in use, offering a means to preserve them without cluttering the active label set.

Changed:

  • Enhanced the Filtered UI page to seamlessly incorporate a list of archived labels.
  • Introduced sorting capability specifically for archived labels.

Outsourced:

  • Defer the implementation of specialized handling for archived labels to upcoming pull requests. This step will be undertaken subsequent to the successful merge of this pull request.

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

image

When all labels are unarchived/active

image

When we have archived and unarchived labels both but unarchived/active label tab is active

image

When we have archived and unarchived labels both but unarchived label tab is active

image

Marking again archived label unarchive.

image

Sort Archived Label reversealphabetically

image image image

Tool Tip added for new feature indication near Archived Label Count on both archived and active/unarchived page

image

Part of #25237

puni9869 and others added 30 commits August 2, 2023 10:07
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Aug 14, 2023
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 14, 2023
@puni9869
Copy link
Member Author

This PR was rebased to #26478. So thats why it contains previous commits.
We can squash merge.

Comment on lines -116 to -118
if isArchived && l.ArchivedUnix.IsZero() {
l.ArchivedUnix = timeutil.TimeStampNow()
} else {
Copy link
Member

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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else if isArchived && l.ArchivedUnix.IsZero() {
} else if l.ArchivedUnix.IsZero() { // Only change the date when it is newly archived.

Comment on lines +36 to +39
<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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<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>

Copy link
Member

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:
grafik
(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.

Copy link
Member

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.

Copy link
Member Author

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

@lunny lunny added this to the 1.21.0 milestone Aug 15, 2023
@lunny lunny added the topic/ui Change the appearance of the Gitea UI label Aug 15, 2023
@puni9869
Copy link
Member Author

@puni9869 puni9869 closed this Aug 15, 2023
@GiteaBot GiteaBot removed this from the 1.21.0 milestone Aug 15, 2023
@puni9869 puni9869 deleted the punit/Archive-labels-ui branch August 15, 2023 07:07
@puni9869 puni9869 mentioned this pull request Aug 23, 2023
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Nov 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants