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

Scoped label display improvements #23164

Closed
wants to merge 12 commits into from

Conversation

brechtvl
Copy link
Contributor

@brechtvl brechtvl commented Feb 26, 2023

  • Use scoped label display and menu grouping also for non-exclusive labels with /. This means the Exclusive option no longer affects the label display, only the behavior when assigning labels.
  • Fix scoped label left and right part breaking across lines.
  • Remove slanted divider in scoped label display, make it straight. After using this for a while, this feels more visually noisy than helpful.
  • Deduplicate template code for labels selection menu.
  • Reduce contrast between scope and item to reduce probability of unreadable text on background.

⚠️ BREAKING ⚠️

Existing labels with a / character in the name are now displayed as a scoped label. These labels are not mutually exclusive by default. If the / character was used for another purpose, the label name can be changed to use another character or word.

Part of #22974

@brechtvl
Copy link
Contributor Author

brechtvl commented Feb 26, 2023

Before and after:
labels_before
labels_after

I tried to make labels not overflow like #23146, however I had trouble figuring out how to both make it break words within the left and right part, while still ensuring the left and right part don't break apart

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 26, 2023
@brechtvl brechtvl force-pushed the scoped-label-display branch from 9f0f29a to bc7a351 Compare February 26, 2023 15:28
@techknowlogick techknowlogick added topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality labels Feb 26, 2023
@a1012112796
Copy link
Member

how about add overflow: scroll style for lable list in sidebar?
image

@brechtvl
Copy link
Contributor Author

brechtvl commented Feb 27, 2023

It seems preferable to be consistent with #23146 if we can and use word-break? Though I have not succeeded in getting that to work.

I did make a change to inline-flex so that there is no overflow when using more reasonable length words.

Before white-space: nowrap display: inline-flex display: inline-flex, word-break: break-all
ref white-space-nowrap display-inline-flex inline-flex-break-all

@techknowlogick
Copy link
Member

Thanks for the comparison screenshots. I do also prefer it with inline-flex.

LGTM ❤️

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 27, 2023
@codecov-commenter
Copy link

codecov-commenter commented Feb 28, 2023

Codecov Report

Merging #23164 (8a402d0) into main (5c4075e) will increase coverage by 0.16%.
The diff coverage is 87.50%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main   #23164      +/-   ##
==========================================
+ Coverage   47.39%   47.56%   +0.16%     
==========================================
  Files        1143     1143              
  Lines      151093   151171      +78     
==========================================
+ Hits        71617    71909     +292     
+ Misses      71035    70757     -278     
- Partials     8441     8505      +64     
Impacted Files Coverage Δ
modules/templates/helper.go 43.75% <50.00%> (+0.11%) ⬆️
models/issues/label.go 58.04% <100.00%> (+0.69%) ⬆️
modules/auth/password/hash/setting.go 68.18% <0.00%> (-31.82%) ⬇️
modules/indexer/stats/indexer.go 51.06% <0.00%> (-6.39%) ⬇️
modules/notification/mail/mail.go 29.41% <0.00%> (-2.95%) ⬇️
routers/api/packages/nuget/api_v3.go 94.49% <0.00%> (-2.76%) ⬇️
routers/install/routes.go 41.46% <0.00%> (-1.96%) ⬇️
modules/notification/ui/ui.go 60.34% <0.00%> (-1.73%) ⬇️
modules/queue/queue_channel.go 84.26% <0.00%> (-1.13%) ⬇️
models/activities/notification.go 61.33% <0.00%> (-1.12%) ⬇️
... and 18 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Feb 28, 2023

I tried to make labels not overflow like #23146, however I had trouble figuring out how to both make it break words within the left and right part, while still ensuring the left and right part don't break apart

Do you mean this? https://jsfiddle.net/L2o0kq3n/

image

ps: the inline may not work with other styles, it may need other tricks, just a guess.

@a1012112796
Copy link
Member

in github it just cut the too long contents by css, but that's looks hard for scoped label. wonder how gitlab handle it...
image

@brechtvl
Copy link
Contributor Author

