feat: Add state filtering methods for ArmBot, Conveyor, Machine, StorageUnit, and Vehicle stores

This commit is contained in:
2025-04-22 15:34:49 +05:30
parent 7907bbab0a
commit 83ee14e9c7
5 changed files with 25 additions and 0 deletions

View File

@@ -28,6 +28,7 @@ interface VehiclesStore {
getVehicleById: (modelUuid: string) => VehicleStatus | undefined;
getVehiclesByProduct: (productId: string) => VehicleStatus[];
getVehiclesByState: (state: string) => VehicleStatus[];
getActiveVehicles: () => VehicleStatus[];
getIdleVehicles: () => VehicleStatus[];
}
@@ -118,6 +119,10 @@ export const useVehicleStore = create<VehiclesStore>()(
return get().vehicles.filter(v => v.productId === productId);
},
getVehiclesByState: (state) => {
return get().vehicles.filter(v => v.state === state);
},
getActiveVehicles: () => {
return get().vehicles.filter(v => v.isActive);
},