Manually Search Stash ID - Edit Page - Scenes, Studios#6340
Manually Search Stash ID - Edit Page - Scenes, Studios#6340WithoutPants merged 8 commits intostashapp:developfrom
Conversation
9101ecc to
f4936fb
Compare
2d7dfd5 to
66d55e3
Compare
|
I modified some of the old code in the performers section to run off of the new utility. All 4 sections were doing the same thing so I figured it was best to break it out. |
WithoutPants
left a comment
There was a problem hiding this comment.
Can you please extract the tag part of this PR into a separate one? It's looking like the scenes and studio stuff is ready to go, but the tag stuff still needs work.
| return nil, nil | ||
| } | ||
|
|
||
| return nil, errors.New("stash_box_index must be set") |
There was a problem hiding this comment.
This should refer to the non-deprecated field stash_box_endpoint instead.
pkg/stashbox/tag.go
Outdated
| func (c Client) FindTag(ctx context.Context, query string) (*models.ScrapedTag, error) { | ||
| var id *string | ||
| var name *string | ||
|
|
||
| _, err := uuid.Parse(query) | ||
| if err == nil { | ||
| // Confirmed the user passed in a Stash ID | ||
| id = &query | ||
| } else { | ||
| // Otherwise assume they're searching on a name | ||
| name = &query | ||
| } | ||
|
|
||
| tag, err := c.client.FindTag(ctx, id, name) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| if tag.FindTag == nil { | ||
| return nil, nil | ||
| } | ||
|
|
||
| return &models.ScrapedTag{ | ||
| Name: tag.FindTag.Name, | ||
| RemoteSiteID: &tag.FindTag.ID, | ||
| }, nil | ||
| } |
There was a problem hiding this comment.
I think this should be returning a slice of tags rather than a single one. In the UI, we're potentially querying for a tag for which we may not have the exact name, similar to performers, scenes etc. I think if we're not searching by UUID, we should use queryTags instead of findTag.
There was a problem hiding this comment.
Moving over to separate PR as requested to fix.
WithoutPants
left a comment
There was a problem hiding this comment.
Nearly there. Testing looks good.
| function getEntityTypeDisplayName(entityType: StashBoxEntityType): string { | ||
| switch (entityType) { | ||
| case "performer": | ||
| return "Performer"; | ||
| case "scene": | ||
| return "Scene"; | ||
| case "studio": | ||
| return "Studio"; | ||
| } | ||
| } |
There was a problem hiding this comment.
This needs to be internationalised as well. This should return a message id, which would be translated using intl in the calling code.
There was a problem hiding this comment.
Had to google what that even meant but I think I was able to copy it over from how another part handled it.
|
I branched the tags stuff off of this one a little earlier. Once this one looks good I will rebase with any changes we make and then PR it. |
A followup to #6284
This adds in the same support to the other modals that support StashIDs: Scenes, Studios, and Tags.
Closes: #6271