Make order search, device results and decisions visible in the WebUI
This commit is contained in:
+20
-12
@@ -15,7 +15,8 @@ import { AdminControl } from './management';
|
||||
import { allowed } from './safety';
|
||||
import { CatalogCheckNotice } from './catalog-check';
|
||||
import { ErrorBox, errorText, useResource } from './resource';
|
||||
import { NavIcon } from './navigation';
|
||||
import { NavIcon, orderDetailRoute } from './navigation';
|
||||
import { orderTitle, Status } from './order-presentation';
|
||||
import { RecoveryReview, recoveryAsset, recoveryTenant } from './recovery-review';
|
||||
import { EchoProbeReview } from './echo-probe-review';
|
||||
import { EchoCompletionReview } from './echo-completion-review';
|
||||
@@ -107,7 +108,7 @@ type Props = {
|
||||
onSelection: (s: Target) => void;
|
||||
onCreateOrder: () => void;
|
||||
onEnroll: () => void;
|
||||
onOperation: (customer: string, id: string) => void;
|
||||
onOperation: (customer: string, id: string, jobId: string) => void;
|
||||
};
|
||||
function devicePath(customer: string, asset: string) {
|
||||
return tenantPath(customer, '/devices/' + encodeURIComponent(asset));
|
||||
@@ -127,7 +128,7 @@ function DeviceDetail({
|
||||
agent: string;
|
||||
auth: Session;
|
||||
back: () => void;
|
||||
openOperation: (id: string) => void;
|
||||
openOperation: (id: string, jobId: string) => void;
|
||||
changed: () => void;
|
||||
}) {
|
||||
const path = devicePath(customer, asset);
|
||||
@@ -212,14 +213,21 @@ function DeviceDetail({
|
||||
<p className="muted">Keine Aufträge für dieses Gerät.</p>
|
||||
) : (
|
||||
<ul className="job-list">
|
||||
{jobs.map((j) => (
|
||||
<li key={objectId(j, 'job')}>
|
||||
<button className="link" onClick={() => openOperation(objectId(j, 'operation'))}>
|
||||
Auftrag vom {time(j.created_at)}
|
||||
</button>
|
||||
<span>{label(j.state)}</span>
|
||||
</li>
|
||||
))}
|
||||
{jobs.map((job) => {
|
||||
const id = objectId(job, 'operation'), jobId = objectId(job, 'job');
|
||||
const title = orderTitle(job);
|
||||
return <li className="job-row" key={jobId}>
|
||||
<div className="device-job-name"><strong>{title}</strong><small>{time(job.created_at)}</small></div>
|
||||
<Status value={job.state}/>
|
||||
<a className="quiet" href={'#auftraege/' + orderDetailRoute(customer, id, jobId)}
|
||||
aria-label={'Ergebnis öffnen · ' + title + ' · ' + time(job.created_at)}
|
||||
onClick={event => {
|
||||
if (event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
|
||||
event.preventDefault();
|
||||
openOperation(id, jobId);
|
||||
}}>Ergebnis öffnen</a>
|
||||
</li>;
|
||||
})}
|
||||
</ul>
|
||||
)}
|
||||
</section>
|
||||
@@ -352,7 +360,7 @@ export function Devices({
|
||||
{...target}
|
||||
auth={auth}
|
||||
back={back}
|
||||
openOperation={(id) => onOperation(target.customer, id)}
|
||||
openOperation={(id, jobId) => onOperation(target.customer, id, jobId)}
|
||||
changed={() => {
|
||||
back();
|
||||
setRoutes([]);
|
||||
|
||||
Reference in New Issue
Block a user