mirror of
https://github.com/sct/overseerr.git
synced 2025-09-26 20:12:33 +02:00
fix(plex): disable library sync if Plex not configured, and disable scan if no libraries (#1764)
This commit is contained in:
@@ -94,11 +94,9 @@ const SettingsPlex: React.FC<SettingsPlexProps> = ({ onComplete }) => {
|
|||||||
const [isRefreshingPresets, setIsRefreshingPresets] = useState(false);
|
const [isRefreshingPresets, setIsRefreshingPresets] = useState(false);
|
||||||
const [availableServers, setAvailableServers] =
|
const [availableServers, setAvailableServers] =
|
||||||
useState<PlexDevice[] | null>(null);
|
useState<PlexDevice[] | null>(null);
|
||||||
const {
|
const { data, error, revalidate } = useSWR<PlexSettings>(
|
||||||
data: data,
|
'/api/v1/settings/plex'
|
||||||
error: error,
|
);
|
||||||
revalidate: revalidate,
|
|
||||||
} = useSWR<PlexSettings>('/api/v1/settings/plex');
|
|
||||||
const { data: dataSync, revalidate: revalidateSync } = useSWR<SyncStatus>(
|
const { data: dataSync, revalidate: revalidateSync } = useSWR<SyncStatus>(
|
||||||
'/api/v1/settings/plex/sync',
|
'/api/v1/settings/plex/sync',
|
||||||
{
|
{
|
||||||
@@ -540,7 +538,10 @@ const SettingsPlex: React.FC<SettingsPlexProps> = ({ onComplete }) => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="section">
|
<div className="section">
|
||||||
<Button onClick={() => syncLibraries()} disabled={isSyncing}>
|
<Button
|
||||||
|
onClick={() => syncLibraries()}
|
||||||
|
disabled={isSyncing || !data?.ip || !data?.port}
|
||||||
|
>
|
||||||
<RefreshIcon
|
<RefreshIcon
|
||||||
className={isSyncing ? 'animate-spin' : ''}
|
className={isSyncing ? 'animate-spin' : ''}
|
||||||
style={{ animationDirection: 'reverse' }}
|
style={{ animationDirection: 'reverse' }}
|
||||||
@@ -619,7 +620,11 @@ const SettingsPlex: React.FC<SettingsPlexProps> = ({ onComplete }) => {
|
|||||||
)}
|
)}
|
||||||
<div className="flex-1 text-right">
|
<div className="flex-1 text-right">
|
||||||
{!dataSync?.running ? (
|
{!dataSync?.running ? (
|
||||||
<Button buttonType="warning" onClick={() => startScan()}>
|
<Button
|
||||||
|
buttonType="warning"
|
||||||
|
onClick={() => startScan()}
|
||||||
|
disabled={isSyncing || !activeLibraries.length}
|
||||||
|
>
|
||||||
<SearchIcon />
|
<SearchIcon />
|
||||||
<span>{intl.formatMessage(messages.startscan)}</span>
|
<span>{intl.formatMessage(messages.startscan)}</span>
|
||||||
</Button>
|
</Button>
|
||||||
|
Reference in New Issue
Block a user