Skip to content

Commit 4e61a1b

Browse files
committed
frontend: Add hint that no device is configured
1 parent d9ed536 commit 4e61a1b

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

frontend/src/locales/de.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export const de ={
5555
"all_keys_in_use": "Zur Zeit sind alle Fernzugriffsverbindungen belegt",
5656
"no_keys": "Bitte lerne das Gerät erneut an",
5757
"loading_devices_failed": "Laden der Geräte ist mit dem Code {{status}} fehlgeschlagen: {{response}}",
58+
"no_devices": "Noch keine Geräte registriert. Bitte verbinde dein Gerät mit diesem Konto, um zu beginnen.",
5859
"connect_error_text": "Verbindung zu Gerät {{charger_id}} ist mit dem code {{status}} fehlgeschlagen: {{response}}",
5960
"remove_error_text": "Entfernen des Gerätes {{charger_id}} ist mit dem code {{status}} fehlgeschlagen: {{response}}",
6061
"delete_modal_heading": "Gerät {{name}} entfernen",

frontend/src/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export const en = {
5959
"all_keys_in_use": "Currently all remote connections are in use",
6060
"no_keys": "You need to register this device again.",
6161
"loading_devices_failed": "Loading devices failed with status code {{status}}: {{response}}",
62+
"no_devices": "No devices registered yet. Please connect your device to this account to get started.",
6263
"connect_error_text": "Connecting to device {{charger_id}} failed with status code {{status}}: {{response}}",
6364
"remove_error_text": "Removing device {{charger_id}} failed with status code {{status}}: {{response}}",
6465
"delete_modal_heading": "Remove device {{name}}",

frontend/src/pages/devices.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,16 @@ export class DeviceList extends Component<{}, DeviceListState> {
351351
return ret * -1;
352352
}
353353
})
354+
355+
// Show empty state message if no devices
356+
if (devices.length === 0) {
357+
return <Container fluid className="text-center mt-5">
358+
<div className="text-muted">
359+
<h5>{t("no_devices")}</h5>
360+
</div>
361+
</Container>;
362+
}
363+
354364
this.state.devices.forEach((charger, index) => {
355365
const [expand, setExpand] = useState(false);
356366
const trimmed_note = charger.note.trim();

frontend/tests/basic.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ test('charger lifecycle', async ({ page }) => {
159159
await page.getByRole('button', { name: 'Reboot' }).click();
160160
await page.waitForTimeout(6000);
161161
await page.goto(testDomain);
162-
await expect(page.getByText('NameDevice-IDNoteSortAscending')).toBeVisible();
162+
await expect(page.getByText('No devices registered yet. Please connect your device to this account to get started.')).toBeVisible();
163163
});
164164

165165
test('add charger with auth token', async ({page}) => {
@@ -269,5 +269,5 @@ test('remove charger', async ({page}) => {
269269
await page.getByRole('button', { name: 'Reboot' }).click();
270270
await page.waitForTimeout(6000);
271271
await login(page, testUser2Email, testPassword2);
272-
await expect(page.getByText('NameDevice-IDNoteSortAscending')).toBeVisible();
272+
await expect(page.getByText('No devices registered yet. Please connect your device to this account to get started.')).toBeVisible();
273273
});

0 commit comments

Comments
 (0)