brechtvl commented Mar 1, 2023

I updated my comment above to show what it looks like with word-break: break-all. It avoids the overflow but also makes the regular cases without very long words worse. Breaking for example "Status" across multiple lines is not helping readability.

I think this PR is a net improvement over the current state which also does not stop label overflow, so maybe it's good enough to merge?

Do you mean this? https://jsfiddle.net/L2o0kq3n/

Not really, this doesn't look that good to me for cases like Status in my example. But it's a matter of taste also.

in github it just cut the too long contents by css, but that's looks hard for scoped label. wonder how gitlab handle it...

It cuts off the text on both sides. To me that behavior seems not useful either. If you see this you probably rename the label to something else to make it readable.

gitlab-long

@lafriks lafriks added this to the 1.20.0 milestone Mar 2, 2023
@lafriks lafriks added the outdated/backport/v1.19 This PR should be backported to Gitea 1.19 label Mar 2, 2023
@lafriks lafriks mentioned this pull request Mar 2, 2023
9 tasks
Still seems enough, and decreases probability of ending up with difficult
to read text and background color combination.
@lunny
Copy link
Member

lunny commented Mar 12, 2023

  • Use scoped label display and menu grouping also for non-exclusive labels with /.

    • Fix scoped label left and right part breaking across lines.

    • Remove slanted divider in scoped label display, make it straight. After using this for a while, this feels more visually noisy than helpful.

    • Deduplicate template code for labels selection menu.

    • Reduce contrast between scope and item to reduce probability of unreadable text on background.

Part of #22974

Looks like the first item should be marked as a break change?

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 12, 2023

Looks like the first item should be marked as a break change?

Maybe not that breaking (how? I can not imagine ...), we can consider it as improvement?


Update: I see the breaking now. Some people just want to use literal labels like "N/A" without scope.

@brechtvl
Copy link
Contributor Author

I updated the description to notify about the breaking change, assuming we are ok with this.

@lunny
Copy link
Member

lunny commented Mar 12, 2023

I updated the description to notify about the breaking change, assuming we are ok with this.

Thanks! Then maybe we also need to mention that the column of exclusive's meaning has been changed.

@brechtvl
Copy link
Contributor Author

I updated the description to try to make that more explicit, but I'm not sure I understood exactly what you are asking.

@lunny lunny removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 12, 2023
@LamGC
Copy link

LamGC commented Mar 12, 2023

Can the repository choose to enable this feature? It would be better if users could choose whether to enable this feature in the repository.

@lunny
Copy link
Member

lunny commented Mar 12, 2023

I updated the description to try to make that more explicit, but I'm not sure I understood exactly what you are asking.

I mean maybe the description in locale-en_US.ini for the checkbox of exclusive on adding label UI should be changed because now whatever you check or not check exclusive, / will always be rendered as the Exclusive option no longer affects the label display.

@lunny
Copy link
Member

lunny commented Mar 12, 2023

Can the repository choose to enable this feature? It would be better if users could choose whether to enable this feature in the repository.

I don't think we are ready to add an option for repository, maybe depend on #22500

@yp05327
Copy link
Contributor

yp05327 commented Mar 12, 2023

I think we can add a setting to this in app.ini (global) and the repo settings.
The default value is an empty string and will have no changes.
If users want to use this new feature, they can select the character by themselves.

@BLumia
Copy link
Member

BLumia commented Mar 12, 2023

Sorry I am strongly discouraged from doing this since using / for 'or' is not rare. See discussions in #22974 (comment) for the reason. I think it's okay to do so if we are using some rare delimiter like ::, but / is not rare, and also, we don't have the ability to escape the delimiter symbol...

@delvh
Copy link
Member

delvh commented Mar 12, 2023

We are getting severely offtopic for this PR

but:

