-
-
-
+
+ )}
@@ -350,104 +352,21 @@ export default function DeviceDetailOverlay({
/>
-
-
-
- {
- const path = getDevicePath();
- updateDeviceSetting([...path, 'base_url'], e.target.value);
- }}
- className="flex-1 px-3 py-2 border border-neutral-300 rounded-lg"
- />
- setBrowsingField('base_url')}
- className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-neutral-100"
- title="Browse"
- >
-
-
- {
- const path = getDevicePath();
- updateDeviceSetting([...path, 'base_url'], '');
- }}
- className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-red-50 hover:border-red-300 hover:text-red-500"
- title="Clear Base URL"
- >
-
-
-
-
-
-
-
-
- {
- const newUrl = e.target.value;
- const devicePath = getDevicePath();
- const newConfig = JSON.parse(JSON.stringify(config));
- let dev = newConfig;
- for (const k of devicePath) dev = dev[k];
- if (isOutsideBase(newUrl, dev.base_url || '')) clearBaseAndCache(dev);
- dev.url = newUrl;
- setConfig(newConfig);
- }}
- className="flex-1 px-3 py-2 border border-neutral-300 rounded-lg"
- />
- setBrowsingField('url')}
- className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-neutral-100"
- title="Browse"
- >
-
-
- {
- const devicePath = getDevicePath();
- const newConfig = JSON.parse(JSON.stringify(config));
- let dev = newConfig;
- for (const k of devicePath) dev = dev[k];
- delete dev.url;
- delete dev.media_set;
- setConfig(newConfig);
- }}
- className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-red-50 hover:border-red-300 hover:text-red-500"
- title="Clear URL and media set"
- >
-
-
-
-
- {mediaSetFiles && (
-
-
-
- )}
-
-
- {(deviceData.cache !== undefined ||
- (deviceData.base_url ?? '').includes('://') ||
- (deviceData.url ?? '').includes('://')) && (
+ {!device.physical && <>
-
+
{
const path = getDevicePath();
- updateDeviceSetting([...path, 'cache'], e.target.value);
+ updateDeviceSetting([...path, 'base_url'], e.target.value);
}}
className="flex-1 px-3 py-2 border border-neutral-300 rounded-lg"
/>
setBrowsingField('cache')}
+ onClick={() => setBrowsingField('base_url')}
className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-neutral-100"
title="Browse"
>
@@ -456,35 +375,125 @@ export default function DeviceDetailOverlay({
{
const path = getDevicePath();
- updateDeviceSetting([...path, 'cache'], '');
+ updateDeviceSetting([...path, 'base_url'], '');
}}
className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-red-50 hover:border-red-300 hover:text-red-500"
- title="Clear Cache"
+ title="Clear Base URL"
>
- )}
+
+
+
+
+ {
+ const newUrl = e.target.value;
+ const devicePath = getDevicePath();
+ const newConfig = JSON.parse(JSON.stringify(config));
+ let dev = newConfig;
+ for (const k of devicePath) dev = dev[k];
+ if (isOutsideBase(newUrl, dev.base_url || '')) clearBaseAndCache(dev);
+ dev.url = newUrl;
+ setConfig(newConfig);
+ }}
+ className="flex-1 px-3 py-2 border border-neutral-300 rounded-lg"
+ />
+ setBrowsingField('url')}
+ className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-neutral-100"
+ title="Browse"
+ >
+
+
+ {
+ const devicePath = getDevicePath();
+ const newConfig = JSON.parse(JSON.stringify(config));
+ let dev = newConfig;
+ for (const k of devicePath) dev = dev[k];
+ delete dev.url;
+ delete dev.media_set;
+ setConfig(newConfig);
+ }}
+ className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-red-50 hover:border-red-300 hover:text-red-500"
+ title="Clear URL and media set"
+ >
+
+
+
+
+ {mediaSetFiles && (
+
+
+
+ )}
+
+
+ {(deviceData.cache !== undefined ||
+ (deviceData.base_url ?? '').includes('://') ||
+ (deviceData.url ?? '').includes('://')) && (
+
+
+
+ {
+ const path = getDevicePath();
+ updateDeviceSetting([...path, 'cache'], e.target.value);
+ }}
+ className="flex-1 px-3 py-2 border border-neutral-300 rounded-lg"
+ />
+ setBrowsingField('cache')}
+ className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-neutral-100"
+ title="Browse"
+ >
+
+
+ {
+ const path = getDevicePath();
+ updateDeviceSetting([...path, 'cache'], '');
+ }}
+ className="px-3 py-2 border border-neutral-300 rounded-lg bg-neutral-50 hover:bg-red-50 hover:border-red-300 hover:text-red-500"
+ title="Clear Cache"
+ >
+
+
+
+
+ )}
+ >}
{deviceData.mode !== undefined && (
-
- {([0, 1] as const).map((val, i) => (
- updateDeviceSetting([...getDevicePath(), 'mode'], val)}
- className={`px-4 py-2 ${i > 0 ? 'border-l border-neutral-300' : ''} ${
- (deviceData.mode ?? 0) === val
- ? 'bg-blue-600 text-white'
- : 'bg-white text-neutral-700 hover:bg-neutral-50'
- }`}
- >
- {val === 0 ? 'Read Only' : 'Write Enabled'}
-
- ))}
-
+ {device.physical
+ ?
+ {(deviceData.mode ?? 0) === 0 ? 'Read Only' : 'Write Enabled'}
+
+ :
+ {([0, 1] as const).map((val, i) => (
+ updateDeviceSetting([...getDevicePath(), 'mode'], val)}
+ className={`px-4 py-2 ${i > 0 ? 'border-l border-neutral-300' : ''} ${
+ (deviceData.mode ?? 0) === val
+ ? 'bg-blue-600 text-white'
+ : 'bg-white text-neutral-700 hover:bg-neutral-50'
+ }`}
+ >
+ {val === 0 ? 'Read Only' : 'Write Enabled'}
+
+ ))}
+
+ }
)}