0.11.0-4 lw

This commit is contained in:
2026-03-17 20:28:38 +00:00
parent 654a77b8ba
commit 38fc1778f7
11 changed files with 156 additions and 11 deletions
@@ -7,6 +7,7 @@ import { InputSwitch } from 'primereact/inputswitch';
import { Dropdown } from 'primereact/dropdown';
import { Tag } from 'primereact/tag';
import { Button } from 'primereact/button';
import { api } from '../api/client';
function normalizeText(value) {
return String(value || '').trim().toLowerCase();
@@ -49,6 +50,7 @@ const PUSHOVER_ENABLED_SETTING_KEY = 'pushover_enabled';
const EXPERT_MODE_SETTING_KEY = 'ui_expert_mode';
const ALWAYS_HIDDEN_SETTING_KEYS = new Set([
'drive_device',
'makemkv_source_index', // auto-derived from drive path — shown as read-only in drive info
'makemkv_rip_mode',
'makemkv_rip_mode_bluray',
'makemkv_rip_mode_dvd',
@@ -58,7 +60,6 @@ const EXPERT_ONLY_SETTING_KEYS = new Set([
'pushover_device',
'pushover_priority',
'pushover_timeout_ms',
'makemkv_source_index',
'disc_poll_interval_ms',
'hardware_monitoring_interval_ms',
'makemkv_command',
@@ -177,6 +178,64 @@ function DriveDevicesEditor({ value, onChange, settingKey }) {
);
}
function DetectedDrivesInfo() {
const [drives, setDrives] = useState(null);
const [loading, setLoading] = useState(false);
const load = () => {
setLoading(true);
api.getDetectedDrives()
.then((res) => setDrives(Array.isArray(res?.drives) ? res.drives : []))
.catch(() => setDrives([]))
.finally(() => setLoading(false));
};
useEffect(() => { load(); }, []);
return (
<div className="detected-drives-info">
<div className="detected-drives-header">
<span className="detected-drives-label">Erkannte optische Laufwerke</span>
<Button
icon="pi pi-refresh"
text
rounded
size="small"
loading={loading}
onClick={load}
type="button"
aria-label="Laufwerke neu einlesen"
title="Laufwerke neu einlesen"
/>
</div>
{drives === null || loading
? <span className="detected-drives-empty">Wird geladen</span>
: drives.length === 0
? <span className="detected-drives-empty">Keine optischen Laufwerke erkannt.</span>
: (
<table className="detected-drives-table">
<thead>
<tr>
<th>Gerät</th>
<th>Modell</th>
<th>MakeMKV Index</th>
</tr>
</thead>
<tbody>
{drives.map((d) => (
<tr key={d.path}>
<td><code>{d.path}</code></td>
<td>{d.model || '—'}</td>
<td><Tag value={d.discArg ?? '—'} severity="info" /></td>
</tr>
))}
</tbody>
</table>
)}
</div>
);
}
function shouldHideSettingByExpertMode(settingKey, expertModeEnabled) {
const key = normalizeSettingKey(settingKey);
if (!key) {
@@ -688,8 +747,10 @@ export default function DynamicSettingsForm({
const isNotificationCategory = normalizeText(category?.category) === 'benachrichtigungen';
const pushoverEnabled = toBoolean(values?.[PUSHOVER_ENABLED_SETTING_KEY]);
const isDriveCategory = normalizeText(category?.category) === 'laufwerk';
return (
<div className="settings-sections">
{isDriveCategory && <DetectedDrivesInfo />}
{sections.map((section) => (
<section
key={`${category?.category || 'category'}-${section.id}`}