mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Update findGalleries to only fetch imageCount instead of all images (#941)
This commit is contained in:
@@ -10,7 +10,7 @@ import MultiSet from "../Shared/MultiSet";
|
||||
import { RatingStars } from "../Scenes/SceneDetails/RatingStars";
|
||||
|
||||
interface IListOperationProps {
|
||||
selected: GQL.GalleryDataFragment[];
|
||||
selected: GQL.GallerySlimDataFragment[];
|
||||
onClose: (applied: boolean) => void;
|
||||
}
|
||||
|
||||
@@ -134,11 +134,11 @@ export const EditGalleriesDialog: React.FC<IListOperationProps> = (
|
||||
setIsUpdating(false);
|
||||
}
|
||||
|
||||
function getRating(state: GQL.GalleryDataFragment[]) {
|
||||
function getRating(state: GQL.GallerySlimDataFragment[]) {
|
||||
let ret: number | undefined;
|
||||
let first = true;
|
||||
|
||||
state.forEach((gallery: GQL.GalleryDataFragment) => {
|
||||
state.forEach((gallery) => {
|
||||
if (first) {
|
||||
ret = gallery.rating ?? undefined;
|
||||
first = false;
|
||||
@@ -150,11 +150,11 @@ export const EditGalleriesDialog: React.FC<IListOperationProps> = (
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getStudioId(state: GQL.GalleryDataFragment[]) {
|
||||
function getStudioId(state: GQL.GallerySlimDataFragment[]) {
|
||||
let ret: string | undefined;
|
||||
let first = true;
|
||||
|
||||
state.forEach((gallery: GQL.GalleryDataFragment) => {
|
||||
state.forEach((gallery) => {
|
||||
if (first) {
|
||||
ret = gallery?.studio?.id;
|
||||
first = false;
|
||||
@@ -169,11 +169,11 @@ export const EditGalleriesDialog: React.FC<IListOperationProps> = (
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getPerformerIds(state: GQL.GalleryDataFragment[]) {
|
||||
function getPerformerIds(state: GQL.GallerySlimDataFragment[]) {
|
||||
let ret: string[] = [];
|
||||
let first = true;
|
||||
|
||||
state.forEach((gallery: GQL.GalleryDataFragment) => {
|
||||
state.forEach((gallery) => {
|
||||
if (first) {
|
||||
ret = gallery.performers
|
||||
? gallery.performers.map((p) => p.id).sort()
|
||||
@@ -193,11 +193,11 @@ export const EditGalleriesDialog: React.FC<IListOperationProps> = (
|
||||
return ret;
|
||||
}
|
||||
|
||||
function getTagIds(state: GQL.GalleryDataFragment[]) {
|
||||
function getTagIds(state: GQL.GallerySlimDataFragment[]) {
|
||||
let ret: string[] = [];
|
||||
let first = true;
|
||||
|
||||
state.forEach((gallery: GQL.GalleryDataFragment) => {
|
||||
state.forEach((gallery) => {
|
||||
if (first) {
|
||||
ret = gallery.tags ? gallery.tags.map((t) => t.id).sort() : [];
|
||||
first = false;
|
||||
@@ -221,7 +221,7 @@ export const EditGalleriesDialog: React.FC<IListOperationProps> = (
|
||||
let updateTagIds: string[] = [];
|
||||
let first = true;
|
||||
|
||||
state.forEach((gallery: GQL.GalleryDataFragment) => {
|
||||
state.forEach((gallery: GQL.GallerySlimDataFragment) => {
|
||||
const galleryRating = gallery.rating;
|
||||
const GalleriestudioID = gallery?.studio?.id;
|
||||
const galleryPerformerIDs = (gallery.performers ?? [])
|
||||
|
||||
@@ -8,7 +8,7 @@ import { HoverPopover, Icon, TagLink } from "../Shared";
|
||||
import { BasicCard } from "../Shared/BasicCard";
|
||||
|
||||
interface IProps {
|
||||
gallery: GQL.GalleryDataFragment;
|
||||
gallery: GQL.GallerySlimDataFragment;
|
||||
selecting?: boolean;
|
||||
selected: boolean | undefined;
|
||||
zoomIndex: number;
|
||||
@@ -164,9 +164,9 @@ export const GalleryCard: React.FC<IProps> = (props) => {
|
||||
</h5>
|
||||
</Link>
|
||||
<span>
|
||||
{props.gallery.images.length}
|
||||
{props.gallery.image_count}
|
||||
<FormattedPlural
|
||||
value={props.gallery.images.length ?? 0}
|
||||
value={props.gallery.image_count}
|
||||
one="image"
|
||||
other="images"
|
||||
/>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Table } from "react-bootstrap";
|
||||
import { Link, useHistory } from "react-router-dom";
|
||||
import {
|
||||
FindGalleriesQueryResult,
|
||||
GalleryDataFragment,
|
||||
GallerySlimDataFragment,
|
||||
} from "src/core/generated-graphql";
|
||||
import { useGalleriesList } from "src/hooks";
|
||||
import { showWhenSelected } from "src/hooks/ListHook";
|
||||
@@ -127,7 +127,7 @@ export const GalleryList: React.FC<IGalleryList> = ({
|
||||
}
|
||||
|
||||
function renderEditGalleriesDialog(
|
||||
selectedImages: GalleryDataFragment[],
|
||||
selectedImages: GallerySlimDataFragment[],
|
||||
onClose: (applied: boolean) => void
|
||||
) {
|
||||
return (
|
||||
@@ -138,7 +138,7 @@ export const GalleryList: React.FC<IGalleryList> = ({
|
||||
}
|
||||
|
||||
function renderDeleteGalleriesDialog(
|
||||
selectedImages: GalleryDataFragment[],
|
||||
selectedImages: GallerySlimDataFragment[],
|
||||
onClose: (confirmed: boolean) => void
|
||||
) {
|
||||
return (
|
||||
@@ -200,8 +200,8 @@ export const GalleryList: React.FC<IGalleryList> = ({
|
||||
</td>
|
||||
<td className="d-none d-sm-block">
|
||||
<Link to={`/galleries/${gallery.id}`}>
|
||||
{gallery.title ?? gallery.path} ({gallery.images.length}{" "}
|
||||
{gallery.images.length === 1 ? "image" : "images"})
|
||||
{gallery.title ?? gallery.path} ({gallery.image_count}{" "}
|
||||
{gallery.image_count === 1 ? "image" : "images"})
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user