mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Fix studio editing (#1668)
This commit is contained in:
@@ -30,7 +30,7 @@ import {
|
|||||||
Modal,
|
Modal,
|
||||||
TagSelect,
|
TagSelect,
|
||||||
} from "src/components/Shared";
|
} from "src/components/Shared";
|
||||||
import { ImageUtils } from "src/utils";
|
import { ImageUtils, getStashIDs } from "src/utils";
|
||||||
import { getCountryByISO } from "src/utils/country";
|
import { getCountryByISO } from "src/utils/country";
|
||||||
import { useToast } from "src/hooks";
|
import { useToast } from "src/hooks";
|
||||||
import { Prompt, useHistory } from "react-router-dom";
|
import { Prompt, useHistory } from "react-router-dom";
|
||||||
@@ -380,10 +380,7 @@ export const PerformerEditPanel: React.FC<IPerformerDetails> = ({
|
|||||||
variables: {
|
variables: {
|
||||||
input: {
|
input: {
|
||||||
...input,
|
...input,
|
||||||
stash_ids: performerInput?.stash_ids?.map((s) => ({
|
stash_ids: getStashIDs(performerInput?.stash_ids),
|
||||||
endpoint: s.endpoint,
|
|
||||||
stash_id: s.stash_id,
|
|
||||||
})),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import {
|
|||||||
ImageInput,
|
ImageInput,
|
||||||
} from "src/components/Shared";
|
} from "src/components/Shared";
|
||||||
import { useToast } from "src/hooks";
|
import { useToast } from "src/hooks";
|
||||||
import { ImageUtils, FormUtils, TextUtils } from "src/utils";
|
import { ImageUtils, FormUtils, TextUtils, getStashIDs } from "src/utils";
|
||||||
import { MovieSelect } from "src/components/Shared/Select";
|
import { MovieSelect } from "src/components/Shared/Select";
|
||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import { Prompt } from "react-router";
|
import { Prompt } from "react-router";
|
||||||
@@ -110,10 +110,7 @@ export const SceneEditPanel: React.FC<IProps> = ({
|
|||||||
}),
|
}),
|
||||||
tag_ids: (scene.tags ?? []).map((t) => t.id),
|
tag_ids: (scene.tags ?? []).map((t) => t.id),
|
||||||
cover_image: undefined,
|
cover_image: undefined,
|
||||||
stash_ids: (scene.stash_ids ?? []).map((s) => ({
|
stash_ids: getStashIDs(scene.stash_ids),
|
||||||
stash_id: s.stash_id,
|
|
||||||
endpoint: s.endpoint,
|
|
||||||
})),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type InputValues = typeof initialValues;
|
type InputValues = typeof initialValues;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import * as yup from "yup";
|
|||||||
import Mousetrap from "mousetrap";
|
import Mousetrap from "mousetrap";
|
||||||
import { Icon, StudioSelect, DetailsEditNavbar } from "src/components/Shared";
|
import { Icon, StudioSelect, DetailsEditNavbar } from "src/components/Shared";
|
||||||
import { Button, Form, Col, Row } from "react-bootstrap";
|
import { Button, Form, Col, Row } from "react-bootstrap";
|
||||||
import { FormUtils, ImageUtils } from "src/utils";
|
import { FormUtils, ImageUtils, getStashIDs } from "src/utils";
|
||||||
import { RatingStars } from "src/components/Scenes/SceneDetails/RatingStars";
|
import { RatingStars } from "src/components/Scenes/SceneDetails/RatingStars";
|
||||||
import { useFormik } from "formik";
|
import { useFormik } from "formik";
|
||||||
import { Prompt } from "react-router-dom";
|
import { Prompt } from "react-router-dom";
|
||||||
@@ -74,6 +74,7 @@ export const StudioEditPanel: React.FC<IStudioEditPanel> = ({
|
|||||||
function getStudioInput(values: InputValues) {
|
function getStudioInput(values: InputValues) {
|
||||||
const input: Partial<GQL.StudioCreateInput | GQL.StudioUpdateInput> = {
|
const input: Partial<GQL.StudioCreateInput | GQL.StudioUpdateInput> = {
|
||||||
...values,
|
...values,
|
||||||
|
stash_ids: getStashIDs(values.stash_ids),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (studio && studio.id) {
|
if (studio && studio.id) {
|
||||||
|
|||||||
@@ -12,3 +12,4 @@ export { default as getISOCountry } from "./country";
|
|||||||
export { default as useFocus } from "./focus";
|
export { default as useFocus } from "./focus";
|
||||||
export { default as downloadFile } from "./download";
|
export { default as downloadFile } from "./download";
|
||||||
export * from "./data";
|
export * from "./data";
|
||||||
|
export { getStashIDs } from "./stashIds";
|
||||||
|
|||||||
5
ui/v2.5/src/utils/stashIds.ts
Normal file
5
ui/v2.5/src/utils/stashIds.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
export const getStashIDs = (ids?: { stash_id: string; endpoint: string }[]) =>
|
||||||
|
(ids ?? []).map(({ stash_id, endpoint }) => ({
|
||||||
|
stash_id,
|
||||||
|
endpoint,
|
||||||
|
}));
|
||||||
Reference in New Issue
Block a user