Plan device actions exclusively as approved scripts and provide reboot library revisions
This commit is contained in:
+21
-60
@@ -9,10 +9,10 @@ import { ScriptLibrary } from './script-library';
|
||||
import { McpTokenManagement } from './mcp-token-management';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
import { actions, Action, ApiError, authConfig, approvalBlockers, expectedStdout, objectId, page, PlanInput, pretty, record, RecordValue, request, session, Session, stringField, tenant, tenantPath, validateInput, windowsPowerShellRemoteSignedProfile, fullMaintenanceScriptProfile } from './api';
|
||||
import { ApiError, authConfig, approvalBlockers, objectId, page, pretty, record, RecordValue, request, session, Session, stringField, tenant, tenantPath, windowsPowerShellRemoteSignedProfile, fullMaintenanceScriptProfile } from './api';
|
||||
import './style.css';
|
||||
import { AdminControl, Catalog, TenantControls } from './management';
|
||||
import { allowed, availableActions, parseStrictJson, powerShellApprovalBlockers, powerShellPlanJobs, rootWarning, systemWarning, systemPlanJobs, validateSensitiveInput, verifyPlanIntegrity, queryLogsApprovalBlockers, queryLogsPlanJobs, windowsMsiApprovalBlockers, windowsMsiPlanJobs, verifyWindowsMsiManifest, fullMaintenanceWarning } from './safety';
|
||||
import { allowed, parseStrictJson, powerShellApprovalBlockers, powerShellPlanJobs, rootWarning, systemWarning, systemPlanJobs, verifyPlanIntegrity, queryLogsApprovalBlockers, queryLogsPlanJobs, windowsMsiApprovalBlockers, windowsMsiPlanJobs, verifyWindowsMsiManifest, adminScriptWarning } from './safety';
|
||||
import { Login } from './login';
|
||||
import { ConsoleOutput, visibleControls } from './console-output';
|
||||
import { scriptApprovalBlockers, scriptPlanJobs, verifyScriptPlan } from './script-console';
|
||||
@@ -53,7 +53,7 @@ export function ScriptPlanNotice({ plan }: { plan: RecordValue }) {
|
||||
return target ? deviceName(target) : j.assetId;
|
||||
}).join(', ')}</h4>}
|
||||
<p>{job.revision ? job.revision.name+' · Version '+job.revision.version : 'Einmaliges Skript'} · {job.interpreter} · {identityName(job.identity)}</p>
|
||||
{job.privilegedProfile === fullMaintenanceScriptProfile && <p className="warning">{fullMaintenanceWarning}</p>}
|
||||
{job.privilegedProfile === fullMaintenanceScriptProfile && <p className="warning">{adminScriptWarning}</p>}
|
||||
{job.identity === 'root' && job.privilegedProfile !== fullMaintenanceScriptProfile && <p className="warning">{rootWarning}</p>}
|
||||
{job.interpreter === 'powershell' && <p>Windows PowerShell 5.1 · {job.windowsProfile === windowsPowerShellRemoteSignedProfile ? 'RemoteSigned für diesen Prozess' : 'Richtlinie des Geräts'}</p>}
|
||||
<pre aria-label="Vollständiger Skripttext">{visibleControls(job.script)}</pre>
|
||||
@@ -115,41 +115,6 @@ export function QueryLogsPlanNotice({ plan }: { plan: RecordValue }) {
|
||||
return <aside className="warning" aria-label="Feste Live-Logfenster"><p>UI-genehmigte Liveabfrage aus hashgeprüften gespeicherten Planbytes; kein passives Inventar, keine automatische Erhebung.</p><ul>{jobs.map((job, i) => <li key={i}>Asset: {job.assetId} · Quelle: {job.source}{job.windows ? <> · Kanal: {job.channel} · Provider: {job.provider} · agent_service</> : ' · Linux-Journal'} · UTC-Fenster: [{job.since}, {job.until}) · maximal {job.maxLines} {job.windows ? 'Events' : 'Zeilen'} · {job.outputBytes} Bytes · äußere Joblaufzeit {job.runtimeSeconds}s{job.windows && ' · inneres Abfragebudget höchstens5000ms, zwischen Win32-Aufrufen kooperativ geprüft'}</li>)}</ul><p>Grenzen, Abbruch, fehlende Rechte und Teilabdeckung bleiben sichtbar. Keine Bookmarkfortschreibung durch diesen Auftrag; die Abfrage behauptet keine vollständige Sammlung aller Systemlogs.</p></aside>;
|
||||
} catch { return <aside role="alert" className="error">Logfenster ist nicht verifiziert oder wurde verändert. Keine Genehmigung ohne gültige gespeicherte Planbytes.</aside>; }
|
||||
}
|
||||
const initialParameters: Record<Action, RecordValue> = {
|
||||
run_script: {}, refresh_inventory: { scope: 'linux.base' }, query_logs: { unit: '', since: '', until: '', max_lines: 1000 }, set_service_state: { unit: '', state: 'running' }, ensure_package: { provider: 'apt', recipe_version: '', package: '', version: '', architecture: 'amd64', installation_context: 'system', apt_manifest: null }, apply_updates: { provider: 'apt', packages: [], reboot_policy: 'never', apt_manifest: null }, reboot: { reason: '', dependency_group: '', reconnect_timeout_seconds: 300 }, apt_native_acceptance: { recipe_id: 'rmm-apt-fixture-install-1.0', recipe_version: '1', apt_manifest: null },
|
||||
update_agent: { release_id: '' },
|
||||
};
|
||||
function Planner({ tenantId, auth, selected, showPlan }: { tenantId: string; auth: Session; selected: string[]; showPlan: (id: string) => void }) {
|
||||
const choices = availableActions(auth, actions).filter(action => auth.principal.simulated || !['run_script', 'reboot'].includes(action));
|
||||
const [scriptPlatform, setScriptPlatform] = useState('linux'), [mixedVariants, setMixedVariants] = useState('[]');
|
||||
const initialAction = auth.principal.simulated ? 'run_script' : 'refresh_inventory';
|
||||
const [action, setAction] = useState<Action>(initialAction), [parameters, setParameters] = useState(pretty(initialParameters[initialAction])), [error, setError] = useState<string | null>(null), [busy, setBusy] = useState(false);
|
||||
const [identity, setIdentity] = useState('agent_service');
|
||||
return <section><h2>Neuen unveränderlichen Plan vorbereiten</h2><p>Nur fest ausgewählte Asset-IDs. Keine Ausführung durch Planung oder Antrag; jede Aktion einschließlich Live-Inventar benötigt Genehmigung.</p>
|
||||
<form onSubmit={async e => { e.preventDefault(); setBusy(true); setError(null); const f = new FormData(e.currentTarget); try {
|
||||
const common = { execution_identity: String(f.get('identity')), timeout_seconds: Number(f.get('timeout')), max_output_bytes: Number(f.get('output')), ...(action === 'run_script' && f.get('privileged_script_profile') === fullMaintenanceScriptProfile ? { privileged_script_profile: fullMaintenanceScriptProfile } : {}) };
|
||||
const params = action === 'run_script' ? { ...common, variants: scriptPlatform === 'mixed' ? parseStrictJson(mixedVariants) : [{ os_family: scriptPlatform, interpreter: String(f.get('interpreter')), encoding: 'utf-8', script_utf8: String(f.get('script')), ...(scriptPlatform === 'windows' ? { windows_execution_profile: windowsPowerShellRemoteSignedProfile } : {}) }], arguments: [], expected_stdout: expectedStdout(String(f.get('expected')), String(f.get('expected_format'))) } : { ...record(parseStrictJson(parameters)), ...common };
|
||||
const input: PlanInput = { tenant_id: tenantId, action, targets: { asset_ids: [...selected] }, parameters: params, schedule: { not_before: new Date(String(f.get('not_before'))).toISOString(), start_before: new Date(String(f.get('expires'))).toISOString(), offline_policy: 'wait_until_deadline' }, rollout: { max_parallel: Number(f.get('parallel')), halt_after_failures: Number(f.get('failures')) }, reason: String(f.get('reason')) };
|
||||
const ids = String(f.get('artifact_ids') ?? '').split(/[\s,]+/).filter(Boolean); if (ids.length) { if (ids.length > 16 || new Set(ids).size !== ids.length || ids.some(id => !/^[0-9a-f-]{36}$/i.test(id))) throw new Error('Maximal 16 eindeutige feste Artefakt-UUIDs'); input.artifact_ids = ids; }
|
||||
validateInput(input); await validateSensitiveInput(input, auth); const plan = record(await request(tenantPath(tenantId, '/operation-plans'), { body: input, csrf: auth.csrf_token })); showPlan(objectId(plan, 'plan'));
|
||||
} catch (e) { setError(errorText(e)); } finally { setBusy(false); } }}>
|
||||
<label>Aktion<select aria-label="Aktion" value={action} onChange={e => { const next = choices.find(a => a === e.target.value); if (next) { setAction(next); setParameters(pretty(initialParameters[next])); } }}>{choices.map(a => <option key={a} value={a}>{auth.principal.simulated ? a : actionTitle(a)}</option>)}</select></label>
|
||||
{action === 'update_agent' && <p className="warning">{agentUpdateWarning} Nur parameters.release_id aus dem Katalog; keine freien Vorgänger-, Dateipfad-, Artefakt- oder Policywerte. Gesamtbudget600s, Ausgabelimit höchstens65536Bytes. Fehlende frische Gerätepreview ergibt keine Planung.</p>}
|
||||
{action === 'query_logs' && <p>Windows-MVP nur Quelle windows.eventlog.application.rustdiscovery-mvp-test, Kanal Application, Provider RustDiscovery-MVP-Test, agent_service. Festes UTC-Fenster höchstens24h,1–1000Events,1024–65536Bytes,äußere Joblaufzeit10–120s; inneres kooperatives Abfragebudget höchstens5000ms. Keine freie Kanal-/XPathauswahl und keine Bookmarkfortschreibung. Linux behält seine feste Journalunit.</p>}
|
||||
{action === 'apt_native_acceptance' && <p className="warning">NUR SIMULIERTE DEV/TEST-NATIVABNAHME. In Vorbereitung; Backend/Helper/Scope müssen diese eigene Aktion unterstützen. Nur rmm-apt-fixture-install-1.0 oder rmm-apt-fixture-update-1.1, Rezeptversion 1, vollständiges Schema-2-Manifest. null/Platzhalter sind nicht konfiguriert, keine Produktionsaktion, keine automatische Ausführung.</p>}
|
||||
{action === 'run_script' ? <><label>Skriptplattform<select aria-label="Skriptplattform" value={scriptPlatform} onChange={e => setScriptPlatform(e.target.value)}><option value="linux">Linux</option><option value="windows">Windows</option><option value="mixed">Linux und Windows · feste Varianten</option></select></label>{scriptPlatform === 'mixed' ? <label>Exakte Plattformvarianten (JSON)<textarea aria-label="Skriptvarianten" value={mixedVariants} onChange={e => setMixedVariants(e.target.value)} rows={9} spellCheck={false}/></label> : <><label>Interpreter<select name="interpreter" key={scriptPlatform}>{scriptPlatform === 'windows' ? <option value="powershell">powershell · Windows PowerShell 5.1</option> : <><option value="posix_sh">posix_sh · /bin/sh</option><option value="bash">bash · nur mit gemeldeter Capability</option></>}</select></label><label>Exakte UTF-8 Skriptbytes (keine automatische Ergänzung)<textarea name="script" required rows={7} spellCheck={false}/></label></>}<label>Format der stdout-Nachbedingung<select name="expected_format" aria-label="Format der stdout-Nachbedingung"><option value="text">Text · Linux-Default</option><option value="json">JSON-String · explizite CRLF mit \r\n</option></select></label><label>Erwartete stdout-Ausgabe (exakte Rohbytes als UTF-8, optional)<textarea name="expected" rows={2} spellCheck={false}/></label>{scriptPlatform !== 'linux' && <p>PowerShell5.1: -NoLogo -NoProfile -NonInteractive. Einzelne neue Windowspläne binden fest RemoteSigned nur für den Jobprozess. Bei gemischten Varianten ist powershell_51_remote_signed ausdrücklich an der Windowsvariante zu setzen; fehlendes Profil bleibt geerbt. Jede tatsächliche Prozessoption steht vor Genehmigung je Ziel im festen Plan. Nicht-ASCII benötigt ein ausdrücklich enthaltenes UTF-8-BOM vor Hashbildung. Skriptbytes und Ausgabe werden nicht normalisiert. Fehlende Plattform-/Interpreter-/Sync-Capability sperrt den ganzen Plan; kein stiller Zielausschluss.</p>}</> : <label>Typisierte Aktionsparameter (JSON; leere Pflichtwerte ergänzen)<textarea aria-label="Aktionsparameter" value={parameters} onChange={e => setParameters(e.target.value)} rows={9} spellCheck={false}/></label>}
|
||||
<div className="grid"><label>Ausführungsidentität<select aria-label="Ausführungsidentität" name="identity" value={identity} onChange={e => setIdentity(e.target.value)}><option value="agent_service">agent_service</option><option value="root" disabled={!allowed(auth, 'root:execute')}>root · root:execute und unabhängiger Helper erforderlich</option><option value="system" disabled={!['set_service_state', 'ensure_package', 'run_script', 'update_agent'].includes(action) || !allowed(auth, 'system:execute')}>system · system:execute und Windows-SYSTEM-Helper erforderlich</option></select></label><label>Laufzeitlimit (s)<input name="timeout" key={action} type="number" min="1" max="86400" defaultValue={action === 'update_agent' ? '600' : '60'} required/></label><label>Ausgabelimit (Bytes)<input name="output" type="number" min="1" max="524288" defaultValue="65536" required/></label><label>Frühester Start (lokale Zeit)<input name="not_before" type="datetime-local" defaultValue={localDate(new Date())} required/></label><label>Startfrist / Ablauf (lokale Zeit)<input name="expires" type="datetime-local" defaultValue={localDate(new Date(Date.now() + 86400000))} required/></label><label>Maximal parallel<input name="parallel" type="number" min="1" defaultValue="1" required/></label><label>Stopp nach Fehlern<input name="failures" type="number" min="1" defaultValue="1" required/></label></div>
|
||||
{action === 'run_script' && <><label>Privilegiertes Skriptprofil<select name="privileged_script_profile" aria-label="Privilegiertes Skriptprofil" key={identity} defaultValue=""><option value="">Bestehendes begrenztes Profil · keine volle Hostwartung</option><option value={fullMaintenanceScriptProfile} disabled={!['root', 'system'].includes(identity) || !allowed(auth, 'scripts:execute')}>full_maintenance_v1 · volle Hostautorität als root/SYSTEM</option></select></label><p className="warning">{fullMaintenanceWarning}</p><p>Die Auswahl erteilt keine Rechte und aktiviert keinen Client. Zentrale und lokale Policy, tatsächliche Zielcapabilities und die spätere Genehmigung werden unabhängig geprüft. SYSTEM erfordert dieses Profil; es gibt keinen automatischen Fallback.</p></>}
|
||||
{identity === 'root' && !['run_script', 'update_agent'].includes(action) && <p className="warning">{rootWarning}</p>}
|
||||
{identity === 'system' && !['run_script', 'update_agent'].includes(action) && <p className="warning">{systemWarning}</p>}
|
||||
{identity === 'system' && action === 'ensure_package' && <p>MSI: provider=msi, package=rmm-windows-msi-fixture, architecture=x64, installation_context=machine, recipe_version=1 und vollständiges windows_msi_manifest aus dem getrennten MSI-Katalog. Genau zwei eigene Rezepte1.0/1.0→1.1;10–120s,1024–65536Bytes. APT-Manifest fehlt/null. Rezept-/Artefakthash und feste Nachbedingungen werden geprüft. Kein zusätzlicher Artefaktvektor.</p>}
|
||||
{['ensure_package', 'apply_updates', 'apt_native_acceptance'].includes(action) && <details open><summary>Unveränderte Parameter-/Manifestpreview: gesamte Closure, alte/neue Versionen, Origins, Archivbytes/Hashes und Bindungen</summary><pre>{parameters}</pre><p>Struktur, exakte Transaktionsbytes und Hash werden vor Planung geprüft. Diese Vorschau behauptet keine native Akzeptanz oder Bereitschaft; keine automatische Ergänzung/Reduzierung der Closure.</p></details>}
|
||||
<label>Feste importierte Artefakt-IDs (optional, maximal 16)<input name="artifact_ids" disabled={action === 'update_agent' || (identity === 'system' && action === 'ensure_package')} placeholder="MSI leitet genau eine Referenz aus dem Rezept ab; sonst UUIDs, keine URL"/></label>
|
||||
<label>Begründung<input name="reason" required maxLength={1024}/></label><p>Feste Ziele ({selected.length}): {selected.join(', ') || 'keine ausgewählt'}</p>{action === 'reboot' || action === 'apply_updates' || action === 'ensure_package' ? <p className="warning">Zieländerung: Testumfang separat abstimmen. Keine implizite Reboot-/Updateerlaubnis. Neue Versuche und Folgejobs benötigen neue feste Pläne.</p> : null}<button disabled={busy || !selected.length}>Plan erstellen · noch keine Ausführung</button><ErrorBox error={error}/>
|
||||
</form></section>;
|
||||
}
|
||||
function localDate(date: Date) { return new Date(date.getTime() - date.getTimezoneOffset() * 60000).toISOString().slice(0, 16); }
|
||||
|
||||
function WindowsMsiCatalog({ tenantId, auth }: { tenantId: string; auth: Session }) {
|
||||
const [source, setSource] = useState('{}'), [cursor, setCursor] = useState<string | null>(null), [revision, setRevision] = useState(0), [error, setError] = useState<string | null>(null), [busy, setBusy] = useState(false), [receipt, setReceipt] = useState<unknown>(null);
|
||||
const list = useResource(async signal => {
|
||||
@@ -233,6 +198,7 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
||||
const [enrollmentError, setEnrollmentError] = useState<string | null>(null);
|
||||
const [issuing, setIssuing] = useState(false);
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [adminScripts, setAdminScripts] = useState(false);
|
||||
return <section aria-label="Gerät aufnehmen"><h2>Gerät aufnehmen</h2>
|
||||
<p>Kunde <strong>{customerName}</strong> · Der Einmalcode gilt 15 Minuten.</p>
|
||||
<h3>Installation auf dem Zielgerät</h3>
|
||||
@@ -240,7 +206,12 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
||||
<li><strong>Linux</strong> · Installationsskript per HTTPS laden und mit Administratorrechten starten.</li>
|
||||
<li><strong>Windows</strong> · Installationsskript per HTTPS laden und in einer administrativen PowerShell starten.</li>
|
||||
</ul>
|
||||
<p>Die passenden Befehle erscheinen mit dem Einmalcode. Das Skript fragt den Code auf dem Zielgerät ab.</p>
|
||||
<label className="check"><input type="checkbox" checked={adminScripts} onChange={e => setAdminScripts(e.target.checked)}/>
|
||||
Installationsbefehle für Administratorskripte anzeigen
|
||||
</label>
|
||||
{adminScripts && <p>Der lokale Installer aktiviert mit <code>--enable-admin-scripts</code> unter Linux oder <code>-EnableAdministratorScripts</code> unter Windows den Skript-Helper.
|
||||
{' '}Für jeden Auftrag gelten zusätzlich die Skript- und Administratorrechte des Kunden und die Genehmigung in der WebUI.</p>}
|
||||
<p>Die passenden Befehle erscheinen mit dem Einmalcode. Geben Sie den Code bei der Abfrage auf dem Zielgerät ein.</p>
|
||||
<button disabled={issuing || !allowed(auth, 'devices:enroll')} onClick={async () => {
|
||||
setIssuing(true); setEnrollment(null); setEnrollmentError(null); setCopied(false);
|
||||
try {
|
||||
@@ -258,11 +229,11 @@ function DeviceEnrollment({ tenantId, auth, customerName }: { tenantId: string;
|
||||
}}>Einmalcode kopieren</button>
|
||||
<button className="quiet" onClick={() => { setEnrollment(null); setCopied(false); }}>Code ausblenden</button>
|
||||
{copied && <p role="status">Einmalcode wurde kopiert.</p>}
|
||||
{enrollment.origin && enrollment.platforms.includes('x86_64-unknown-linux-gnu') && <><p>Linux, mit einem Administratorkonto ausführen</p><pre>{`curl --fail --show-error --silent '${enrollment.origin}/install/linux.sh' -o linux.sh && sudo sh linux.sh '${enrollment.origin}'`}</pre></>}
|
||||
{enrollment.origin && enrollment.platforms.includes('x86_64-unknown-linux-gnu') && <><p>Linux, mit einem Administratorkonto ausführen</p><pre>{`curl --fail --show-error --silent '${enrollment.origin}/install/linux.sh' -o linux.sh && sudo sh linux.sh '${enrollment.origin}'${adminScripts ? ' --enable-admin-scripts' : ''}`}</pre></>}
|
||||
{enrollment.origin && ['x86_64-pc-windows-gnu','x86_64-pc-windows-msvc'].filter(p => enrollment.platforms.includes(p)).map(platform =>
|
||||
<div key={platform}><p>Windows {platform.endsWith('-gnu') ? 'x64 (GNU)' : 'x64 (MSVC)'}, in einer administrativen Windows PowerShell ausführen</p>
|
||||
<pre>{`Invoke-WebRequest -UseBasicParsing '${enrollment.origin}/install/windows.ps1' -OutFile .\\windows.ps1
|
||||
.\\windows.ps1 -BootstrapBase '${enrollment.origin}' -Platform '${platform}'`}</pre></div>)}
|
||||
.\\windows.ps1 -BootstrapBase '${enrollment.origin}' -Platform '${platform}'${adminScripts ? ' -EnableAdministratorScripts' : ''}`}</pre></div>)}
|
||||
</>}
|
||||
|
||||
</section>;
|
||||
@@ -305,7 +276,9 @@ function PlanDetail({ tenantId, id, auth, onOperation, customerName, mode = 'rev
|
||||
const revision = saved.script_revision ? record(saved.script_revision) : null;
|
||||
const title = revision ? display(revision.name) : actionTitle(first && record(first.action).action);
|
||||
const script = first && record(first.action).action === 'run_script';
|
||||
const allScripts = payloads.length > 0 && payloads.every(p => record(p.action).action === 'run_script');
|
||||
const blockers = reviewBlockers(data);
|
||||
if (!allScripts) blockers.push('Dieser Plan enthält eine frühere Aktionsart. Erstellen Sie für die Ausführung einen neuen Skriptauftrag.');
|
||||
const pending = data.approval_state === 'pending_approval';
|
||||
const planHash = stringField(data,'plan_hash');
|
||||
const confirmed = confirmedHash === planHash;
|
||||
@@ -324,12 +297,13 @@ function PlanDetail({ tenantId, id, auth, onOperation, customerName, mode = 'rev
|
||||
try {
|
||||
await verifyReview(data, tenantId, id);
|
||||
if (decision !== 'reject') {
|
||||
if (!allScripts) throw new Error('Neue Geräteaufträge führen ausschließlich Skripte aus.');
|
||||
const problems = reviewBlockers(data);
|
||||
if (problems.length) throw new Error(problems.join(' · '));
|
||||
}
|
||||
if (decision === 'submit' && (mode !== 'submit' || !allowed(auth,'operations:submit'))) throw new Error('Einreichung nicht erlaubt.');
|
||||
if (decision !== 'submit' && (!mayDecide || !confirmed)) throw new Error('Prüfung und Berechtigung erforderlich.');
|
||||
if (decision === 'approve' && missingRights.length) throw new Error('Erforderliche Ausführungsrechte fehlen.');
|
||||
if (decision !== 'reject' && missingRights.length) throw new Error('Erforderliche Ausführungsrechte fehlen.');
|
||||
const submit = decision === 'submit';
|
||||
const result = record(await request(path + (submit ? '/submit' : '/authorizations'), {
|
||||
csrf: auth.csrf_token, body: submit ? { idempotency_key: 'web-plan-' + id } : { plan_hash: planHash, decision }
|
||||
@@ -377,8 +351,9 @@ function PlanDetail({ tenantId, id, auth, onOperation, customerName, mode = 'rev
|
||||
<JsonView value={data} label="Technische Plandaten"/>
|
||||
<ErrorBox error={error ?? plan.error}/>
|
||||
{(pending || mode === 'submit') && blockers.length > 0 && <p role="alert" className="error">{blockers.join(' · ')}</p>}
|
||||
{mode === 'submit' && !data.approval_state && missingRights.length > 0 && <p className="warning">Für die Einreichung fehlen Rechte: {missingRights.join(', ')}.</p>}
|
||||
{mode === 'submit' && !data.approval_state && allowed(auth, 'operations:submit') &&
|
||||
<button className="primary" disabled={busy || !!plan.error || !!blockers.length} onClick={() => void act('submit')}>Zur Genehmigung einreichen</button>}
|
||||
<button className="primary" disabled={busy || !!plan.error || !!blockers.length || !!missingRights.length} onClick={() => void act('submit')}>Zur Genehmigung einreichen</button>}
|
||||
{mode === 'submit' && typeof data.operation_id === 'string' && <button className="quiet" onClick={() => onOperation(objectId(data, 'operation'))}>Eingereichten Auftrag öffnen</button>}
|
||||
{mayDecide && <fieldset disabled={busy || !!plan.error}><legend>Entscheidung</legend>
|
||||
{!!missingRights.length && <p className="warning">Für die Genehmigung fehlen Rechte: {missingRights.join(', ')}.</p>}
|
||||
@@ -684,9 +659,6 @@ function Workspace({ auth, logout }: { auth: Session; logout: () => void }) {
|
||||
switchCustomer(tenantId);
|
||||
go('genehmigungen', `pruefen/${tenantId}/${id}`);
|
||||
}
|
||||
function showDraft(id: string) {
|
||||
go('auftraege', `entwurf/${customer}/${id}`);
|
||||
}
|
||||
function afterSubmission(id: string) {
|
||||
refreshInbox(value => value + 1);
|
||||
openOperation(customer, id);
|
||||
@@ -822,16 +794,9 @@ function Workspace({ auth, logout }: { auth: Session; logout: () => void }) {
|
||||
</> : <><div className="page-title"><h1>Genehmigungen</h1></div><ApprovalInbox ownId={auth.principal.id} open={openReview} /></>
|
||||
)}
|
||||
{route.page === 'auftraege' && (
|
||||
route.tab === 'neu' ? <>
|
||||
(route.tab === 'neu' || route.tab === 'wartung') ? <>
|
||||
<a href="#auftraege" className="back-link">← Zu den Aufträgen</a>
|
||||
<OrderComposer tenantId={customer} customerName={customerName} auth={scoped} initialAssetIds={selected} onSubmitted={afterSubmission} onDraft={showDraft} />
|
||||
</> : route.tab === 'wartung' ? <>
|
||||
<a href="#verwaltung/kataloge" className="back-link">← Zur erweiterten Verwaltung</a>
|
||||
<div className="page-title"><h1>Wartungsauftrag planen</h1></div>
|
||||
{allowed(scoped, 'operations:plan') ? <>
|
||||
<a className="quiet" href="#geraete">Geräte auswählen</a>
|
||||
<Planner tenantId={customer} auth={scoped} selected={selected} showPlan={showDraft} />
|
||||
</> : <p>Die Berechtigung zum Planen von Aufträgen fehlt.</p>}
|
||||
<OrderComposer tenantId={customer} customerName={customerName} auth={scoped} initialAssetIds={selected} onSubmitted={afterSubmission} />
|
||||
</> : detailRoute && detailId ? <>
|
||||
<a href="#auftraege" className="back-link">← Zu den Aufträgen</a>
|
||||
{detailKind === 'entwurf' ?
|
||||
@@ -841,7 +806,7 @@ function Workspace({ auth, logout }: { auth: Session; logout: () => void }) {
|
||||
customerName={customerName} openPlan={id => openReview(customer,id)} />}
|
||||
</> : <>
|
||||
<div className="page-title"><h1>Aufträge</h1>
|
||||
{allowed(scoped, 'operations:plan') && <a className="primary-action" href="#auftraege/neu"><NavIcon name="plus" /> Neuer Auftrag</a>}
|
||||
{allowed(scoped, 'operations:plan') && allowed(scoped, 'scripts:execute') && <a className="primary-action" href="#auftraege/neu"><NavIcon name="plus" /> Neuer Auftrag</a>}
|
||||
</div>
|
||||
<Operations tenantId={customer} customerName={customerName} open={id => openOperation(customer,id)}
|
||||
filters={orderFilters} apply={setOrderFilters}/>
|
||||
@@ -868,10 +833,6 @@ function Workspace({ auth, logout }: { auth: Session; logout: () => void }) {
|
||||
{adminTab === 'releases' && <AgentReleaseCatalog tenantId={customer} auth={scoped} />}
|
||||
{adminTab === 'kataloge' && (
|
||||
<>
|
||||
{allowed(scoped, 'operations:plan') && <section>
|
||||
<h2>Erweiterte Wartung</h2>
|
||||
<a className="quiet" href="#auftraege/wartung">Wartungsauftrag planen</a>
|
||||
</section>}
|
||||
<Catalog tenantId={customer} auth={scoped} />
|
||||
<WindowsMsiCatalog tenantId={customer} auth={scoped} />
|
||||
</>
|
||||
|
||||
Reference in New Issue
Block a user