From 7450138ac12640797952c1a2d5e1e111d17a11e1 Mon Sep 17 00:00:00 2001 From: notfakie <103784113+notfakie@users.noreply.github.com> Date: Thu, 2 Jun 2022 18:47:27 +1200 Subject: [PATCH] fix: hide plex guid cache settings from ui when running in jellyfin/emby mode --- .../Settings/SettingsJobsCache/index.tsx | 46 ++++++++++++------- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/src/components/Settings/SettingsJobsCache/index.tsx b/src/components/Settings/SettingsJobsCache/index.tsx index 35e445cba..cfe8c4bfc 100644 --- a/src/components/Settings/SettingsJobsCache/index.tsx +++ b/src/components/Settings/SettingsJobsCache/index.tsx @@ -10,9 +10,11 @@ import { } from 'react-intl'; import { useToasts } from 'react-toast-notifications'; import useSWR from 'swr'; +import { MediaServerType } from '../../../../server/constants/server'; import { CacheItem } from '../../../../server/interfaces/api/settingsInterfaces'; import { JobId } from '../../../../server/lib/settings'; import Spinner from '../../../assets/spinner.svg'; +import useSettings from '../../../hooks/useSettings'; import globalMessages from '../../../i18n/globalMessages'; import { formatBytes } from '../../../utils/numberHelpers'; import Badge from '../../Common/Badge'; @@ -102,6 +104,7 @@ const SettingsJobs: React.FC = () => { const [isSaving, setIsSaving] = useState(false); const [jobScheduleMinutes, setJobScheduleMinutes] = useState(5); const [jobScheduleHours, setJobScheduleHours] = useState(1); + const settings = useSettings(); if (!data && !error) { return ; @@ -369,22 +372,33 @@ const SettingsJobs: React.FC = () => { - {cacheData?.map((cache) => ( - - {cache.name} - {intl.formatNumber(cache.stats.hits)} - {intl.formatNumber(cache.stats.misses)} - {intl.formatNumber(cache.stats.keys)} - {formatBytes(cache.stats.ksize)} - {formatBytes(cache.stats.vsize)} - - - - - ))} + {cacheData + ?.filter( + (cache) => + !( + settings.currentSettings.mediaServerType !== + MediaServerType.PLEX && cache.id === 'plexguid' + ) + ) + .map((cache) => ( + + {cache.name} + {intl.formatNumber(cache.stats.hits)} + {intl.formatNumber(cache.stats.misses)} + {intl.formatNumber(cache.stats.keys)} + {formatBytes(cache.stats.ksize)} + {formatBytes(cache.stats.vsize)} + + + + + ))}