Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/web-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Web Check
permissions:
contents: read

on: ["push", "pull_request", "workflow_call"]
on: ["pull_request", "workflow_call"]

jobs:
ci:
Expand Down
18 changes: 9 additions & 9 deletions web/src/components/DeviceControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default component$(() => {

const sendCommand = $(async (command: string) => {
if (!selectedAddress.value) {
message.value = 'Bitte zuerst ein Gerät auswählen';
message.value = 'Please select a device first';
return;
}
const token = localStorage.getItem('ot_br_setup_token') ?? '';
Expand All @@ -27,27 +27,27 @@ export default component$(() => {
address: selectedAddress.value,
command,
});
message.value = `"${command}" gesendet`;
message.value = `"${command}" sent to ${selectedAddress.value}`;
} catch (e) {
message.value = e instanceof Error ? e.message : 'Fehler beim Senden';
message.value = e instanceof Error ? e.message : 'Failed to send command';
} finally {
sending.value = false;
}
});

return (
<div class="card">
<h2>Gerätesteuerung</h2>
<h2>Device control</h2>
{neighbors.value.length === 0 ? (
<p class="muted">Keine Geräte im Netzwerk gefunden.</p>
<p class="muted">No devices found in the network.</p>
) : (
<>
<select
onChange$={(e) => {
selectedAddress.value = (e.target as HTMLSelectElement).value;
}}
>
<option value="">Gerät wählen...</option>
<option value="">Select device...</option>
{neighbors.value.map((n) => (
<option
key={n.ext_mac}
Expand All @@ -62,21 +62,21 @@ export default component$(() => {
onClick$={() => sendCommand('TOGGLE')}
disabled={sending.value}
>
Umschalten
Toggle
</button>
<button
type="button"
onClick$={() => sendCommand('LED_ON')}
disabled={sending.value}
>
An
On
</button>
<button
type="button"
onClick$={() => sendCommand('LED_OFF')}
disabled={sending.value}
>
Aus
Off
</button>
</div>
</>
Expand Down
28 changes: 21 additions & 7 deletions web/src/components/OtaBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export default component$(() => {
!a.name.includes('partition'),
);
if (!asset) {
updateState.value = 'error';
lastError.value =
'Firmware is currently being built on GitHub - please try again in a few minutes.';
return;
}

Expand Down Expand Up @@ -103,6 +106,12 @@ export default component$(() => {
const isNewer =
latestRelease.value &&
latestRelease.value.tag_name !== currentVersion.value;
const assetReady = latestRelease.value?.assets.some(
(a) =>
a.name.endsWith('.bin') &&
!a.name.includes('bootloader') &&
!a.name.includes('partition'),
);

if (!isNewer && updateState.value === 'idle') {
return null;
Expand All @@ -113,17 +122,22 @@ export default component$(() => {
{isNewer && updateState.value === 'idle' && (
<>
<p>
Update verfügbar: <strong>{latestRelease.value?.tag_name}</strong>{' '}
(aktuell: {currentVersion.value})
Update is available:{' '}
<strong>{latestRelease.value?.tag_name}</strong> (current:{' '}
{currentVersion.value})
</p>
<button type="button" onClick$={startUpdate}>
Jetzt aktualisieren
</button>
{assetReady ? (
<button type="button" onClick$={startUpdate}>
Update now
</button>
) : (
<p class="muted">Firmware is still being built, please wait...</p>
)}
</>
)}
{updateState.value === 'updating' && (
<div>
<p>Update läuft... {progress.value}%</p>
<p>Update is running... {progress.value}%</p>
<div class="progress-bar">
<div
class="progress-fill"
Expand All @@ -139,7 +153,7 @@ export default component$(() => {
<div>
<p class="error">Failed to update firmware: {lastError.value}</p>
<button type="button" onClick$={startUpdate}>
Erneut versuchen
Retry
</button>
</div>
)}
Expand Down