Make execution controls and maintenance workflows easier to use

This commit is contained in:
2026-11-17 23:52:03 +01:00
parent a397dd7ae4
commit f6e658ce35
13 changed files with 221 additions and 40 deletions
+22 -3
View File
@@ -222,6 +222,20 @@ export function OrderComposer({ tenantId, auth, initialAssetIds, onSubmitted, on
const revision = scripts.data?.find((r) => r.revision_id === revisionId);
const heads = latestRevisions(scripts.data ?? []);
const rebootIdentity = hasWindows ? 'system' : 'root';
const rebootAsset = mode === 'reboot' && step === 2 && selected.length === 1 ? selected[0] : null;
const rebootTarget = useResource(async signal => {
if (!rebootAsset || !canPlanReboot) return null;
const device = record(await request(path('/devices/' + encodeURIComponent(rebootAsset)), { signal }));
if (device.tenant_id !== tenantId || device.asset_id !== rebootAsset || device.lifecycle !== 'current' ||
devicePlatform(device) !== (hasWindows ? 'windows' : 'linux')) {
throw Error('Das Zielgerät hat sich geändert. Wählen Sie es erneut aus.');
}
const capabilities = Array.isArray(device.capabilities) ? device.capabilities : [];
const required = hasWindows
? ['reboot', 'rmm.sync.v1', 'windows.reboot/1', 'helper.system.v1', 'system:reboot']
: ['reboot', 'rmm.sync.v1', 'helper.root.v1', 'root:reboot'];
return { agentId: objectId(device, 'agent'), ready: required.every(capability => capabilities.includes(capability)) };
}, [tenantId, rebootAsset, rebootIdentity, canPlanReboot], !!rebootAsset && canPlanReboot);
const issues: string[] = [];
if (targets.some((d) => !d?.current))
issues.push('Ein Zielgerät fehlt im aktuellen Bestand. Entfernen Sie es aus der Auswahl.');
@@ -241,6 +255,9 @@ export function OrderComposer({ tenantId, auth, initialAssetIds, onSubmitted, on
if (mode === 'reboot') {
if (selected.length !== 1) issues.push('Wählen Sie ein einzelnes Gerät für den Neustart.');
if (!allowed(auth, rebootIdentity + ':execute')) issues.push('Die Berechtigung für ' + identityNames[rebootIdentity] + ' fehlt.');
if (rebootTarget.error) issues.push(issueMessage(rebootTarget.error));
else if (rebootAsset && !rebootTarget.data) issues.push('Die Neustartfähigkeit des Geräts wird geprüft.');
else if (rebootTarget.data?.ready === false) issues.push('Das Zielgerät meldet derzeit keine Neustartfähigkeit für ' + identityNames[rebootIdentity] + '.');
}
if (
mode === 'once' &&
@@ -319,7 +336,8 @@ export function OrderComposer({ tenantId, auth, initialAssetIds, onSubmitted, on
if (
fixed.plan_id !== planId || fixed.tenant_id !== tenantId || fixed.principal !== auth.principal.id ||
fixed.reason !== bound.reason || fixed.max_parallel !== 1 || fixed.halt_after_failures !== 1 ||
jobs.length !== 1 || job.asset_id !== selected[0] || job.execution_identity !== rebootIdentity ||
jobs.length !== 1 || job.asset_id !== selected[0] || job.agent_id !== rebootTarget.data?.agentId ||
job.execution_identity !== rebootIdentity ||
action.action !== 'reboot' || action.reason !== bound.reason ||
action.dependency_group !== input.parameters.dependency_group ||
action.reconnect_timeout_seconds !== input.parameters.reconnect_timeout_seconds ||
@@ -602,9 +620,10 @@ export function OrderComposer({ tenantId, auth, initialAssetIds, onSubmitted, on
</li>
))}
</ul>
{!devices.data.items.length && (
{!devices.data.items.length && <>
<p>{query ? 'Kein Gerät passt zur Suche.' : 'Keine Geräte im Bestand dieses Kunden.'}</p>
)}
{!query && allowed(auth, 'devices:enroll') && <a className="quiet" href="#verwaltung/aufnahme">Gerät aufnehmen</a>}
</>}
{(prior.length > 0 || devices.data.next) && (
<div>
<button