Almost all sections with mock data
This commit is contained in:
58
src/mocks/mdmDashboardData.ts
Normal file
58
src/mocks/mdmDashboardData.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
export type DeviceStatus = 'online' | 'offline' | 'kiosk'
|
||||
|
||||
export interface Device {
|
||||
id: string
|
||||
name: string
|
||||
androidVersion: string
|
||||
batteryPercent: number
|
||||
status: DeviceStatus
|
||||
}
|
||||
|
||||
export interface AppDeployment {
|
||||
id: string
|
||||
name: string
|
||||
version: string
|
||||
deployed: number
|
||||
total: number
|
||||
}
|
||||
|
||||
export interface DashboardStats {
|
||||
totalAndroidDevices: number
|
||||
deployedApps: number
|
||||
activePolicies: number
|
||||
averageBatteryPercent: number
|
||||
}
|
||||
|
||||
export const MOCK_DASHBOARD_STATS: DashboardStats = {
|
||||
totalAndroidDevices: 12,
|
||||
deployedApps: 8,
|
||||
activePolicies: 5,
|
||||
averageBatteryPercent: 78,
|
||||
}
|
||||
|
||||
export const MOCK_DEVICES: Device[] = [
|
||||
{ id: '1', name: 'Samsung Galaxy A54 – Ventas01', androidVersion: '14', batteryPercent: 92, status: 'online' },
|
||||
{ id: '2', name: 'Samsung Galaxy A54 – Ventas02', androidVersion: '14', batteryPercent: 45, status: 'online' },
|
||||
{ id: '3', name: 'Xiaomi Redmi Note 12 – Almacén', androidVersion: '13', batteryPercent: 100, status: 'kiosk' },
|
||||
{ id: '4', name: 'Motorola Moto G – Reparto01', androidVersion: '13', batteryPercent: 12, status: 'offline' },
|
||||
{ id: '5', name: 'Samsung Galaxy A34 – Oficina', androidVersion: '14', batteryPercent: 78, status: 'online' },
|
||||
]
|
||||
|
||||
export const MOCK_APP_DEPLOYMENTS: AppDeployment[] = [
|
||||
{ id: '1', name: 'App Corporativa Ventas', version: '2.1.0', deployed: 12, total: 12 },
|
||||
{ id: '2', name: 'Headwind Kiosk', version: '1.4.2', deployed: 10, total: 12 },
|
||||
{ id: '3', name: 'Authenticator', version: '6.2.1', deployed: 12, total: 12 },
|
||||
{ id: '4', name: 'Microsoft Teams', version: '1416/1.0.0', deployed: 8, total: 12 },
|
||||
]
|
||||
|
||||
export function getMdmDashboardData(): {
|
||||
stats: DashboardStats
|
||||
devices: Device[]
|
||||
appDeployments: AppDeployment[]
|
||||
} {
|
||||
return {
|
||||
stats: MOCK_DASHBOARD_STATS,
|
||||
devices: MOCK_DEVICES,
|
||||
appDeployments: MOCK_APP_DEPLOYMENTS,
|
||||
}
|
||||
}
|
||||
100
src/mocks/reportService.ts
Normal file
100
src/mocks/reportService.ts
Normal file
@@ -0,0 +1,100 @@
|
||||
export interface ReportFilters {
|
||||
desde: string
|
||||
hasta: string
|
||||
}
|
||||
|
||||
export interface InventoryReportItem {
|
||||
id: string
|
||||
nombre: string
|
||||
tipo: string
|
||||
cliente: string
|
||||
ip: string
|
||||
so: string
|
||||
estado: string
|
||||
}
|
||||
|
||||
export interface InventoryReport {
|
||||
periodo: { desde: string; hasta: string }
|
||||
total: number
|
||||
items: InventoryReportItem[]
|
||||
}
|
||||
|
||||
export interface ResourceUsageReportDevice {
|
||||
dispositivo: string
|
||||
cliente: string
|
||||
cpuPromedio: number
|
||||
memoriaPromedio: number
|
||||
redPromedioMB: number
|
||||
}
|
||||
|
||||
export interface ResourceUsageReport {
|
||||
periodo: { desde: string; hasta: string }
|
||||
dispositivos: ResourceUsageReportDevice[]
|
||||
}
|
||||
|
||||
export interface AlertsReportItem {
|
||||
id: string
|
||||
fecha: string
|
||||
titulo: string
|
||||
severidad: string
|
||||
estado: string
|
||||
dispositivo: string
|
||||
resueltoEn: string | null
|
||||
}
|
||||
|
||||
export interface AlertsReport {
|
||||
periodo: { desde: string; hasta: string }
|
||||
total: number
|
||||
items: AlertsReportItem[]
|
||||
}
|
||||
|
||||
function toDateStr(d: Date): string {
|
||||
return d.toISOString().split('T')[0]
|
||||
}
|
||||
|
||||
// TODO: replace with trpc.reportes.inventario (and optional date filter if backend supports it)
|
||||
export async function fetchInventoryReport(
|
||||
startDate: Date,
|
||||
endDate: Date
|
||||
): Promise<InventoryReport> {
|
||||
await new Promise((r) => setTimeout(r, 300))
|
||||
return {
|
||||
periodo: { desde: toDateStr(startDate), hasta: toDateStr(endDate) },
|
||||
total: 42,
|
||||
items: [
|
||||
{ id: '1', nombre: 'PC-Oficina-01', tipo: 'PC', cliente: 'Cliente A', ip: '192.168.1.10', so: 'Windows 11', estado: 'Activo' },
|
||||
{ id: '2', nombre: 'LAPTOP-Ventas-02', tipo: 'LAPTOP', cliente: 'Cliente A', ip: '192.168.1.22', so: 'Windows 11', estado: 'Activo' },
|
||||
{ id: '3', nombre: 'SRV-DC-01', tipo: 'SERVIDOR', cliente: 'Cliente B', ip: '10.0.0.5', so: 'Windows Server 2022', estado: 'Activo' },
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchResourceUsageReport(
|
||||
startDate: Date,
|
||||
endDate: Date
|
||||
): Promise<ResourceUsageReport> {
|
||||
await new Promise((r) => setTimeout(r, 300))
|
||||
return {
|
||||
periodo: { desde: toDateStr(startDate), hasta: toDateStr(endDate) },
|
||||
dispositivos: [
|
||||
{ dispositivo: 'PC-Oficina-01', cliente: 'Cliente A', cpuPromedio: 24, memoriaPromedio: 62, redPromedioMB: 120 },
|
||||
{ dispositivo: 'LAPTOP-Ventas-02', cliente: 'Cliente A', cpuPromedio: 18, memoriaPromedio: 45, redPromedioMB: 85 },
|
||||
{ dispositivo: 'SRV-DC-01', cliente: 'Cliente B', cpuPromedio: 12, memoriaPromedio: 78, redPromedioMB: 340 },
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
export async function fetchAlertsReport(
|
||||
startDate: Date,
|
||||
endDate: Date
|
||||
): Promise<AlertsReport> {
|
||||
await new Promise((r) => setTimeout(r, 300))
|
||||
return {
|
||||
periodo: { desde: toDateStr(startDate), hasta: toDateStr(endDate) },
|
||||
total: 28,
|
||||
items: [
|
||||
{ id: '1', fecha: '2024-01-15T10:30:00Z', titulo: 'CPU alto', severidad: 'CRITICAL', estado: 'RESUELTA', dispositivo: 'PC-Oficina-01', resueltoEn: '2024-01-15T10:45:00Z' },
|
||||
{ id: '2', fecha: '2024-01-15T09:00:00Z', titulo: 'Disco lleno', severidad: 'WARNING', estado: 'RESUELTA', dispositivo: 'SRV-DC-01', resueltoEn: '2024-01-15T11:00:00Z' },
|
||||
],
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user