From c5074bd34d38e2e093ba5c6afd4c716649e5e8bb Mon Sep 17 00:00:00 2001 From: Sami Alzein Date: Wed, 6 Aug 2025 22:45:03 +0200 Subject: [PATCH] fix --- .../frontend/src/services/mockApi.ts | 164 +++++++++--------- 1 file changed, 84 insertions(+), 80 deletions(-) diff --git a/python_rewrite/frontend/src/services/mockApi.ts b/python_rewrite/frontend/src/services/mockApi.ts index 5524891..a98108d 100644 --- a/python_rewrite/frontend/src/services/mockApi.ts +++ b/python_rewrite/frontend/src/services/mockApi.ts @@ -54,15 +54,12 @@ const mockRecipes: Recipe[] = [ id: 1, name: 'Dark Chocolate 70%', description: 'Premium dark chocolate tempering recipe', - heating_temp: 50.0, - cooling_temp: 27.0, - working_temp: 31.0, - heating_time: 300, - cooling_time: 180, - working_time: 600, - mixer_speed: 50, - fountain_delay: 30, - pedal_enabled: true, + chocolate_type: 'dark', + target_temperature_c: 31.0, + heating_duration_min: 5, + cooling_duration_min: 3, + stirring_speed_rpm: 50, + total_time_min: 10, is_active: true, created_at: '2024-01-01T00:00:00Z', updated_at: '2024-01-01T00:00:00Z', @@ -71,15 +68,12 @@ const mockRecipes: Recipe[] = [ id: 2, name: 'Milk Chocolate', description: 'Creamy milk chocolate tempering recipe', - heating_temp: 45.0, - cooling_temp: 26.0, - working_temp: 29.0, - heating_time: 240, - cooling_time: 150, - working_time: 480, - mixer_speed: 45, - fountain_delay: 25, - pedal_enabled: true, + chocolate_type: 'milk', + target_temperature_c: 29.0, + heating_duration_min: 4, + cooling_duration_min: 2, + stirring_speed_rpm: 45, + total_time_min: 8, is_active: true, created_at: '2024-01-02T00:00:00Z', updated_at: '2024-01-02T00:00:00Z', @@ -88,15 +82,12 @@ const mockRecipes: Recipe[] = [ id: 3, name: 'White Chocolate', description: 'Delicate white chocolate tempering recipe', - heating_temp: 43.0, - cooling_temp: 25.0, - working_temp: 28.0, - heating_time: 200, - cooling_time: 120, - working_time: 400, - mixer_speed: 40, - fountain_delay: 20, - pedal_enabled: false, + chocolate_type: 'white', + target_temperature_c: 28.0, + heating_duration_min: 3, + cooling_duration_min: 2, + stirring_speed_rpm: 40, + total_time_min: 7, is_active: true, created_at: '2024-01-03T00:00:00Z', updated_at: '2024-01-03T00:00:00Z', @@ -104,72 +95,85 @@ const mockRecipes: Recipe[] = [ ] const mockProcessStatus: ProcessStatus = { - is_running: false, - current_phase: 'idle', + session_id: null, recipe_id: null, recipe_name: null, - progress_percentage: 0, - phase_time_remaining: 0, - total_time_remaining: 0, - current_temperatures: { - tank_bottom: 22.5, - tank_wall: 22.3, - pump: 22.1, - fountain: 22.0, - }, - target_temperatures: { - tank_bottom: 0, - tank_wall: 0, - pump: 0, - fountain: 0, - }, - motor_speeds: { - mixer: 0, - pump: 0, - }, - session_id: null, + status: 'idle', + current_phase: null, started_at: null, - estimated_completion: null, - error: null, + duration_seconds: null, + started_by: null, + current_temperature: 22.5, + target_temperature: null, + temperature_error: null, + error_count: 0, + warning_count: 0, + is_running: false, } const mockHardwareStatus: HardwareStatus = { - connected: false, - port: '/dev/ttyUSB0', - baud_rate: 9600, - modbus_address: 1, - last_communication: null, - communication_errors: 0, - temperatures: { - tank_bottom: 22.5, - tank_wall: 22.3, - pump: 22.1, - fountain: 22.0, - }, - motors: { - mixer: { running: false, speed: 0, current: 0 }, - pump: { running: false, speed: 0, current: 0 }, - }, - inputs: { - pedal: false, - emergency_stop: false, - door_sensor: true, - }, - outputs: { - heating_element_1: false, - heating_element_2: false, - alarm: false, - fountain_valve: false, - }, + connection_status: 'disconnected', + modbus_status: 'offline', + temperature_sensors: [ + { + id: 'tank_bottom', + name: 'Tank Bottom', + current_temp_c: 22.5, + status: 'normal', + last_reading: new Date().toISOString(), + }, + { + id: 'tank_wall', + name: 'Tank Wall', + current_temp_c: 22.3, + status: 'normal', + last_reading: new Date().toISOString(), + }, + { + id: 'pump', + name: 'Pump', + current_temp_c: 22.1, + status: 'normal', + last_reading: new Date().toISOString(), + }, + { + id: 'fountain', + name: 'Fountain', + current_temp_c: 22.0, + status: 'normal', + last_reading: new Date().toISOString(), + }, + ], + motors: [ + { + id: 'mixer', + name: 'Mixer Motor', + is_running: false, + current_speed_rpm: 0, + target_speed_rpm: 0, + current_amps: 0, + status: 'normal', + }, + { + id: 'pump', + name: 'Pump Motor', + is_running: false, + current_speed_rpm: 0, + target_speed_rpm: 0, + current_amps: 0, + status: 'normal', + }, + ], + last_communication: new Date().toISOString(), } const mockSafetyStatus: SafetyStatus = { + overall_status: 'safe', emergency_stop_active: false, - door_open: false, temperature_alarms: [], motor_alarms: [], system_alarms: [], - last_safety_check: new Date().toISOString(), + active_alarm_count: 0, } const mockUsers: User[] = [