I don't quite understand why anyone would need a global or even repo-specific configuration to enable or disable this feature.
You implicitly have to enable it yourself, as it is only activated for labels that explicitly set exclusive=true.
(Which is none of the existing labels by default).
The display improvements in this PR have nothing to do with the actual implementation of scoped labels.
Please, try out how the scoped labels are implemented at the moment before demanding being able to enable/disable this feature.
I'd say it is pretty intuitive and re-usable in how it is implemented at the moment.
Furthermore, you can choose for each label already if it should be enabled or disabled.
Any attempt to further enable/disable it is going to complicate the logic a lot, and I will likely strongly oppose adding this (in my eyes) unnecessary and unmaintainable overhead.

@BLumia
Copy link
Member

BLumia commented Mar 12, 2023

We are getting severely offtopic for this PR

I'm sorry since the discussion in #22974 doesn't stop this from happening, so I left a comment to let people know the concern of the breaking change.

You implicitly have to enable it yourself, as it is only activated for labels that explicitly set exclusive=true.

The existing change is fine to me and I'm okay if we don't plan to switch to use another delimiter in database, but If the / character was used for another purpose, the label name can be changed to use another character or word. is a breaking change and I'm NOT okay with that.

If you are doing this, remove the exclusive field too since it will be very much useless or confuse the meaning of the exclusive option.

@lunny
Copy link
Member

lunny commented Mar 12, 2023

We are getting severely offtopic for this PR
but:

I don't quite understand why anyone would need a global or even repo-specific configuration to enable or disable this feature. You implicitly have to enable it yourself, as it is only activated for labels that explicitly set exclusive=true.

No. This PR will break this behaviour. Even exclusive=false, / will also be rendered.

(Which is none of the existing labels by default). The display improvements in this PR have nothing to do with the actual implementation of scoped labels. Please, try out how the scoped labels are implemented at the moment before demanding being able to enable/disable this feature. I'd say it is pretty intuitive and re-usable in how it is implemented at the moment. Furthermore, you can choose for each label already if it should be enabled or disabled. Any attempt to further enable/disable it is going to complicate the logic a lot, and I will likely strongly oppose adding this (in my eyes) unnecessary and unmaintainable overhead.

@wxiaoguang
Copy link
Contributor

wxiaoguang commented Mar 12, 2023

I can see a possible approach to avoid the breaking, introduce a label property like Groupable.

I think some people may want to use "N/A" , "mac/win" or "c/java" for labels without scope.

For label foo/bar:

  • If Groupable=1, the new behavior: <div>foo</div><div>bar</div>
  • If Groupable=0, the old behavior:<div>foo/bar</div>
  • (it seems dirty when Groupable=0 and Exclusive=1. see the new thought below)

Or just change the Exclusive to a enum: Default/Groupable/Exclusive.

For label foo/bar:

  • If Default, the old behavior:<div>foo/bar</div>
  • If Groupable or Exclusive, the new behavior: <div>foo</div><div>bar</div>
  • The Exclusive also controls other logic.

(Just a brief thought ....)

@delvh
Copy link
Member

delvh commented Mar 12, 2023

Hmm… Looks like we should postpone merging this PR as it is for now.
It looks like there is a lot to discuss before we can merge it.
Especially the main improvement of this PR, that all labels containing / get the visual prefix, no matter if they are scoped labels or not, seems to be highly controversial.
What we could do is extract a sub-PR that implements everything except for the breaking (and coincidentally controversial) part.
Then, we could drop everything else in this PR and make it only a v1.20 PR without backporting it to 1.19.
So far, I haven't seen any objection to any of the other improvements, which should be merged into 1.19 already.

@brechtvl
Copy link
Contributor Author

brechtvl commented Mar 12, 2023

The simpler PR for 1.19 is #23430, the code deduplication is in #23431.

@brechtvl brechtvl marked this pull request as draft March 12, 2023 19:20
@brechtvl
Copy link
Contributor Author

I'll close this one and create a new PR with an enum for scoped labels later.

@brechtvl brechtvl closed this Mar 24, 2023
@lunny lunny removed this from the 1.20.0 milestone Mar 24, 2023
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
@brechtvl brechtvl deleted the scoped-label-display branch May 20, 2023 12:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. outdated/backport/v1.19 This PR should be backported to Gitea 1.19 topic/ui Change the appearance of the Gitea UI type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.