-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Included tag search capabilities #32045
Conversation
Thanks for the PR! Would you be able to include a screenshot of the change? |
For sure, @techknowlogick . Here they go :) The first screenshot shows the tag page without any filter being applied: The second one, shows the page when the given filter returns no tag: The last one shows a single tag being filtered: |
@@ -214,6 +214,8 @@ func TagsList(ctx *context.Context) { | |||
ctx.Data["HideBranchesInDropdown"] = true | |||
ctx.Data["CanCreateRelease"] = ctx.Repo.CanWrite(unit.TypeReleases) && !ctx.Repo.Repository.IsArchived | |||
|
|||
namePattern := ctx.FormTrim("q") |
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.
I'm not really a fan of allowing end users to set SQL LIKE statements (i.e. they might not expect that entering v1_%
shows all tags in Version 1X).
However, what would be the alternative?
Parsing a glob instead and mapping it to the LIKE syntax?
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.
If we choose to merge this as it is, please add a docs page in https://gitea.com/gitea/docs describing that this search accepts the SQL LIKE syntax.
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.
The ideia behind is to macht all tags whose related commit message contains the criterion (i.e., if the user passes "2" as the criterion. It should matches v2, v1.2, v.1.32, and so on). I double-checked the generated SQL and xorm puts the wildcard on both sides of the literal (see evidence attached). This behavior is inline with how the commit search works.
About the documentation changes, gonna submitt a PR latter today :)
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.
It uses builder.Like{"lower_tag_name", strings.ToLower(opts.NamePattern.Value())}
, which will generate a SQL like lower_tag_name = ?
, And the %
will be added automatically if it hasn't been added. If you search with '2%', then the '%' will not be added automatically.
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.
@delvh do you think we still need to add a docs page for this particular change after the explanation ? I can't seem to find any existing page that is closely related to this change (the closest seem to be Usage > Protected tags
but I feel is not quite right). Any ideas ?
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.
My problem is simply that I don't like hiding functionality from the user in intransparent ways.
What we could do as a simple workaround is add a tooltip (data-tooltip-content=…
attribute) to the search bar stating
Search for matching tags. Use '%' as a placeholder for any sequence of chars and '_' for a single unknown char
or something like that.
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.
@delvh Cool, I'm gonna add the tooltip latter today :)
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 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.
Last thing: I'm not quite happy with using the query param q
as tag name.
I mean… it is sort of a query.
However, it might be confusing in the future if there are multiple search boxes why one is q
while the other one isn't.
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.
Last thing: I'm not quite happy with using the query param q as tag name.
I mean… it is sort of a query.
However, it might be confusing in the future if there are multiple search boxes why one is q while the other one isn't.
Hey @delvh, this one could be a little tricky :(
The thing is that the page is using the combo.tmpl template. Which, in turn uses the input,tmpl. The latter (source-code attached) assumes the name of the field to be q
. I could change it to receive a custom name, but it feels that it is out of the scope of this particular PR.
How do you guys want to proceed ? Do you want me to create another PR that allows a custom name for the combo component and them rebase the this one when the new one is merged ? Or do you want me to put it all together on a single PR ?
359fcb2
to
ad8bd61
Compare
It's better to have a search results count following the text of the Table head. The number is different from the one on the Tab which means the total tags amount. |
ad8bd61
to
6cd0e1a
Compare
@lunny , I've submitted some changes to show the number of tags on the header of the tags table. I've attached some evidences to show how it looks now. |
5bc7e2c
to
c540c7d
Compare
@@ -214,6 +214,8 @@ func TagsList(ctx *context.Context) { | |||
ctx.Data["HideBranchesInDropdown"] = true | |||
ctx.Data["CanCreateRelease"] = ctx.Repo.CanWrite(unit.TypeReleases) && !ctx.Repo.Repository.IsArchived | |||
|
|||
namePattern := ctx.FormTrim("q") |
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.
Last thing: I'm not quite happy with using the query param q
as tag name.
I mean… it is sort of a query.
However, it might be confusing in the future if there are multiple search boxes why one is q
while the other one isn't.
Signed-off-by: Bruno Sofiato <[email protected]>
c540c7d
to
ec62061
Compare
* giteaofficial/main: Add missing comment reply handling (go-gitea#32050) Fix CI (go-gitea#32062) Lazy load avatar images (go-gitea#32051) Included tag search capabilities (go-gitea#32045) Do not escape relative path in RPM primary index (go-gitea#32038) feat(go-gitea#31666): Set the columns height to hug all its contents (go-gitea#31726) [skip ci] Updated translations via Crowdin [skip ci] Updated translations via Crowdin Use a common message template instead of a special one (go-gitea#31878) Check if the `due_date` is nil when editing issues (go-gitea#32035)
…ea#32045) Resolves go-gitea#31998 The first screenshot shows the tag page without any filter being applied:  The second one, shows the page when the given filter returns no tag:  The last one shows a single tag being filtered:  Signed-off-by: Bruno Sofiato <[email protected]>
…ea#32045) (#3) Resolves go-gitea#31998 The first screenshot shows the tag page without any filter being applied:  The second one, shows the page when the given filter returns no tag:  The last one shows a single tag being filtered:  Signed-off-by: Bruno Sofiato <[email protected]> Co-authored-by: Bruno Sofiato <[email protected]>
…ties (go-gitea#32045) (#3) Resolves go-gitea#31998 The first screenshot shows the tag page without any filter being applied:  The second one, shows the page when the given filter returns no tag:  The last one shows a single tag being filtered:  Signed-off-by: Bruno Sofiato <[email protected]> Co-authored-by: Bruno Sofiato <[email protected]>
Resolves #31998
The first screenshot shows the tag page without any filter being applied:
The second one, shows the page when the given filter returns no tag:
The last one shows a single tag being filtered: