Add Sensor Hub functionality with components for managing sensors, including a service for API calls, a modal for selection, and a form for adding new sensors. Updated layout to integrate SensorHub component.

This commit is contained in:
2026-02-19 14:43:35 +03:30
parent a898eccbff
commit 48bf0921c7
10 changed files with 699 additions and 1 deletions
+1
View File
@@ -14,4 +14,5 @@ export * from './services/kanbanService'
export * from './services/todoService'
export * from './services/userManagementService'
export * from './services/rolesPermissionsService'
export * from './services/sensorHubService'
+38
View File
@@ -0,0 +1,38 @@
/**
* Sensor Hub Service
* Handles sensor hub API calls
*/
import { apiClient } from '../client'
export interface Sensor {
name: string
uuid_sensor: string
last_updated: string
[key: string]: unknown
}
export interface ListSensorsResponse {
status?: string
data: Sensor | Sensor[]
}
export const sensorHubService = {
/**
* Get list of sensors
*/
async listSensors(): Promise<Sensor[]> {
const response = await apiClient.get<ListSensorsResponse>('/api/sensor-hub/')
const data = response?.data
if (Array.isArray(data)) {
return data
}
if (data && typeof data === 'object') {
return [data as Sensor]
}
return []
}
}