mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +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 [availableServers, setAvailableServers] =
|
||||
useState<PlexDevice[] | null>(null);
|
||||
const {
|
||||
data: data,
|
||||
error: error,
|
||||
revalidate: revalidate,
|
||||
} = useSWR<PlexSettings>('/api/v1/settings/plex');
|
||||
const { data, error, revalidate } = useSWR<PlexSettings>(
|
||||
'/api/v1/settings/plex'
|
||||
);
|
||||
const { data: dataSync, revalidate: revalidateSync } = useSWR<SyncStatus>(
|
||||
'/api/v1/settings/plex/sync',
|
||||
{
|
||||
@@ -540,7 +538,10 @@ const SettingsPlex: React.FC<SettingsPlexProps> = ({ onComplete }) => {
|
||||
</p>
|
||||
</div>
|
||||
<div className="section">
|
||||
<Button onClick={() => syncLibraries()} disabled={isSyncing}>
|
||||
<Button
|
||||
onClick={() => syncLibraries()}
|
||||
disabled={isSyncing || !data?.ip || !data?.port}
|
||||
>
|
||||
<RefreshIcon
|
||||
className={isSyncing ? 'animate-spin' : ''}
|
||||
style={{ animationDirection: 'reverse' }}
|
||||
@@ -619,7 +620,11 @@ const SettingsPlex: React.FC<SettingsPlexProps> = ({ onComplete }) => {
|
||||
)}
|
||||
<div className="flex-1 text-right">
|
||||
{!dataSync?.running ? (
|
||||
<Button buttonType="warning" onClick={() => startScan()}>
|
||||
<Button
|
||||
buttonType="warning"
|
||||
onClick={() => startScan()}
|
||||
disabled={isSyncing || !activeLibraries.length}
|
||||
>
|
||||
<SearchIcon />
|
||||
<span>{intl.formatMessage(messages.startscan)}</span>
|
||||
</Button>
|
||||
|
Reference in New Issue
Block a user