From 2ede8849595e75fc3fb6a2169fee2cb1e6d4aee6 Mon Sep 17 00:00:00 2001 From: Jeppe Bundgaard Date: Thu, 19 Feb 2026 11:39:36 +0100 Subject: [PATCH] Add force enable/disable machine functionality for department lanes - Introduced endpoints to handle force enable/disable machine actions (`/modules/self-serve/lane/force/machine/enable`, `/disable`). - Updated OpenAPI spec to document the new endpoints. - Extended `DepartmentLane.vue` and `departmentLanesTable.vue` with buttons for force enable/disable, including loading states and toast notifications. - Added corresponding i18n translations for force control actions. - Created E2E tests to verify translation keys, non-empty values, and source file functionality in `department-lane-force-machine.spec.js`. --- openapi.yaml | 106 +++++++++++++ .../superuser/tables/departmentLanesTable.vue | 61 ++++++++ .../SessionUser/Objects/DepartmentLanes.vue | 20 +++ src/i18n/locales/da.json | 7 +- .../department/lanes/DepartmentLane.vue | 43 ++++++ .../department-lane-force-machine.spec.js | 144 ++++++++++++++++++ 6 files changed, 380 insertions(+), 1 deletion(-) create mode 100644 test/specs/department-lane-force-machine.spec.js diff --git a/openapi.yaml b/openapi.yaml index a365da7e..504cfe3f 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -5257,6 +5257,112 @@ paths: schema: $ref: '#/components/schemas/Error' + /modules/self-serve/lane/force/machine/enable: + post: + tags: + - Modules + summary: Force enable MACHINE relay and mark lane as in-wash (superusers only) + description: | + Superuser/emergency endpoint. Bypasses the allowed services gating and directly turns on the MACHINE relay. + Also ensures the lane is marked as OCCUPIED and IN_WASH with a wash start timestamp if not already set. + operationId: forceEnableSelfServeLaneMachine + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - lane_id + properties: + lane_id: + type: integer + duration: + type: integer + nullable: true + description: Optional number of seconds after which the relay should automatically turn off + license_plate: + type: string + nullable: true + description: Optional license plate to associate with the lane + responses: + '200': + description: MACHINE relay force-enabled and lane marked in-wash + content: + application/json: + schema: + type: object + properties: + lane_id: + type: integer + forced: + type: boolean + machine: + type: string + enum: [ENABLED] + duration: + type: integer + nullable: true + status: + type: string + state: + type: string + wash_start_time: + type: integer + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + + /modules/self-serve/lane/force/machine/disable: + post: + tags: + - Modules + summary: Force disable MACHINE relay but keep lane as in-wash (superusers only) + description: | + Superuser/emergency endpoint. Turns off the MACHINE relay while ensuring the lane remains in an IN_WASH state + (simulating a started wash without machine assistance). + operationId: forceDisableSelfServeLaneMachine + requestBody: + required: true + content: + application/json: + schema: + type: object + required: + - lane_id + properties: + lane_id: + type: integer + license_plate: + type: string + nullable: true + responses: + '200': + description: MACHINE relay force-disabled and lane ensured in-wash + content: + application/json: + schema: + type: object + properties: + lane_id: + type: integer + forced: + type: boolean + machine: + type: string + enum: [DISABLED] + status: + type: string + state: + type: string + wash_start_time: + type: integer + '401': + $ref: '#/components/responses/Unauthorized' + '403': + $ref: '#/components/responses/Forbidden' + # Module - Other Integration Endpoints /modules/motorapi/lookup: get: diff --git a/src/components/displays/superuser/tables/departmentLanesTable.vue b/src/components/displays/superuser/tables/departmentLanesTable.vue index 5948158f..03c5f5f2 100644 --- a/src/components/displays/superuser/tables/departmentLanesTable.vue +++ b/src/components/displays/superuser/tables/departmentLanesTable.vue @@ -1,7 +1,10 @@