mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-08-11 11:13:04 +02:00
Improve radio restart buttons
This commit is contained in:
+1
-1
File diff suppressed because one or more lines are too long
-1
File diff suppressed because one or more lines are too long
+34
-34
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
Vendored
+2
-2
@@ -13,8 +13,8 @@
|
|||||||
<link rel="shortcut icon" href="/favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||||
<link rel="manifest" href="/site.webmanifest" />
|
<link rel="manifest" href="/site.webmanifest" />
|
||||||
<script type="module" crossorigin src="/assets/index-DvZkZ2Ie.js"></script>
|
<script type="module" crossorigin src="/assets/index-Z2aWr4hK.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-D2NVJvYv.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-BpFnqQF8.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="root"></div>
|
<div id="root"></div>
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { Input } from './ui/input';
|
|||||||
import { Label } from './ui/label';
|
import { Label } from './ui/label';
|
||||||
import { Button } from './ui/button';
|
import { Button } from './ui/button';
|
||||||
import { Separator } from './ui/separator';
|
import { Separator } from './ui/separator';
|
||||||
import { Alert, AlertDescription } from './ui/alert';
|
|
||||||
import { toast } from './ui/sonner';
|
import { toast } from './ui/sonner';
|
||||||
import { api } from '../api';
|
import { api } from '../api';
|
||||||
import { formatTime } from '../utils/messageParser';
|
import { formatTime } from '../utils/messageParser';
|
||||||
@@ -191,11 +190,16 @@ export function SettingsModal({
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
await onSave(update);
|
await onSave(update);
|
||||||
toast.success('Radio config saved');
|
toast.success('Radio config saved, rebooting...');
|
||||||
|
setLoading(false);
|
||||||
|
setRebooting(true);
|
||||||
|
await onReboot();
|
||||||
|
onClose();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err instanceof Error ? err.message : 'Failed to save');
|
setError(err instanceof Error ? err.message : 'Failed to save');
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
} finally {
|
||||||
|
setRebooting(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -242,11 +246,16 @@ export function SettingsModal({
|
|||||||
try {
|
try {
|
||||||
await onSetPrivateKey(privateKey.trim());
|
await onSetPrivateKey(privateKey.trim());
|
||||||
setPrivateKey('');
|
setPrivateKey('');
|
||||||
toast.success('Private key set');
|
toast.success('Private key set, rebooting...');
|
||||||
|
setLoading(false);
|
||||||
|
setRebooting(true);
|
||||||
|
await onReboot();
|
||||||
|
onClose();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setError(err instanceof Error ? err.message : 'Failed to set private key');
|
setError(err instanceof Error ? err.message : 'Failed to set private key');
|
||||||
} finally {
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
} finally {
|
||||||
|
setRebooting(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -463,8 +472,12 @@ export function SettingsModal({
|
|||||||
|
|
||||||
{error && <div className="text-sm text-destructive">{error}</div>}
|
{error && <div className="text-sm text-destructive">{error}</div>}
|
||||||
|
|
||||||
<Button onClick={handleSaveRadioConfig} disabled={loading} className="w-full">
|
<Button
|
||||||
{loading ? 'Saving...' : 'Save Radio Config'}
|
onClick={handleSaveRadioConfig}
|
||||||
|
disabled={loading || rebooting}
|
||||||
|
className="w-full"
|
||||||
|
>
|
||||||
|
{loading || rebooting ? 'Saving & Rebooting...' : 'Save Radio Config & Reboot'}
|
||||||
</Button>
|
</Button>
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
|
|
||||||
@@ -503,30 +516,13 @@ export function SettingsModal({
|
|||||||
/>
|
/>
|
||||||
<Button
|
<Button
|
||||||
onClick={handleSetPrivateKey}
|
onClick={handleSetPrivateKey}
|
||||||
disabled={loading || !privateKey.trim()}
|
disabled={loading || rebooting || !privateKey.trim()}
|
||||||
className="w-full"
|
className="w-full"
|
||||||
>
|
>
|
||||||
Set Private Key
|
{loading || rebooting ? 'Setting & Rebooting...' : 'Set Private Key & Reboot'}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Separator />
|
|
||||||
|
|
||||||
<Alert variant="warning">
|
|
||||||
<AlertDescription>
|
|
||||||
Changes to name or private key require a radio reboot to take effect.
|
|
||||||
</AlertDescription>
|
|
||||||
</Alert>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
variant="outline"
|
|
||||||
onClick={handleReboot}
|
|
||||||
disabled={rebooting || loading}
|
|
||||||
className="w-full border-yellow-500/50 text-yellow-200 hover:bg-yellow-500/10"
|
|
||||||
>
|
|
||||||
{rebooting ? 'Rebooting...' : 'Reboot Radio'}
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
{error && <div className="text-sm text-destructive">{error}</div>}
|
{error && <div className="text-sm text-destructive">{error}</div>}
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
|
|
||||||
@@ -570,6 +566,17 @@ export function SettingsModal({
|
|||||||
{loading ? 'Saving...' : 'Save Settings'}
|
{loading ? 'Saving...' : 'Save Settings'}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
onClick={handleReboot}
|
||||||
|
disabled={rebooting || loading}
|
||||||
|
className="w-full border-red-500/50 text-red-400 hover:bg-red-500/10"
|
||||||
|
>
|
||||||
|
{rebooting ? 'Rebooting...' : 'Reboot Radio'}
|
||||||
|
</Button>
|
||||||
|
|
||||||
{error && <div className="text-sm text-destructive">{error}</div>}
|
{error && <div className="text-sm text-destructive">{error}</div>}
|
||||||
</TabsContent>
|
</TabsContent>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user