feat(workbench): integrate operational workflows and map state
This commit is contained in:
@@ -60,6 +60,13 @@ describe("operational timeline model", () => {
|
||||
expect(events[0].correlationId).toBe(events[1].correlationId);
|
||||
});
|
||||
|
||||
it("does not invent actual execution times for backend work orders", () => {
|
||||
const events = createOperationalEvents([{ ...workOrder, dataSource: "backend" }]);
|
||||
|
||||
expect(events).toHaveLength(1);
|
||||
expect(events[0]).toMatchObject({ lane: "plan", actualTime: null });
|
||||
});
|
||||
|
||||
it("filters event lanes from the interactive legend", () => {
|
||||
const events = createOperationalEvents([workOrder]);
|
||||
const filtered = filterOperationalEvents(events, {
|
||||
|
||||
@@ -151,6 +151,25 @@ export function filterOperationalEvents(
|
||||
}
|
||||
|
||||
function createConditionEvents(item: ScheduledConditionRecord): OperationalEvent[] {
|
||||
if (item.operationalTask?.status === "cancelled") {
|
||||
return [{
|
||||
id: `cancelled-${item.id}`,
|
||||
title: item.title,
|
||||
description: item.summary,
|
||||
lane: "exception",
|
||||
status: "cancelled",
|
||||
importance: "normal",
|
||||
plannedTime: item.operationalTask.scheduled_for,
|
||||
actualTime: null,
|
||||
cursorTime: item.operationalTask.updated_at,
|
||||
correlationId: item.operationalTask.task_id,
|
||||
scheduleId: item.operationalTask.workflow,
|
||||
conditionId: item.id,
|
||||
sourceLabel: item.operationalTask.task_type === "external_work_order" ? "预约任务" : "调查任务",
|
||||
mapTargets: []
|
||||
}];
|
||||
}
|
||||
|
||||
if (item.status !== "warning" && item.status !== "error") {
|
||||
return [];
|
||||
}
|
||||
@@ -196,6 +215,10 @@ function createWorkOrderEvents(item: ScheduledWorkOrderItem): OperationalEvent[]
|
||||
mapTargets: getWorkOrderMapTargets(item)
|
||||
};
|
||||
|
||||
if (item.dataSource === "backend") {
|
||||
return [planEvent];
|
||||
}
|
||||
|
||||
if (item.status === "pending") {
|
||||
return [planEvent];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user