Add support for selfserve_enabled lanes and synchronize behavior across tasks, sessions, and projections
- Introduced `selfserve_enabled` property for `department_lanes` with schema update, object properties, and associated methods/tests. - Enhanced `selfserve_wash_flow` and session logic to respect lane self-serve settings, including block handling and task filtering. - Updated API routes and Studio Graph projections to include `selfserve_enabled` in payloads and progress callbacks. - Added unit tests for session statuses, lane configuration, and blocking behavior due to disabled self-serve settings.
This commit is contained in:
+8
-3
@@ -264,6 +264,7 @@ class edge_gateway_department_workspace_service
|
||||
'relay_machine_cleaner_id' => $lane->relay_machine_cleaner_id->value() === null ? null : (string)$lane->relay_machine_cleaner_id->value(),
|
||||
'dynamic_image_id' => $lane->dynamic_image_id->value() === null ? null : (int)$lane->dynamic_image_id->value(),
|
||||
'machine_type_id' => $lane->machine_type_id->value() === null ? null : (int)$lane->machine_type_id->value(),
|
||||
'selfserve_enabled' => $lane->isSelfServeEnabled(),
|
||||
'status' => $laneStatus,
|
||||
'self_serve_products' => $lane->getSelfServeLaneProducts(),
|
||||
'relay_slots' => $relaySlots,
|
||||
@@ -385,7 +386,10 @@ class edge_gateway_department_workspace_service
|
||||
} catch (\Throwable) {
|
||||
}
|
||||
|
||||
$readyLanes = array_values(array_filter($lanes, static function (array $lane): bool {
|
||||
$enabledLanes = array_values(array_filter($lanes, static function (array $lane): bool {
|
||||
return ($lane['selfserve_enabled'] ?? true) !== false;
|
||||
}));
|
||||
$readyLanes = array_values(array_filter($enabledLanes, static function (array $lane): bool {
|
||||
return (string)($lane['binding_coverage']['state'] ?? 'UNKNOWN') === 'READY';
|
||||
}));
|
||||
|
||||
@@ -404,12 +408,13 @@ class edge_gateway_department_workspace_service
|
||||
return [
|
||||
'enabled' => $enabled,
|
||||
'lane_count' => count($lanes),
|
||||
'enabled_lanes' => count($enabledLanes),
|
||||
'ready_lanes' => count($readyLanes),
|
||||
'configured_task_count' => count($taskRows),
|
||||
'configured_product_count' => count($productIds),
|
||||
'readiness_state' => !$enabled
|
||||
? 'DISABLED'
|
||||
: (count($lanes) === 0 ? 'UNCONFIGURED' : (count($readyLanes) === count($lanes) ? 'READY' : 'PARTIAL')),
|
||||
: (count($enabledLanes) === 0 ? 'UNCONFIGURED' : (count($readyLanes) === count($enabledLanes) ? 'READY' : 'PARTIAL')),
|
||||
'links' => [
|
||||
'studio' => '/admin/' . (int)$department->id . '/modules/self-serve/studio',
|
||||
'legacy' => '/superuser/selfserve',
|
||||
@@ -594,7 +599,7 @@ class edge_gateway_department_workspace_service
|
||||
}
|
||||
}
|
||||
|
||||
if (($selfServe['enabled'] ?? false) && (int)($selfServe['ready_lanes'] ?? 0) < (int)($selfServe['lane_count'] ?? 0)) {
|
||||
if (($selfServe['enabled'] ?? false) && (int)($selfServe['ready_lanes'] ?? 0) < (int)($selfServe['enabled_lanes'] ?? 0)) {
|
||||
$issues[] = [
|
||||
'severity' => 'warning',
|
||||
'code' => 'SELFSERVE_PARTIAL_READY',
|
||||
|
||||
Reference in New Issue
Block a user