chore: release v0.26.4
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
||||
ChevronDown, ChevronRight,
|
||||
User, Database, Radio, Cog, Server, Antenna as AntennaIcon,
|
||||
Compass, Wifi, Construction, UploadCloud, Loader2, FolderOpen, Play, Power, Check, Pencil,
|
||||
Minimize2,
|
||||
} from 'lucide-react';
|
||||
import {
|
||||
GetLookupSettings, SaveLookupSettings, ClearLookupCache, TestLookupProvider,
|
||||
@@ -12,7 +13,7 @@ import {
|
||||
ListProfiles, GetActiveProfile, SaveProfile, DeleteProfile, ActivateProfile, DuplicateProfile,
|
||||
GetRotators, SaveRotators, TestRotatorDevice, RotatorPark, RotatorStop,
|
||||
GetRotorPresets, SaveRotorPresets, ResetRotorPresets,
|
||||
GetUltrabeamSettings, SaveUltrabeamSettings, TestUltrabeam,
|
||||
GetUltrabeamSettings, SaveUltrabeamSettings, TestUltrabeam, CompactDatabase,
|
||||
GetAntGeniusSettings, SaveAntGeniusSettings,
|
||||
GetTunerGeniusSettings, SaveTunerGeniusSettings,
|
||||
GetPSUSettings, SavePSUSettings,
|
||||
@@ -1838,6 +1839,16 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
};
|
||||
// A date for a person: the day, not the timestamp the backend stores.
|
||||
const fmtDay = (v?: string) => (v ? String(v).slice(0, 10) : '—');
|
||||
// Binary units, one decimal, because the point of showing a size here is to
|
||||
// compare two of them: "412.7 MB → 38.4 MB" says what a bare byte count does not.
|
||||
const fmtBytes = (n: number) => {
|
||||
if (!n || n < 0) return '—';
|
||||
const u = ['B', 'KB', 'MB', 'GB'];
|
||||
let i = 0;
|
||||
let v = n;
|
||||
while (v >= 1024 && i < u.length - 1) { v /= 1024; i++; }
|
||||
return `${i === 0 ? v : v.toFixed(1)} ${u[i]}`;
|
||||
};
|
||||
const [rdaCount, setRdaCount] = useState(0);
|
||||
const [rdaBusy, setRdaBusy] = useState(false);
|
||||
const [rdaUseCurrent, setRdaUseCurrent] = useState(true);
|
||||
@@ -3591,6 +3602,7 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
options={wkPorts}
|
||||
allowFreeText
|
||||
commitOnType
|
||||
showToggle
|
||||
placeholder="COM3"
|
||||
className="font-mono flex-1"
|
||||
onChange={(v) => setUltrabeam((s) => ({ ...s, com: v.trim().toUpperCase() }))}
|
||||
@@ -6166,6 +6178,24 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
}
|
||||
|
||||
function DatabasePanel() {
|
||||
// Compacting: which database is running, and what the last one saved.
|
||||
// SQLite frees pages inside the file and never shrinks it, so this is the
|
||||
// only thing that gives the disk space back after a large delete.
|
||||
const [compacting, setCompacting] = useState('');
|
||||
const [compactMsg, setCompactMsg] = useState<Record<string, string>>({});
|
||||
function compact(target: 'settings' | 'logbook') {
|
||||
setCompacting(target);
|
||||
setCompactMsg((m) => ({ ...m, [target]: '' }));
|
||||
CompactDatabase(target)
|
||||
.then((r: any) => {
|
||||
const msg = r?.backend === 'mysql'
|
||||
? t('db.compactMysqlDone')
|
||||
: t('db.compactDone', { before: fmtBytes(r?.before ?? 0), after: fmtBytes(r?.after ?? 0) });
|
||||
setCompactMsg((m) => ({ ...m, [target]: msg }));
|
||||
})
|
||||
.catch((e: any) => setErr(String(e?.message ?? e)))
|
||||
.finally(() => setCompacting(''));
|
||||
}
|
||||
async function refreshDb() { try { setDbSettings(await GetDatabaseSettings() as any); } catch {} }
|
||||
async function refreshBackend() { try { setBackendStatus(await GetDBBackendStatus() as any); } catch {} }
|
||||
// The chosen file is persisted (config.json) the moment it's picked; dbMsg
|
||||
@@ -6285,9 +6315,13 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
<Button variant="outline" size="sm" onClick={renameDb} title={t('db.renameTip')}><Pencil className="size-3.5" /> {t('db.rename')}</Button>
|
||||
{/* Pushed right: these two act on the file that is already there,
|
||||
while the four on the left change WHICH file is in use. */}
|
||||
<Button variant="outline" size="sm" className="ml-auto" onClick={revealFolder}><FolderOpen className="size-3.5" /> {t('db.openFolder')}</Button>
|
||||
<Button variant="outline" size="sm" className="ml-auto" onClick={() => compact('settings')} disabled={compacting !== ''}>
|
||||
{compacting === 'settings' ? <Loader2 className="size-3.5 animate-spin" /> : <Minimize2 className="size-3.5" />} {t('db.compact')}
|
||||
</Button>
|
||||
<Button variant="outline" size="sm" onClick={revealFolder}><FolderOpen className="size-3.5" /> {t('db.openFolder')}</Button>
|
||||
{dbSettings.is_custom && <Button variant="ghost" size="sm" onClick={resetDefault}>{t('db.resetDefault')}</Button>}
|
||||
</div>
|
||||
{compactMsg.settings && <p className="text-[11px] text-success">{compactMsg.settings}</p>}
|
||||
{/* The DB pointer is only read at startup, so offer the restart inline. */}
|
||||
{dbMsg && (
|
||||
<div className="text-[11px] text-success space-y-1 pt-1">
|
||||
@@ -6350,8 +6384,12 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
<Button variant="outline" size="sm" onClick={newLogbook}><Plus className="size-3.5" /> {t('db.newDb')}</Button>
|
||||
<Button variant="outline" size="sm" onClick={openLogbook}><FolderOpen className="size-3.5" /> {t('db.openExisting')}</Button>
|
||||
<Button variant="outline" size="sm" onClick={renameLogbook} title={t('db.renameLogbookTip')}><Pencil className="size-3.5" /> {t('db.renameLogbook')}</Button>
|
||||
<Button variant="outline" size="sm" className="ml-auto" onClick={() => compact('logbook')} disabled={compacting !== ''}>
|
||||
{compacting === 'logbook' ? <Loader2 className="size-3.5 animate-spin" /> : <Minimize2 className="size-3.5" />} {t('db.compact')}
|
||||
</Button>
|
||||
{mysqlCfg.sqlite_path && <Button variant="ghost" size="sm" onClick={useLocalLogbook}>{t('db.useDefaultLogbook')}</Button>}
|
||||
</div>
|
||||
{compactMsg.logbook && <p className="text-[11px] text-success">{compactMsg.logbook}</p>}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -6376,8 +6414,17 @@ export function SettingsModal({ onClose, onSaved, initialSection, onMainPaneChan
|
||||
{t('db.testCreate')}
|
||||
</Button>
|
||||
<Button size="sm" className="h-8" onClick={connectMysql}>{t('db.connectUse')}</Button>
|
||||
{/* Compacting a shared logbook is OPTIMIZE TABLE, and it rebuilds the
|
||||
table with everyone else waiting on it — hence the warning, and
|
||||
hence its place here rather than beside the connection buttons of
|
||||
a file only this operator uses. */}
|
||||
<Button variant="outline" size="sm" className="h-8 ml-auto" title={t('db.compactMysqlWarn')}
|
||||
onClick={() => compact('logbook')} disabled={compacting !== ''}>
|
||||
{compacting === 'logbook' ? <Loader2 className="size-3.5 animate-spin" /> : <Minimize2 className="size-3.5" />} {t('db.compact')}
|
||||
</Button>
|
||||
<span className="text-[11px] text-muted-foreground">{mysqlMsg}</span>
|
||||
</div>
|
||||
{compactMsg.logbook && <p className="text-[11px] text-success">{compactMsg.logbook}</p>}
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user