diff --git a/graphql/schema/schema.graphql b/graphql/schema/schema.graphql index 8936b8a34..2a9d067ae 100644 --- a/graphql/schema/schema.graphql +++ b/graphql/schema/schema.graphql @@ -165,12 +165,6 @@ type Query { input: ScrapeSingleStudioInput! ): [ScrapedStudio!]! - "Scrape for a single tag" - scrapeSingleTag( - source: ScraperSourceInput! - input: ScrapeSingleTagInput! - ): [ScrapedTag!]! - "Scrape for a single performer" scrapeSinglePerformer( source: ScraperSourceInput! diff --git a/graphql/schema/types/scraper.graphql b/graphql/schema/types/scraper.graphql index 9c0e33fdf..cb193f47d 100644 --- a/graphql/schema/types/scraper.graphql +++ b/graphql/schema/types/scraper.graphql @@ -198,13 +198,6 @@ input ScrapeSingleStudioInput { query: String } -input ScrapeSingleTagInput { - """ - Query can be either a name or a Stash ID - """ - query: String -} - input ScrapeSinglePerformerInput { "Instructs to query by string" query: String diff --git a/graphql/stash-box/query.graphql b/graphql/stash-box/query.graphql index 99d2c8f4a..4fa023070 100644 --- a/graphql/stash-box/query.graphql +++ b/graphql/stash-box/query.graphql @@ -170,12 +170,6 @@ query FindStudio($id: ID, $name: String) { } } -query FindTag($id: ID, $name: String) { - findTag(id: $id, name: $name) { - ...TagFragment - } -} - mutation SubmitFingerprint($input: FingerprintSubmission!) { submitFingerprint(input: $input) } diff --git a/internal/api/resolver_query_scraper.go b/internal/api/resolver_query_scraper.go index 4e976c6cd..5875cd11e 100644 --- a/internal/api/resolver_query_scraper.go +++ b/internal/api/resolver_query_scraper.go @@ -353,45 +353,6 @@ func (r *queryResolver) ScrapeSingleStudio(ctx context.Context, source scraper.S return nil, errors.New("stash_box_index must be set") } -func (r *queryResolver) ScrapeSingleTag(ctx context.Context, source scraper.Source, input ScrapeSingleTagInput) ([]*models.ScrapedTag, error) { - if source.StashBoxIndex != nil || source.StashBoxEndpoint != nil { - b, err := resolveStashBox(source.StashBoxIndex, source.StashBoxEndpoint) - if err != nil { - return nil, err - } - - client := r.newStashBoxClient(*b) - - var ret []*models.ScrapedTag - out, err := client.FindTag(ctx, *input.Query) - - if err != nil { - return nil, err - } else if out != nil { - ret = append(ret, out) - } - - if len(ret) > 0 { - if err := r.withReadTxn(ctx, func(ctx context.Context) error { - for _, tag := range ret { - if err := match.ScrapedTag(ctx, r.repository.Tag, tag, b.Endpoint); err != nil { - return err - } - } - - return nil - }); err != nil { - return nil, err - } - return ret, nil - } - - return nil, nil - } - - return nil, errors.New("stash_box_index must be set") -} - func (r *queryResolver) ScrapeSinglePerformer(ctx context.Context, source scraper.Source, input ScrapeSinglePerformerInput) ([]*models.ScrapedPerformer, error) { var ret []*models.ScrapedPerformer switch { diff --git a/pkg/stashbox/tag.go b/pkg/stashbox/tag.go deleted file mode 100644 index 3d5c17972..000000000 --- a/pkg/stashbox/tag.go +++ /dev/null @@ -1,36 +0,0 @@ -package stashbox - -import ( - "context" - - "github.com/google/uuid" - "github.com/stashapp/stash/pkg/models" -) - -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 -} diff --git a/ui/v2.5/graphql/queries/scrapers/scrapers.graphql b/ui/v2.5/graphql/queries/scrapers/scrapers.graphql index 4ddfbd91b..8137fe054 100644 --- a/ui/v2.5/graphql/queries/scrapers/scrapers.graphql +++ b/ui/v2.5/graphql/queries/scrapers/scrapers.graphql @@ -62,15 +62,6 @@ query ScrapeSingleStudio( } } -query ScrapeSingleTag( - $source: ScraperSourceInput! - $input: ScrapeSingleTagInput! -) { - scrapeSingleTag(source: $source, input: $input) { - ...ScrapedSceneTagData - } -} - query ScrapeSinglePerformer( $source: ScraperSourceInput! $input: ScrapeSinglePerformerInput! diff --git a/ui/v2.5/src/components/Shared/StashBoxIDSearchModal.tsx b/ui/v2.5/src/components/Shared/StashBoxIDSearchModal.tsx index 6a86d9840..88544d685 100644 --- a/ui/v2.5/src/components/Shared/StashBoxIDSearchModal.tsx +++ b/ui/v2.5/src/components/Shared/StashBoxIDSearchModal.tsx @@ -15,7 +15,6 @@ import { stashBoxPerformerQuery, stashBoxSceneQuery, stashBoxStudioQuery, - stashBoxTagQuery, } from "src/core/StashService"; import { useToast } from "src/hooks/Toast"; import { stringToGender } from "src/utils/gender"; @@ -23,10 +22,9 @@ import { stringToGender } from "src/utils/gender"; type SearchResultItem = | GQL.ScrapedPerformerDataFragment | GQL.ScrapedSceneDataFragment - | GQL.ScrapedStudioDataFragment - | GQL.ScrapedSceneTagDataFragment; + | GQL.ScrapedStudioDataFragment; -export type StashBoxEntityType = "performer" | "scene" | "studio" | "tag"; +export type StashBoxEntityType = "performer" | "scene" | "studio"; interface IProps { entityType: StashBoxEntityType; @@ -234,27 +232,6 @@ export const StudioSearchResult: React.FC = ({ ); }; -// Tag Result Component -interface ITagResultProps { - tag: GQL.ScrapedSceneTagDataFragment; -} - -export const TagSearchResult: React.FC = ({ tag }) => { - return ( -
-
- -
-

- {tag.name} -

-
-
-
-
- ); -}; - // Helper to get entity type display name for i18n function getEntityTypeDisplayName(entityType: StashBoxEntityType): string { switch (entityType) { @@ -264,8 +241,6 @@ function getEntityTypeDisplayName(entityType: StashBoxEntityType): string { return "Scene"; case "studio": return "Studio"; - case "tag": - return "Tag"; } } @@ -278,8 +253,6 @@ function getFoundMessageId(entityType: StashBoxEntityType): string { return "dialogs.scenes_found"; case "studio": return "dialogs.studios_found"; - case "tag": - return "dialogs.tags_found"; } } @@ -345,14 +318,6 @@ export const StashBoxIDSearchModal: React.FC = ({ setResults(queryData.data?.scrapeSingleStudio ?? []); break; } - case "tag": { - const queryData = await stashBoxTagQuery( - query, - selectedStashBox.endpoint - ); - setResults(queryData.data?.scrapeSingleTag ?? []); - break; - } } } catch (error) { Toast.error(error); @@ -392,10 +357,6 @@ export const StashBoxIDSearchModal: React.FC = ({ return ( ); - case "tag": - return ( - - ); } } diff --git a/ui/v2.5/src/components/Tags/TagDetails/TagEditPanel.tsx b/ui/v2.5/src/components/Tags/TagDetails/TagEditPanel.tsx index 35733394a..41756953b 100644 --- a/ui/v2.5/src/components/Tags/TagDetails/TagEditPanel.tsx +++ b/ui/v2.5/src/components/Tags/TagDetails/TagEditPanel.tsx @@ -3,8 +3,7 @@ import { FormattedMessage, useIntl } from "react-intl"; import * as GQL from "src/core/generated-graphql"; import * as yup from "yup"; import { DetailsEditNavbar } from "src/components/Shared/DetailsEditNavbar"; -import { Button, Form } from "react-bootstrap"; -import { faPlus } from "@fortawesome/free-solid-svg-icons"; +import { Form } from "react-bootstrap"; import ImageUtils from "src/utils/image"; import { useFormik } from "formik"; import { Prompt } from "react-router-dom"; @@ -12,14 +11,11 @@ import Mousetrap from "mousetrap"; import { LoadingIndicator } from "src/components/Shared/LoadingIndicator"; import isEqual from "lodash-es/isEqual"; import { useToast } from "src/hooks/Toast"; -import { useConfigurationContext } from "src/hooks/Config"; import { handleUnsavedChanges } from "src/utils/navigation"; import { formikUtils } from "src/utils/form"; import { yupFormikValidate, yupUniqueAliases } from "src/utils/yup"; -import { addUpdateStashID, getStashIDs } from "src/utils/stashIds"; +import { getStashIDs } from "src/utils/stashIds"; import { Tag, TagSelect } from "../TagSelect"; -import { Icon } from "src/components/Shared/Icon"; -import StashBoxIDSearchModal from "src/components/Shared/StashBoxIDSearchModal"; interface ITagEditPanel { tag: Partial; @@ -40,13 +36,9 @@ export const TagEditPanel: React.FC = ({ }) => { const intl = useIntl(); const Toast = useToast(); - const { configuration: stashConfig } = useConfigurationContext(); const isNew = tag.id === undefined; - // Editing state - const [isStashIDSearchOpen, setIsStashIDSearchOpen] = useState(false); - // Network state const [isLoading, setIsLoading] = useState(false); @@ -151,14 +143,6 @@ export const TagEditPanel: React.FC = ({ ImageUtils.onImageChange(event, onImageLoad); } - function onStashIDSelected(item?: GQL.StashIdInput) { - if (!item) return; - formik.setFieldValue( - "stash_ids", - addUpdateStashID(formik.values.stash_ids, item) - ); - } - const { renderField, renderInputField, @@ -202,86 +186,54 @@ export const TagEditPanel: React.FC = ({ // TODO: CSS class return ( - <> - {isStashIDSearchOpen && ( - s.endpoint - )} - onSelectItem={(item) => { - onStashIDSelected(item); - setIsStashIDSearchOpen(false); - }} - /> +
+ {isNew && ( +

+ +

)} -
- {isNew && ( -

- -

- )} - - { - // Check if it's a redirect after tag creation - if (action === "PUSH" && location.pathname.startsWith("/tags/")) { - return true; - } - - return handleUnsavedChanges(intl, "tags", tag.id)(location); - }} - /> - -
- {renderInputField("name")} - {renderInputField("sort_name", "text")} - {renderStringListField("aliases")} - {renderInputField("description", "textarea")} - {renderParentTagsField()} - {renderSubTagsField()} - {renderStashIDsField( - "stash_ids", - "tags", - "stash_ids", - undefined, - - )} -
- {renderInputField("ignore_auto_tag", "checkbox")} -
- - { + // Check if it's a redirect after tag creation + if (action === "PUSH" && location.pathname.startsWith("/tags/")) { + return true; } - onImageChange={onImageChange} - onImageChangeURL={onImageLoad} - onClearImage={() => onImageLoad(null)} - onDelete={onDelete} - acceptSVG - /> -
- + + return handleUnsavedChanges(intl, "tags", tag.id)(location); + }} + /> + +
+ {renderInputField("name")} + {renderInputField("sort_name", "text")} + {renderStringListField("aliases")} + {renderInputField("description", "textarea")} + {renderParentTagsField()} + {renderSubTagsField()} + {renderStashIDsField("stash_ids", "tags")} +
+ {renderInputField("ignore_auto_tag", "checkbox")} +
+ + onImageLoad(null)} + onDelete={onDelete} + acceptSVG + /> +
); }; diff --git a/ui/v2.5/src/core/StashService.ts b/ui/v2.5/src/core/StashService.ts index d43d87097..e69d988bf 100644 --- a/ui/v2.5/src/core/StashService.ts +++ b/ui/v2.5/src/core/StashService.ts @@ -2329,23 +2329,6 @@ export const stashBoxSceneQuery = (query: string, stashBoxEndpoint: string) => } ); -export const stashBoxTagQuery = ( - query: string | null, - stashBoxEndpoint: string -) => - client.query({ - query: GQL.ScrapeSingleTagDocument, - variables: { - source: { - stash_box_endpoint: stashBoxEndpoint, - }, - input: { - query: query, - }, - }, - fetchPolicy: "network-only", - }); - export const mutateStashBoxBatchPerformerTag = ( input: GQL.StashBoxBatchTagInput ) => diff --git a/ui/v2.5/src/locales/en-GB.json b/ui/v2.5/src/locales/en-GB.json index f9936345f..c6dbddd26 100644 --- a/ui/v2.5/src/locales/en-GB.json +++ b/ui/v2.5/src/locales/en-GB.json @@ -1015,7 +1015,6 @@ }, "scenes_found": "{count} scenes found", "studios_found": "{count} studios found", - "tags_found": "{count} tags found", "scrape_entity_query": "{entity_type} Scrape Query", "scrape_entity_title": "{entity_type} Scrape Results", "scrape_results_existing": "Existing",