Name customer selectors and validate customer fixtures during frontend builds

This commit is contained in:
2026-11-17 22:10:33 +01:00
parent fae4b4562b
commit 8d0a425f0c
3 changed files with 11 additions and 5 deletions
+7 -3
View File
@@ -52,8 +52,10 @@ test('creates and renames a customer, opens its inventory, and hides editing for
return route.fulfill({ json: { ...listing(customers), can_manage_customers: canManage } });
}
if (method === 'GET' && path === `${collection}/${customerId}/devices`) {
const customer = customers.find(c => c.tenant_id === customerId);
if (!customer) throw new Error('Kunde fehlt im Testbestand');
return route.fulfill({ json: listing([{
tenant_id: customerId, customer_name: customers[1].name, asset_id: 'device-1', agent_id: 'agent-1',
tenant_id: customerId, customer_name: customer.name, asset_id: 'device-1', agent_id: 'agent-1',
lifecycle: 'current', status: 'online', hostname: 'NORD-PC', os: 'Linux'
}]) });
}
@@ -69,8 +71,10 @@ test('creates and renames a customer, opens its inventory, and hides editing for
}
if (method === 'PATCH' && path === `${collection}/${customerId}`) {
expect(request.headers()['x-rmm-tenant']).toBe(customerId);
customers[1].name = body.name;
return route.fulfill({ json: customers[1] });
const customer = customers.find(c => c.tenant_id === customerId);
if (!customer) throw new Error('Unbekannter Testkunde');
customer.name = body.name;
return route.fulfill({ json: customer });
}
}
return route.fulfill({ status: 404, json: { code: 'UNEXPECTED_FIXTURE_REQUEST', message: path } });
+2
View File
@@ -407,6 +407,7 @@ export function Devices({
<label>
<span>Kunde</span>
<select
aria-label="Kunde"
value={filter}
onChange={(e) => {
setRoutes([]);
@@ -425,6 +426,7 @@ export function Devices({
<label>
<span>Status</span>
<select
aria-label="Status"
value={status}
onChange={(e) => {
setRoutes([]);
+2 -2
View File
@@ -367,7 +367,7 @@ function Workspace({ auth, logout }: { auth: Session; logout: () => void }) {
<div className="account">
<div>
<span className="account-dot" aria-hidden="true" />
<span title={auth.principal.id}>{auth.principal.display_name}</span>
<span title={auth.principal.id}>{auth.principal.display_name === auth.principal.id && auth.principal.id.startsWith('local:') ? 'Lokales Konto' : auth.principal.display_name}</span>
</div>
<button
onClick={async () => {
@@ -394,7 +394,7 @@ function Workspace({ auth, logout }: { auth: Session; logout: () => void }) {
{route.page !== 'geraete' && route.page !== 'kunden' && (
<label className="context">
<span>Kunde</span>
<select value={customer} onChange={(e) => switchCustomer(e.target.value)}>
<select aria-label="Kunde" value={customer} onChange={(e) => switchCustomer(e.target.value)}>
{customers.map((c) => (
<option value={c.tenant_id} key={c.tenant_id}>
{c.name}