mirror of https://github.com/stashapp/stash.git
Create movies from scene edit dropdown (#3928)
This commit is contained in:
parent
424aad8307
commit
9f2d12834b
|
@ -90,6 +90,7 @@ fragment ConfigInterfaceData on ConfigInterfaceResult {
|
|||
performer
|
||||
tag
|
||||
studio
|
||||
movie
|
||||
}
|
||||
handyKey
|
||||
funscriptOffset
|
||||
|
|
|
@ -269,6 +269,7 @@ input ConfigDisableDropdownCreateInput {
|
|||
performer: Boolean
|
||||
tag: Boolean
|
||||
studio: Boolean
|
||||
movie: Boolean
|
||||
}
|
||||
|
||||
enum ImageLightboxDisplayMode {
|
||||
|
@ -366,6 +367,7 @@ type ConfigDisableDropdownCreate {
|
|||
performer: Boolean!
|
||||
tag: Boolean!
|
||||
studio: Boolean!
|
||||
movie: Boolean!
|
||||
}
|
||||
|
||||
type ConfigInterfaceResult {
|
||||
|
|
|
@ -469,6 +469,7 @@ func (r *mutationResolver) ConfigureInterface(ctx context.Context, input ConfigI
|
|||
setBool(config.DisableDropdownCreatePerformer, ddc.Performer)
|
||||
setBool(config.DisableDropdownCreateStudio, ddc.Studio)
|
||||
setBool(config.DisableDropdownCreateTag, ddc.Tag)
|
||||
setBool(config.DisableDropdownCreateMovie, ddc.Movie)
|
||||
}
|
||||
|
||||
if input.HandyKey != nil {
|
||||
|
|
|
@ -189,6 +189,7 @@ const (
|
|||
DisableDropdownCreatePerformer = "disable_dropdown_create.performer"
|
||||
DisableDropdownCreateStudio = "disable_dropdown_create.studio"
|
||||
DisableDropdownCreateTag = "disable_dropdown_create.tag"
|
||||
DisableDropdownCreateMovie = "disable_dropdown_create.movie"
|
||||
|
||||
HandyKey = "handy_key"
|
||||
FunscriptOffset = "funscript_offset"
|
||||
|
@ -1096,6 +1097,7 @@ func (i *Instance) GetDisableDropdownCreate() *ConfigDisableDropdownCreate {
|
|||
Performer: i.getBool(DisableDropdownCreatePerformer),
|
||||
Studio: i.getBool(DisableDropdownCreateStudio),
|
||||
Tag: i.getBool(DisableDropdownCreateTag),
|
||||
Movie: i.getBool(DisableDropdownCreateMovie),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -112,6 +112,7 @@ func TestConcurrentConfigAccess(t *testing.T) {
|
|||
i.Set(DisableDropdownCreatePerformer, i.GetDisableDropdownCreate().Performer)
|
||||
i.Set(DisableDropdownCreateStudio, i.GetDisableDropdownCreate().Studio)
|
||||
i.Set(DisableDropdownCreateTag, i.GetDisableDropdownCreate().Tag)
|
||||
i.Set(DisableDropdownCreateMovie, i.GetDisableDropdownCreate().Movie)
|
||||
i.Set(AutostartVideoOnPlaySelected, i.GetAutostartVideoOnPlaySelected())
|
||||
i.Set(ContinuePlaylistDefault, i.GetContinuePlaylistDefault())
|
||||
i.Set(PythonPath, i.GetPythonPath())
|
||||
|
|
|
@ -103,4 +103,5 @@ type ConfigDisableDropdownCreate struct {
|
|||
Performer bool `json:"performer"`
|
||||
Tag bool `json:"tag"`
|
||||
Studio bool `json:"studio"`
|
||||
Movie bool `json:"movie"`
|
||||
}
|
||||
|
|
|
@ -549,6 +549,19 @@ export const SettingsInterfacePanel: React.FC = () => {
|
|||
})
|
||||
}
|
||||
/>
|
||||
<BooleanSetting
|
||||
id="disableDropdownCreate_movie"
|
||||
headingID="movie"
|
||||
checked={iface.disableDropdownCreate?.movie ?? undefined}
|
||||
onChange={(v) =>
|
||||
saveInterface({
|
||||
disableDropdownCreate: {
|
||||
...iface.disableDropdownCreate,
|
||||
movie: v,
|
||||
},
|
||||
})
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
<NumberSetting
|
||||
id="max_options_shown"
|
||||
|
|
|
@ -21,6 +21,7 @@ import {
|
|||
useTagCreate,
|
||||
useStudioCreate,
|
||||
usePerformerCreate,
|
||||
useMovieCreate,
|
||||
} from "src/core/StashService";
|
||||
import { useToast } from "src/hooks/Toast";
|
||||
import { SelectComponents } from "react-select/dist/declarations/src/components";
|
||||
|
@ -650,7 +651,10 @@ export const PerformerSelect: React.FC<IFilterProps> = (props) => {
|
|||
});
|
||||
return {
|
||||
item: result.data!.performerCreate!,
|
||||
message: "Created performer",
|
||||
message: intl.formatMessage(
|
||||
{ id: "toast.created_entity" },
|
||||
{ entity: intl.formatMessage({ id: "performer" }).toLocaleLowerCase() }
|
||||
),
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -760,7 +764,13 @@ export const StudioSelect: React.FC<
|
|||
input: { name },
|
||||
},
|
||||
});
|
||||
return { item: result.data!.studioCreate!, message: "Created studio" };
|
||||
return {
|
||||
item: result.data!.studioCreate!,
|
||||
message: intl.formatMessage(
|
||||
{ id: "toast.created_entity" },
|
||||
{ entity: intl.formatMessage({ id: "studio" }).toLocaleLowerCase() }
|
||||
),
|
||||
};
|
||||
};
|
||||
|
||||
const isValidNewOption = (
|
||||
|
@ -812,9 +822,27 @@ export const StudioSelect: React.FC<
|
|||
|
||||
export const MovieSelect: React.FC<IFilterProps> = (props) => {
|
||||
const { data, loading } = useAllMoviesForFilter();
|
||||
const [createMovie] = useMovieCreate();
|
||||
const items = data?.allMovies ?? [];
|
||||
const intl = useIntl();
|
||||
|
||||
const { configuration } = React.useContext(ConfigurationContext);
|
||||
const defaultCreatable =
|
||||
!configuration?.interface.disableDropdownCreate.movie ?? true;
|
||||
|
||||
const onCreate = async (name: string) => {
|
||||
const result = await createMovie({
|
||||
variables: { input: { name } },
|
||||
});
|
||||
return {
|
||||
item: result.data!.movieCreate!,
|
||||
message: intl.formatMessage(
|
||||
{ id: "toast.created_entity" },
|
||||
{ entity: intl.formatMessage({ id: "movie" }).toLocaleLowerCase() }
|
||||
),
|
||||
};
|
||||
};
|
||||
|
||||
return (
|
||||
<FilterSelectComponent
|
||||
{...props}
|
||||
|
@ -829,6 +857,8 @@ export const MovieSelect: React.FC<IFilterProps> = (props) => {
|
|||
{ entityType: intl.formatMessage({ id: "movie" }) }
|
||||
)
|
||||
}
|
||||
creatable={props.creatable ?? defaultCreatable}
|
||||
onCreate={onCreate}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -927,7 +957,13 @@ export const TagSelect: React.FC<
|
|||
},
|
||||
},
|
||||
});
|
||||
return { item: result.data!.tagCreate!, message: "Created tag" };
|
||||
return {
|
||||
item: result.data!.tagCreate!,
|
||||
message: intl.formatMessage(
|
||||
{ id: "toast.created_entity" },
|
||||
{ entity: intl.formatMessage({ id: "tag" }).toLocaleLowerCase() }
|
||||
),
|
||||
};
|
||||
};
|
||||
|
||||
const isValidNewOption = (
|
||||
|
|
Loading…
Reference in New Issue