@fleetbase/fleetops-engine 0.6.51 → 0.6.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/addon/components/cell/telematic-provider.hbs +16 -0
- package/addon/components/cell/telematic-provider.js +36 -0
- package/addon/components/cell/telematic-status.hbs +1 -0
- package/addon/components/cell/telematic-status.js +39 -0
- package/addon/components/device/manager.hbs +5 -6
- package/addon/components/device/manager.js +12 -15
- package/addon/components/driver/details.hbs +1 -1
- package/addon/components/fleet/vehicle-listing.js +1 -0
- package/addon/components/fuel-integration/form.hbs +200 -0
- package/addon/components/fuel-integration/form.js +242 -0
- package/addon/components/fuel-integration/hub.hbs +154 -0
- package/addon/components/fuel-integration/hub.js +165 -0
- package/addon/components/fuel-integration/matching-priority.hbs +76 -0
- package/addon/components/fuel-integration/matching-priority.js +145 -0
- package/addon/components/fuel-report/details.hbs +13 -1
- package/addon/components/issue/details.hbs +3 -57
- package/addon/components/issue/details.js +0 -96
- package/addon/components/layout/fleet-ops-sidebar.js +20 -2
- package/addon/components/map/drawer/device-event-listing.hbs +12 -2
- package/addon/components/map/drawer/driver-listing.hbs +14 -1
- package/addon/components/map/drawer/place-listing.hbs +14 -1
- package/addon/components/map/drawer/position-listing.hbs +12 -2
- package/addon/components/map/drawer/vehicle-listing.hbs +14 -1
- package/addon/components/modals/assigned-orders.hbs +40 -0
- package/addon/components/modals/attach-device.hbs +4 -3
- package/addon/components/modals/attach-telematic-device.hbs +25 -0
- package/addon/components/modals/attach-telematic-device.js +3 -0
- package/addon/components/modals/driver-assign-order.hbs +7 -58
- package/addon/components/modals/driver-assign-vehicle.hbs +10 -2
- package/addon/components/modals/fleet-assign-driver.hbs +18 -0
- package/addon/components/modals/fleet-assign-driver.js +3 -0
- package/addon/components/modals/fleet-assign-vehicle.hbs +18 -0
- package/addon/components/modals/fleet-assign-vehicle.js +3 -0
- package/addon/components/modals/telematic-connection-diagnostics.hbs +75 -0
- package/addon/components/modals/telematic-connection-diagnostics.js +287 -0
- package/addon/components/modals/vehicle-details.hbs +6 -1
- package/addon/components/modals/vehicle-form.hbs +8 -1
- package/addon/components/order/card.hbs +106 -0
- package/addon/components/order/card.js +257 -0
- package/addon/components/order/form/service-rate.hbs +2 -0
- package/addon/components/service-rate/form.hbs +3 -2
- package/addon/components/telematic/details.hbs +98 -87
- package/addon/components/telematic/details.js +230 -1
- package/addon/components/telematic/form.hbs +303 -72
- package/addon/components/telematic/form.js +519 -3
- package/addon/components/telematic/hub.hbs +149 -0
- package/addon/components/telematic/hub.js +142 -0
- package/addon/components/telematic/settings.hbs +152 -0
- package/addon/components/telematic/settings.js +45 -0
- package/addon/components/telematic/tab-empty-state.hbs +29 -0
- package/addon/components/telematic/tab-empty-state.js +33 -0
- package/addon/components/vehicle/details.hbs +6 -1
- package/addon/components/vehicle/form.hbs +2 -1
- package/addon/components/widget/fuel-providers.hbs +43 -0
- package/addon/components/widget/fuel-providers.js +27 -0
- package/addon/controllers/connectivity/devices/index/details.js +27 -1
- package/addon/controllers/connectivity/devices/index.js +14 -0
- package/addon/controllers/connectivity/fuel-providers/details/sync.js +18 -0
- package/addon/controllers/connectivity/fuel-providers/details/transactions.js +24 -0
- package/addon/controllers/connectivity/fuel-providers/details.js +69 -0
- package/addon/controllers/connectivity/fuel-providers/edit.js +24 -0
- package/addon/controllers/connectivity/fuel-providers/index.js +177 -0
- package/addon/controllers/connectivity/fuel-providers/new.js +37 -0
- package/addon/controllers/connectivity/telematics/details/attachments.js +247 -0
- package/addon/controllers/connectivity/telematics/details/devices.js +368 -0
- package/addon/controllers/connectivity/telematics/details/events.js +244 -0
- package/addon/controllers/connectivity/telematics/details/index.js +3 -0
- package/addon/controllers/connectivity/telematics/details/logs.js +43 -0
- package/addon/controllers/connectivity/telematics/details/sensors.js +270 -0
- package/addon/controllers/connectivity/telematics/details.js +149 -0
- package/addon/controllers/connectivity/telematics/{index/edit.js → edit.js} +15 -4
- package/addon/controllers/connectivity/telematics/index.js +25 -5
- package/addon/controllers/connectivity/telematics/{index/new.js → new.js} +8 -2
- package/addon/controllers/management/drivers/index/details.js +78 -1
- package/addon/controllers/management/drivers/index.js +39 -0
- package/addon/controllers/management/fleets/index/details.js +23 -1
- package/addon/controllers/management/fleets/index.js +6 -1
- package/addon/controllers/management/fuel-reports/index.js +37 -1
- package/addon/controllers/management/fuel-transactions/index/details.js +70 -0
- package/addon/controllers/management/fuel-transactions/index.js +240 -0
- package/addon/controllers/management/vehicles/index/details.js +32 -0
- package/addon/controllers/management/vehicles/index.js +26 -0
- package/addon/controllers/operations/orders/index.js +4 -0
- package/addon/controllers/settings/payments/index.js +5 -0
- package/addon/extension.js +10 -0
- package/addon/routes/connectivity/fuel-providers/details/index.js +7 -0
- package/addon/routes/connectivity/fuel-providers/details/matching.js +7 -0
- package/addon/routes/connectivity/fuel-providers/details/settings.js +7 -0
- package/addon/routes/connectivity/fuel-providers/details/sync.js +18 -0
- package/addon/routes/connectivity/fuel-providers/details/transactions.js +14 -0
- package/addon/routes/connectivity/fuel-providers/details.js +18 -0
- package/addon/routes/connectivity/fuel-providers/edit.js +18 -0
- package/addon/routes/connectivity/fuel-providers/index.js +20 -0
- package/addon/routes/connectivity/fuel-providers/new.js +3 -0
- package/addon/routes/connectivity/fuel-providers.js +3 -0
- package/addon/routes/connectivity/telematics/details/attachments.js +28 -0
- package/addon/routes/connectivity/telematics/details/devices.js +30 -0
- package/addon/routes/connectivity/telematics/details/events.js +33 -0
- package/addon/routes/connectivity/telematics/details/index.js +3 -0
- package/addon/routes/connectivity/telematics/details/logs.js +17 -0
- package/addon/routes/connectivity/telematics/details/sensors.js +29 -0
- package/addon/routes/connectivity/telematics/{index/details.js → details.js} +1 -1
- package/addon/routes/connectivity/telematics/{index/edit.js → edit.js} +1 -1
- package/addon/routes/connectivity/telematics/new.js +3 -0
- package/addon/routes/management/drivers/index/details/activity.js +3 -0
- package/addon/routes/management/fuel-reports/index.js +2 -0
- package/addon/routes/management/fuel-transactions/index/details.js +18 -0
- package/addon/routes/management/fuel-transactions/index.js +21 -0
- package/addon/routes/management/fuel-transactions.js +3 -0
- package/addon/routes.js +28 -9
- package/addon/services/device-actions.js +64 -1
- package/addon/services/device-event-actions.js +12 -1
- package/addon/services/driver-actions.js +147 -11
- package/addon/services/fleet-actions.js +66 -1
- package/addon/services/fuel-integration-actions.js +31 -0
- package/addon/services/issue-actions.js +1 -1
- package/addon/services/telematic-actions.js +9 -3
- package/addon/services/vehicle-actions.js +125 -0
- package/addon/styles/fleetops-engine.css +310 -34
- package/addon/templates/analytics/reports/index.hbs +19 -1
- package/addon/templates/connectivity/devices/index.hbs +19 -1
- package/addon/templates/connectivity/events/index.hbs +16 -1
- package/addon/templates/connectivity/fuel-providers/details/index.hbs +38 -0
- package/addon/templates/connectivity/fuel-providers/details/matching.hbs +13 -0
- package/addon/templates/connectivity/fuel-providers/details/settings.hbs +11 -0
- package/addon/templates/connectivity/fuel-providers/details/sync.hbs +48 -0
- package/addon/templates/connectivity/fuel-providers/details/transactions.hbs +21 -0
- package/addon/templates/connectivity/fuel-providers/details.hbs +51 -0
- package/addon/templates/connectivity/fuel-providers/edit.hbs +24 -0
- package/addon/templates/connectivity/fuel-providers/index.hbs +12 -0
- package/addon/templates/connectivity/fuel-providers/new.hbs +22 -0
- package/addon/templates/connectivity/fuel-providers.hbs +1 -0
- package/addon/templates/connectivity/sensors/index.hbs +19 -1
- package/addon/templates/connectivity/telematics/details/attachments.hbs +163 -0
- package/addon/templates/connectivity/telematics/details/devices.hbs +88 -0
- package/addon/templates/connectivity/telematics/details/events.hbs +101 -0
- package/addon/templates/connectivity/telematics/{index/details → details}/index.hbs +0 -1
- package/addon/templates/connectivity/telematics/details/logs.hbs +69 -0
- package/addon/templates/connectivity/telematics/details/sensors.hbs +88 -0
- package/addon/templates/connectivity/telematics/details.hbs +53 -0
- package/addon/templates/connectivity/telematics/edit.hbs +27 -0
- package/addon/templates/connectivity/telematics/index.hbs +6 -8
- package/addon/templates/connectivity/telematics/new.hbs +24 -0
- package/addon/templates/maintenance/equipment/index.hbs +19 -1
- package/addon/templates/maintenance/maintenances/index.hbs +15 -1
- package/addon/templates/maintenance/parts/index.hbs +19 -1
- package/addon/templates/maintenance/schedules/index.hbs +19 -1
- package/addon/templates/maintenance/work-orders/index.hbs +19 -1
- package/addon/templates/management/contacts/customers.hbs +15 -1
- package/addon/templates/management/contacts/index.hbs +19 -1
- package/addon/templates/management/drivers/index/details/activity.hbs +1 -0
- package/addon/templates/management/drivers/index.hbs +19 -1
- package/addon/templates/management/fleets/index.hbs +19 -1
- package/addon/templates/management/fuel-reports/index.hbs +19 -1
- package/addon/templates/management/fuel-transactions/index/details.hbs +73 -0
- package/addon/templates/management/fuel-transactions/index.hbs +58 -0
- package/addon/templates/management/fuel-transactions.hbs +1 -0
- package/addon/templates/management/issues/index.hbs +19 -1
- package/addon/templates/management/places/index.hbs +19 -1
- package/addon/templates/management/vehicles/index.hbs +19 -1
- package/addon/templates/management/vendors/index.hbs +19 -1
- package/addon/templates/management/vendors/integrated.hbs +13 -1
- package/addon/templates/operations/orders/index.hbs +19 -1
- package/addon/templates/operations/service-rates/index.hbs +19 -1
- package/addon/templates/settings/payments/index.hbs +15 -1
- package/addon/utils/fleet-ops-options.js +3 -0
- package/app/components/cell/telematic-provider.js +1 -0
- package/app/components/cell/telematic-status.js +1 -0
- package/app/components/fuel-integration/form.js +1 -0
- package/app/components/fuel-integration/hub.js +1 -0
- package/app/components/fuel-integration/matching-priority.js +1 -0
- package/app/components/modals/assigned-orders.js +1 -0
- package/app/components/modals/attach-telematic-device.js +1 -0
- package/app/components/modals/fleet-assign-driver.js +1 -0
- package/app/components/modals/fleet-assign-vehicle.js +1 -0
- package/app/components/modals/telematic-connection-diagnostics.js +1 -0
- package/app/components/order/card.js +1 -0
- package/app/components/telematic/hub.js +1 -0
- package/app/components/telematic/settings.js +1 -0
- package/app/components/telematic/tab-empty-state.js +1 -0
- package/app/components/widget/fuel-providers.js +1 -0
- package/app/controllers/connectivity/fuel-providers/details/sync.js +1 -0
- package/app/controllers/connectivity/{telematics/index/details/devices.js → fuel-providers/details/transactions.js} +1 -1
- package/app/controllers/connectivity/{telematics/index → fuel-providers}/details.js +1 -1
- package/app/controllers/connectivity/{telematics/index → fuel-providers}/edit.js +1 -1
- package/app/controllers/connectivity/{telematics/index/details → fuel-providers}/index.js +1 -1
- package/app/controllers/connectivity/{telematics/index → fuel-providers}/new.js +1 -1
- package/app/controllers/connectivity/telematics/details/attachments.js +1 -0
- package/app/controllers/connectivity/telematics/details/devices.js +1 -0
- package/app/controllers/connectivity/telematics/details/events.js +1 -0
- package/app/controllers/connectivity/telematics/details/index.js +1 -0
- package/app/controllers/connectivity/telematics/details/logs.js +1 -0
- package/app/controllers/connectivity/telematics/details/sensors.js +1 -0
- package/app/controllers/connectivity/telematics/details.js +1 -0
- package/app/controllers/connectivity/telematics/edit.js +1 -0
- package/app/controllers/connectivity/telematics/new.js +1 -0
- package/app/controllers/management/fuel-transactions/index/details.js +1 -0
- package/app/controllers/management/fuel-transactions/index.js +1 -0
- package/app/routes/connectivity/{telematics/index → fuel-providers}/details/index.js +1 -1
- package/app/routes/connectivity/{telematics/index/details/events.js → fuel-providers/details/matching.js} +1 -1
- package/app/routes/connectivity/fuel-providers/details/settings.js +1 -0
- package/app/routes/connectivity/fuel-providers/details/sync.js +1 -0
- package/app/routes/connectivity/{telematics/index/details/devices.js → fuel-providers/details/transactions.js} +1 -1
- package/app/routes/connectivity/{telematics/index → fuel-providers}/details.js +1 -1
- package/app/routes/connectivity/{telematics/index → fuel-providers}/edit.js +1 -1
- package/app/routes/connectivity/fuel-providers/index.js +1 -0
- package/app/routes/connectivity/{telematics/index → fuel-providers}/new.js +1 -1
- package/app/routes/connectivity/fuel-providers.js +1 -0
- package/app/routes/connectivity/telematics/details/attachments.js +1 -0
- package/app/routes/connectivity/telematics/details/devices.js +1 -0
- package/app/routes/connectivity/telematics/details/events.js +1 -0
- package/app/routes/connectivity/telematics/details/index.js +1 -0
- package/app/routes/connectivity/telematics/details/logs.js +1 -0
- package/app/routes/connectivity/telematics/details/sensors.js +1 -0
- package/app/routes/connectivity/telematics/details.js +1 -0
- package/app/routes/connectivity/telematics/edit.js +1 -0
- package/app/routes/connectivity/telematics/new.js +1 -0
- package/app/routes/management/drivers/index/details/activity.js +1 -0
- package/app/routes/management/fuel-transactions/index/details.js +1 -0
- package/app/routes/management/fuel-transactions/index.js +1 -0
- package/app/routes/management/fuel-transactions.js +1 -0
- package/app/services/fuel-integration-actions.js +1 -0
- package/app/templates/connectivity/{telematics/index → fuel-providers}/details/index.js +1 -1
- package/app/templates/connectivity/{telematics/index/details/events.js → fuel-providers/details/matching.js} +1 -1
- package/app/templates/connectivity/fuel-providers/details/settings.js +1 -0
- package/app/templates/connectivity/fuel-providers/details/sync.js +1 -0
- package/app/templates/connectivity/{telematics/index/details/devices.js → fuel-providers/details/transactions.js} +1 -1
- package/app/templates/connectivity/{telematics/index → fuel-providers}/details.js +1 -1
- package/app/templates/connectivity/{telematics/index → fuel-providers}/edit.js +1 -1
- package/app/templates/connectivity/fuel-providers/index.js +1 -0
- package/app/templates/connectivity/{telematics/index → fuel-providers}/new.js +1 -1
- package/app/templates/connectivity/fuel-providers.js +1 -0
- package/app/templates/connectivity/telematics/details/attachments.js +1 -0
- package/app/templates/connectivity/telematics/details/devices.js +1 -0
- package/app/templates/connectivity/telematics/details/events.js +1 -0
- package/app/templates/connectivity/telematics/details/index.js +1 -0
- package/app/templates/connectivity/telematics/details/logs.js +1 -0
- package/app/templates/connectivity/telematics/details/sensors.js +1 -0
- package/app/templates/connectivity/telematics/details.js +1 -0
- package/app/templates/connectivity/telematics/edit.js +1 -0
- package/app/templates/connectivity/telematics/new.js +1 -0
- package/app/templates/management/drivers/index/details/activity.js +1 -0
- package/app/templates/management/fuel-transactions/index/details.js +1 -0
- package/app/templates/management/fuel-transactions/index.js +1 -0
- package/app/templates/management/fuel-transactions.js +1 -0
- package/assets/images/telematics/providers/afaqy.webp +0 -0
- package/assets/images/telematics/providers/default.webp +0 -0
- package/assets/images/telematics/providers/flespi.webp +0 -0
- package/assets/images/telematics/providers/geotab.webp +0 -0
- package/assets/images/telematics/providers/safee.webp +0 -0
- package/assets/images/telematics/providers/samsara.webp +0 -0
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +4 -4
- package/server/config/fuel-providers.php +42 -0
- package/server/config/telematics.php +139 -130
- package/server/migrations/2026_06_06_000001_harden_device_events_telematics_contract.php +59 -0
- package/server/migrations/2026_06_08_000001_create_fuel_provider_connections_table.php +37 -0
- package/server/migrations/2026_06_08_000002_create_fuel_provider_transactions_table.php +53 -0
- package/server/migrations/2026_06_08_000003_create_fuel_provider_sync_runs_table.php +40 -0
- package/server/migrations/2026_06_10_000001_add_fuel_card_number_to_vehicles_table.php +25 -0
- package/server/migrations/2026_06_10_000002_add_vehicle_identity_columns_to_fuel_provider_transactions_table.php +39 -0
- package/server/src/Contracts/FuelProvider.php +30 -0
- package/server/src/Contracts/TelematicProviderDescriptor.php +3 -1
- package/server/src/Events/FuelProviderTransactionImported.php +17 -0
- package/server/src/Events/FuelProviderTransactionMatched.php +17 -0
- package/server/src/Events/FuelProviderTransactionUnmatched.php +17 -0
- package/server/src/Events/FuelReportCreatedFromProvider.php +18 -0
- package/server/src/Http/Controllers/Internal/v1/AnalyticsController.php +6 -0
- package/server/src/Http/Controllers/Internal/v1/DeviceController.php +76 -2
- package/server/src/Http/Controllers/Internal/v1/DeviceEventController.php +44 -0
- package/server/src/Http/Controllers/Internal/v1/DriverController.php +158 -7
- package/server/src/Http/Controllers/Internal/v1/FuelProviderConnectionController.php +124 -0
- package/server/src/Http/Controllers/Internal/v1/FuelProviderSyncRunController.php +10 -0
- package/server/src/Http/Controllers/Internal/v1/FuelProviderTransactionController.php +76 -0
- package/server/src/Http/Controllers/Internal/v1/SensorController.php +1 -1
- package/server/src/Http/Controllers/Internal/v1/TelematicController.php +178 -15
- package/server/src/Http/Controllers/Internal/v1/VehicleController.php +165 -0
- package/server/src/Http/Controllers/TelematicWebhookController.php +103 -19
- package/server/src/Http/Filter/FuelProviderConnectionFilter.php +33 -0
- package/server/src/Http/Filter/FuelProviderSyncRunFilter.php +28 -0
- package/server/src/Http/Filter/FuelProviderTransactionFilter.php +59 -0
- package/server/src/Http/Filter/FuelReportFilter.php +10 -0
- package/server/src/Http/Resources/v1/Driver.php +15 -0
- package/server/src/Http/Resources/v1/FuelProviderConnection.php +30 -0
- package/server/src/Http/Resources/v1/FuelProviderSyncRun.php +36 -0
- package/server/src/Http/Resources/v1/FuelProviderTransaction.php +54 -0
- package/server/src/Http/Resources/v1/FuelReport.php +28 -22
- package/server/src/Http/Resources/v1/Index/Driver.php +26 -20
- package/server/src/Http/Resources/v1/Index/Vehicle.php +29 -22
- package/server/src/Http/Resources/v1/Vehicle.php +17 -0
- package/server/src/Http/Resources/v1/VehicleWithoutDriver.php +2 -0
- package/server/src/Jobs/SyncFuelProviderTransactionsJob.php +57 -0
- package/server/src/Jobs/SyncTelematicDevicesJob.php +36 -6
- package/server/src/Jobs/TestTelematicConnectionJob.php +9 -22
- package/server/src/Models/Asset.php +2 -1
- package/server/src/Models/Contact.php +2 -1
- package/server/src/Models/Device.php +27 -4
- package/server/src/Models/DeviceEvent.php +40 -3
- package/server/src/Models/Driver.php +2 -1
- package/server/src/Models/Equipment.php +2 -1
- package/server/src/Models/Fleet.php +2 -1
- package/server/src/Models/FuelProviderConnection.php +60 -0
- package/server/src/Models/FuelProviderSyncRun.php +58 -0
- package/server/src/Models/FuelProviderTransaction.php +119 -0
- package/server/src/Models/FuelReport.php +16 -1
- package/server/src/Models/Part.php +2 -1
- package/server/src/Models/Sensor.php +21 -4
- package/server/src/Models/ServiceRate.php +39 -2
- package/server/src/Models/Vehicle.php +14 -2
- package/server/src/Models/Vendor.php +2 -1
- package/server/src/Providers/FleetOpsServiceProvider.php +10 -0
- package/server/src/Support/Analytics/FuelProviderSummary.php +42 -0
- package/server/src/Support/FuelProviders/FuelProviderDescriptor.php +55 -0
- package/server/src/Support/FuelProviders/FuelProviderRegistry.php +75 -0
- package/server/src/Support/FuelProviders/FuelProviderService.php +447 -0
- package/server/src/Support/FuelProviders/Providers/AbstractFuelProvider.php +98 -0
- package/server/src/Support/FuelProviders/Providers/PetroAppFuelProvider.php +167 -0
- package/server/src/Support/Telematics/Providers/AbstractProvider.php +27 -6
- package/server/src/Support/Telematics/Providers/AfaqyProvider.php +55 -26
- package/server/src/Support/Telematics/Providers/FlespiProvider.php +1 -0
- package/server/src/Support/Telematics/Providers/GeotabProvider.php +1 -0
- package/server/src/Support/Telematics/Providers/SafeeProvider.php +32 -22
- package/server/src/Support/Telematics/Providers/SamsaraProvider.php +3 -1
- package/server/src/Support/Telematics/TelematicService.php +340 -21
- package/server/src/routes.php +41 -4
- package/server/tests/FuelProviderRegistryTest.php +416 -0
- package/server/tests/ServiceRateAlgorithmWeightVariablesTest.php +44 -0
- package/server/tests/TelematicsHardeningTest.php +268 -0
- package/server/tests/VehicleDriverAssignmentTest.php +51 -0
- package/translations/ar-ae.yml +22 -0
- package/translations/bg-bg.yaml +72 -0
- package/translations/en-us.yaml +83 -0
- package/translations/es-pa.yaml +72 -0
- package/translations/fr-fr.yaml +72 -0
- package/translations/mn-mn.yaml +72 -0
- package/translations/pt-br.yaml +72 -0
- package/translations/ru-ru.yaml +72 -0
- package/translations/vi-vn.yaml +97 -0
- package/addon/controllers/connectivity/telematics/index/details/devices.js +0 -3
- package/addon/controllers/connectivity/telematics/index/details/events.js +0 -3
- package/addon/controllers/connectivity/telematics/index/details/index.js +0 -3
- package/addon/controllers/connectivity/telematics/index/details/sensors.js +0 -3
- package/addon/controllers/connectivity/telematics/index/details.js +0 -24
- package/addon/routes/connectivity/telematics/index/details/devices.js +0 -3
- package/addon/routes/connectivity/telematics/index/details/events.js +0 -3
- package/addon/routes/connectivity/telematics/index/details/index.js +0 -3
- package/addon/routes/connectivity/telematics/index/details/sensors.js +0 -3
- package/addon/routes/connectivity/telematics/index/new.js +0 -3
- package/addon/templates/connectivity/telematics/index/details/devices.hbs +0 -1
- package/addon/templates/connectivity/telematics/index/details/events.hbs +0 -1
- package/addon/templates/connectivity/telematics/index/details/sensors.hbs +0 -1
- package/addon/templates/connectivity/telematics/index/details.hbs +0 -14
- package/addon/templates/connectivity/telematics/index/edit.hbs +0 -12
- package/addon/templates/connectivity/telematics/index/new.hbs +0 -12
- package/app/controllers/connectivity/telematics/index/details/events.js +0 -1
- package/app/controllers/connectivity/telematics/index/details/sensors.js +0 -1
- package/app/routes/connectivity/telematics/index/details/sensors.js +0 -1
- package/app/templates/connectivity/telematics/index/details/sensors.js +0 -1
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import Controller from '@ember/controller';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import { inject as service } from '@ember/service';
|
|
4
|
+
import { tracked } from '@glimmer/tracking';
|
|
5
|
+
|
|
6
|
+
export default class ConnectivityTelematicsDetailsAttachmentsController extends Controller {
|
|
7
|
+
@service deviceActions;
|
|
8
|
+
@service hostRouter;
|
|
9
|
+
@service intl;
|
|
10
|
+
@service modalsManager;
|
|
11
|
+
@service notifications;
|
|
12
|
+
|
|
13
|
+
@tracked queryParams = ['query', 'status', 'attachment_state', 'vehicle', 'sort'];
|
|
14
|
+
@tracked telematic;
|
|
15
|
+
@tracked query;
|
|
16
|
+
@tracked status;
|
|
17
|
+
@tracked attachment_state;
|
|
18
|
+
@tracked vehicle;
|
|
19
|
+
@tracked sort = '-updated_at';
|
|
20
|
+
|
|
21
|
+
get syncedDevices() {
|
|
22
|
+
return Array.from(this.model ?? []);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get devices() {
|
|
26
|
+
const query = String(this.query ?? '')
|
|
27
|
+
.trim()
|
|
28
|
+
.toLowerCase();
|
|
29
|
+
|
|
30
|
+
return this.syncedDevices.filter((device) => {
|
|
31
|
+
const matchesQuery =
|
|
32
|
+
!query ||
|
|
33
|
+
[device.displayName, device.name, device.device_id, device.serial_number, device.imei, device.attached_to_name, device.status, device.connection_status]
|
|
34
|
+
.filter(Boolean)
|
|
35
|
+
.some((value) => String(value).toLowerCase().includes(query));
|
|
36
|
+
|
|
37
|
+
const matchesStatus = !this.status || device.status === this.status || device.connection_status === this.status;
|
|
38
|
+
const matchesAttachmentState =
|
|
39
|
+
!this.attachment_state || (this.attachment_state === 'attached' && device.attachable_uuid) || (this.attachment_state === 'unattached' && !device.attachable_uuid);
|
|
40
|
+
const matchesVehicle = !this.vehicle || device.attachable_uuid === this.vehicle;
|
|
41
|
+
|
|
42
|
+
return matchesQuery && matchesStatus && matchesAttachmentState && matchesVehicle;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
get unattachedDevices() {
|
|
47
|
+
return this.devices.filter((device) => !device.attachable_uuid);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
get attachedDevices() {
|
|
51
|
+
return this.devices.filter((device) => device.attachable_uuid);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get onlineDevicesCount() {
|
|
55
|
+
return this.devices.filter((device) => device.is_online || device.connection_status === 'online' || device.status === 'online' || device.status === 'active').length;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get vehicleGroups() {
|
|
59
|
+
const groups = new Map();
|
|
60
|
+
|
|
61
|
+
for (const device of this.attachedDevices) {
|
|
62
|
+
const key = device.attachable_uuid;
|
|
63
|
+
|
|
64
|
+
if (!groups.has(key)) {
|
|
65
|
+
groups.set(key, {
|
|
66
|
+
id: key,
|
|
67
|
+
name: device.attached_to_name ?? 'Unknown vehicle',
|
|
68
|
+
devices: [],
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
groups.get(key).devices.push(device);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return Array.from(groups.values()).sort((a, b) => String(a.name).localeCompare(String(b.name)));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
get hasActiveFilters() {
|
|
79
|
+
return Boolean(this.query || this.status || this.attachment_state || this.vehicle);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
get hasSyncedDevices() {
|
|
83
|
+
return this.syncedDevices.length > 0;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
get hasVisibleDevices() {
|
|
87
|
+
return this.devices.length > 0;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
get hasOnlyUnattachedDevices() {
|
|
91
|
+
return this.unattachedDevices.length > 0 && this.vehicleGroups.length === 0 && !this.hasActiveFilters;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
get allMapped() {
|
|
95
|
+
return this.hasSyncedDevices && this.unattachedDevices.length === 0 && this.vehicleGroups.length > 0 && !this.hasActiveFilters;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
get emptyStateVariant() {
|
|
99
|
+
if (!this.hasSyncedDevices) {
|
|
100
|
+
return 'not_synced';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (this.hasActiveFilters && !this.hasVisibleDevices) {
|
|
104
|
+
return 'filtered_empty';
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (this.allMapped) {
|
|
108
|
+
return 'empty';
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (this.hasOnlyUnattachedDevices) {
|
|
112
|
+
return 'unattached_only';
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
get emptyStateContent() {
|
|
119
|
+
switch (this.emptyStateVariant) {
|
|
120
|
+
case 'not_synced':
|
|
121
|
+
return {
|
|
122
|
+
tone: 'warning',
|
|
123
|
+
icon: 'satellite-dish',
|
|
124
|
+
title: 'Sync devices before mapping vehicles',
|
|
125
|
+
message: 'Vehicle attachment starts after provider devices are synced into this connection.',
|
|
126
|
+
primaryText: 'Go to Devices',
|
|
127
|
+
primaryIcon: 'microchip',
|
|
128
|
+
primaryAction: this.goToDevices,
|
|
129
|
+
};
|
|
130
|
+
case 'filtered_empty':
|
|
131
|
+
return {
|
|
132
|
+
tone: 'info',
|
|
133
|
+
icon: 'filter',
|
|
134
|
+
title: 'No mappings match these filters',
|
|
135
|
+
message: 'Clear the search and filters to return to all synced devices and vehicle mappings.',
|
|
136
|
+
primaryText: 'Clear filters',
|
|
137
|
+
primaryIcon: 'filter',
|
|
138
|
+
primaryAction: this.clearFilters,
|
|
139
|
+
};
|
|
140
|
+
case 'empty':
|
|
141
|
+
return {
|
|
142
|
+
tone: 'success',
|
|
143
|
+
icon: 'check',
|
|
144
|
+
title: 'All synced devices are mapped',
|
|
145
|
+
message: 'Every synced provider device in this connection is currently attached to a vehicle.',
|
|
146
|
+
};
|
|
147
|
+
case 'unattached_only':
|
|
148
|
+
return {
|
|
149
|
+
tone: 'warning',
|
|
150
|
+
icon: 'link-slash',
|
|
151
|
+
title: 'Attach synced devices to vehicles',
|
|
152
|
+
message: 'Use the unattached devices section below to map each device deliberately. Bulk auto-attachment is intentionally not available here.',
|
|
153
|
+
};
|
|
154
|
+
default:
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
get metrics() {
|
|
160
|
+
return [
|
|
161
|
+
{ label: 'Vehicles mapped', value: this.vehicleGroups.length, icon: 'truck', accentClass: 'fleetops-connectivity-kpi-accent-blue' },
|
|
162
|
+
{ label: 'Attached devices', value: this.attachedDevices.length, icon: 'link', accentClass: 'fleetops-connectivity-kpi-accent-green' },
|
|
163
|
+
{ label: 'Unattached devices', value: this.unattachedDevices.length, icon: 'link-slash', accentClass: 'fleetops-connectivity-kpi-accent-amber' },
|
|
164
|
+
{ label: 'Online devices', value: this.onlineDevicesCount, icon: 'signal', accentClass: 'fleetops-connectivity-kpi-accent-green' },
|
|
165
|
+
];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
@action updateQuery(event) {
|
|
169
|
+
this.query = event.target.value;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@action updateAttachmentState(event) {
|
|
173
|
+
this.attachment_state = event.target.value || null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@action updateStatus(event) {
|
|
177
|
+
this.status = event.target.value || null;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
@action clearFilters() {
|
|
181
|
+
this.query = null;
|
|
182
|
+
this.status = null;
|
|
183
|
+
this.attachment_state = null;
|
|
184
|
+
this.vehicle = null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@action goToDevices() {
|
|
188
|
+
return this.hostRouter.transitionTo('console.fleet-ops.connectivity.telematics.details.devices', this.telematic);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
@action openAttachDeviceModal(device) {
|
|
192
|
+
this.modalsManager.show('modals/attach-telematic-device', {
|
|
193
|
+
title: this.intl.t('device.prompts.attach-device-to-vehicle-title', { deviceName: device.displayName ?? device.name ?? device.device_id ?? this.intl.t('resource.device') }),
|
|
194
|
+
acceptButtonText: this.intl.t('device.actions.attach-to-vehicle'),
|
|
195
|
+
device,
|
|
196
|
+
selectedVehicle: null,
|
|
197
|
+
confirm: async (modal) => {
|
|
198
|
+
const selectedVehicle = modal.getOption('selectedVehicle');
|
|
199
|
+
if (!selectedVehicle) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
device.setProperties({
|
|
204
|
+
attachable_uuid: selectedVehicle.id,
|
|
205
|
+
attachable_type: 'fleet-ops:vehicle',
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
modal.startLoading();
|
|
209
|
+
|
|
210
|
+
try {
|
|
211
|
+
await device.save();
|
|
212
|
+
this.notifications.success(this.intl.t('device.prompts.attach-to-vehicle-success'));
|
|
213
|
+
await this.hostRouter.refresh();
|
|
214
|
+
modal.done();
|
|
215
|
+
} catch (error) {
|
|
216
|
+
device.rollbackAttributes();
|
|
217
|
+
this.notifications.serverError(error);
|
|
218
|
+
modal.stopLoading();
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
@action detachDevice(device) {
|
|
225
|
+
const deviceName = device.displayName ?? device.name ?? device.device_id ?? this.intl.t('resource.device');
|
|
226
|
+
|
|
227
|
+
this.modalsManager.confirm({
|
|
228
|
+
title: this.intl.t('device.prompts.detach-telematic-device-title', { deviceName }),
|
|
229
|
+
body: this.intl.t('device.prompts.detach-telematic-device-body', { deviceName }),
|
|
230
|
+
confirm: async (modal) => {
|
|
231
|
+
modal.startLoading();
|
|
232
|
+
device.setProperties({ attachable_uuid: null, attachable_type: null });
|
|
233
|
+
|
|
234
|
+
try {
|
|
235
|
+
await device.save();
|
|
236
|
+
this.notifications.success(this.intl.t('device.prompts.detach-from-vehicle-success'));
|
|
237
|
+
await this.hostRouter.refresh();
|
|
238
|
+
modal.done();
|
|
239
|
+
} catch (error) {
|
|
240
|
+
device.rollbackAttributes();
|
|
241
|
+
this.notifications.serverError(error);
|
|
242
|
+
modal.stopLoading();
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
}
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
import Controller from '@ember/controller';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import { inject as service } from '@ember/service';
|
|
4
|
+
import { tracked } from '@glimmer/tracking';
|
|
5
|
+
import { task } from 'ember-concurrency';
|
|
6
|
+
import fleetOpsOptions from '../../../../utils/fleet-ops-options';
|
|
7
|
+
|
|
8
|
+
export default class ConnectivityTelematicsDetailsDevicesController extends Controller {
|
|
9
|
+
@service deviceActions;
|
|
10
|
+
@service fetch;
|
|
11
|
+
@service hostRouter;
|
|
12
|
+
@service intl;
|
|
13
|
+
@service modalsManager;
|
|
14
|
+
@service notifications;
|
|
15
|
+
|
|
16
|
+
@tracked queryParams = ['page', 'limit', 'sort', 'query', 'status', 'provider', 'attachment_state', 'device_id'];
|
|
17
|
+
@tracked telematic;
|
|
18
|
+
@tracked page = 1;
|
|
19
|
+
@tracked limit;
|
|
20
|
+
@tracked sort = '-updated_at';
|
|
21
|
+
@tracked query;
|
|
22
|
+
@tracked status;
|
|
23
|
+
@tracked provider;
|
|
24
|
+
@tracked attachment_state;
|
|
25
|
+
@tracked device_id;
|
|
26
|
+
|
|
27
|
+
get devices() {
|
|
28
|
+
return Array.from(this.model ?? []);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get totalDevices() {
|
|
32
|
+
return this.model?.meta?.total ?? this.devices.length;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get onlineDevicesCount() {
|
|
36
|
+
return this.devices.filter((device) => device.is_online || device.connection_status === 'online' || device.status === 'online' || device.status === 'active').length;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get unattachedDevicesCount() {
|
|
40
|
+
return this.devices.filter((device) => !device.attachable_uuid).length;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get offlineDevicesCount() {
|
|
44
|
+
return Math.max(this.devices.length - this.onlineDevicesCount, 0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get hasActiveFilters() {
|
|
48
|
+
return Boolean(this.query || this.status || this.provider || this.attachment_state || this.device_id);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get hasDevices() {
|
|
52
|
+
return this.devices.length > 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get isSyncing() {
|
|
56
|
+
return this.telematic?.status === 'synchronizing' || this.telematic?.meta?.last_sync_result === 'queued';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get hasSyncRun() {
|
|
60
|
+
const meta = this.telematic?.meta ?? {};
|
|
61
|
+
|
|
62
|
+
return Boolean(meta.last_sync_started_at || meta.last_sync_completed_at || meta.last_sync_job_id || meta.last_sync_result || meta.last_sync_total);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get emptyStateVariant() {
|
|
66
|
+
if (this.hasDevices) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (this.hasActiveFilters) {
|
|
71
|
+
return 'filtered_empty';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (this.isSyncing) {
|
|
75
|
+
return 'syncing';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (!this.hasSyncRun) {
|
|
79
|
+
return 'not_synced';
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return 'empty';
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
get emptyStateContent() {
|
|
86
|
+
switch (this.emptyStateVariant) {
|
|
87
|
+
case 'filtered_empty':
|
|
88
|
+
return {
|
|
89
|
+
tone: 'info',
|
|
90
|
+
icon: 'filter',
|
|
91
|
+
title: 'No devices match these filters',
|
|
92
|
+
message: 'Clear the current search and filters to return to the synced device inventory.',
|
|
93
|
+
primaryText: 'Clear filters',
|
|
94
|
+
primaryIcon: 'filter',
|
|
95
|
+
primaryAction: this.clearFilters,
|
|
96
|
+
};
|
|
97
|
+
case 'syncing':
|
|
98
|
+
return {
|
|
99
|
+
tone: 'info',
|
|
100
|
+
icon: 'rotate',
|
|
101
|
+
title: 'Device sync is running',
|
|
102
|
+
message: 'Devices are being fetched from the provider. Refresh this tab when the sync job finishes.',
|
|
103
|
+
primaryText: 'Refresh',
|
|
104
|
+
primaryIcon: 'refresh',
|
|
105
|
+
primaryAction: this.refresh,
|
|
106
|
+
};
|
|
107
|
+
case 'not_synced':
|
|
108
|
+
return {
|
|
109
|
+
tone: 'warning',
|
|
110
|
+
icon: 'satellite-dish',
|
|
111
|
+
title: 'No device sync has run yet',
|
|
112
|
+
message: 'Sync devices from this provider connection to build the inventory and start vehicle attachment.',
|
|
113
|
+
primaryText: 'Sync Devices',
|
|
114
|
+
primaryIcon: 'satellite-dish',
|
|
115
|
+
primaryAction: this.startDeviceSync,
|
|
116
|
+
secondaryText: 'Test Connection',
|
|
117
|
+
secondaryIcon: 'plug',
|
|
118
|
+
secondaryAction: this.openConnectionTestDialog,
|
|
119
|
+
};
|
|
120
|
+
case 'empty':
|
|
121
|
+
return {
|
|
122
|
+
tone: 'info',
|
|
123
|
+
icon: 'microchip',
|
|
124
|
+
title: 'Provider returned no devices',
|
|
125
|
+
message: 'The connection synced successfully, but the provider did not return device inventory for these credentials.',
|
|
126
|
+
primaryText: 'Sync Again',
|
|
127
|
+
primaryIcon: 'refresh',
|
|
128
|
+
primaryAction: this.startDeviceSync,
|
|
129
|
+
secondaryText: 'Test Connection',
|
|
130
|
+
secondaryIcon: 'plug',
|
|
131
|
+
secondaryAction: this.openConnectionTestDialog,
|
|
132
|
+
note: 'Check provider permissions and account scope if devices exist in the provider dashboard.',
|
|
133
|
+
};
|
|
134
|
+
default:
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
get metrics() {
|
|
140
|
+
return [
|
|
141
|
+
{ label: 'Synced devices', value: this.totalDevices, icon: 'microchip', accentClass: 'fleetops-connectivity-kpi-accent-blue' },
|
|
142
|
+
{ label: 'Online', value: this.onlineDevicesCount, icon: 'signal', accentClass: 'fleetops-connectivity-kpi-accent-green' },
|
|
143
|
+
{ label: 'Unattached', value: this.unattachedDevicesCount, icon: 'link-slash', accentClass: 'fleetops-connectivity-kpi-accent-amber' },
|
|
144
|
+
{ label: 'Offline / unknown', value: this.offlineDevicesCount, icon: 'power-off', accentClass: 'fleetops-connectivity-kpi-accent-rose' },
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
@tracked actionButtons = [
|
|
149
|
+
{
|
|
150
|
+
icon: 'refresh',
|
|
151
|
+
size: 'xs',
|
|
152
|
+
onClick: this.refresh,
|
|
153
|
+
helpText: this.intl.t('common.refresh'),
|
|
154
|
+
wrapperClass: 'fleetops-telematics-action-button',
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
icon: 'ellipsis-h',
|
|
158
|
+
prefix: 'fas',
|
|
159
|
+
text: 'Actions',
|
|
160
|
+
type: 'primary',
|
|
161
|
+
size: 'xs',
|
|
162
|
+
triggerClass: 'fleetops-telematics-action-button',
|
|
163
|
+
items: [
|
|
164
|
+
{
|
|
165
|
+
icon: 'satellite-dish',
|
|
166
|
+
text: 'Sync Devices',
|
|
167
|
+
onClick: this.startDeviceSync,
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
icon: 'link',
|
|
171
|
+
text: 'Attach Unassigned',
|
|
172
|
+
onClick: this.openAttachmentsForUnassigned,
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
];
|
|
177
|
+
|
|
178
|
+
@tracked bulkActions = [];
|
|
179
|
+
|
|
180
|
+
get columns() {
|
|
181
|
+
return [
|
|
182
|
+
{
|
|
183
|
+
sticky: true,
|
|
184
|
+
label: this.intl.t('column.name'),
|
|
185
|
+
valuePath: 'displayName',
|
|
186
|
+
cellComponent: 'table/cell/anchor',
|
|
187
|
+
action: this.deviceActions.transition.view,
|
|
188
|
+
permission: 'fleet-ops view device',
|
|
189
|
+
resizable: true,
|
|
190
|
+
sortable: true,
|
|
191
|
+
filterable: true,
|
|
192
|
+
filterParam: 'query',
|
|
193
|
+
filterComponent: 'filter/string',
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
label: 'Provider ID',
|
|
197
|
+
valuePath: 'device_id',
|
|
198
|
+
resizable: true,
|
|
199
|
+
sortable: true,
|
|
200
|
+
filterable: true,
|
|
201
|
+
filterParam: 'device_id',
|
|
202
|
+
filterComponent: 'filter/string',
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
label: 'Vehicle',
|
|
206
|
+
valuePath: 'attached_to_name',
|
|
207
|
+
resizable: true,
|
|
208
|
+
sortable: true,
|
|
209
|
+
filterable: true,
|
|
210
|
+
filterParam: 'attachment_state',
|
|
211
|
+
filterComponent: 'filter/multi-option',
|
|
212
|
+
filterOptions: [
|
|
213
|
+
{ label: 'Attached', value: 'attached' },
|
|
214
|
+
{ label: 'Unattached', value: 'unattached' },
|
|
215
|
+
],
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
label: 'Connection',
|
|
219
|
+
valuePath: 'connection_status',
|
|
220
|
+
cellComponent: 'table/cell/status',
|
|
221
|
+
resizable: true,
|
|
222
|
+
sortable: true,
|
|
223
|
+
filterable: true,
|
|
224
|
+
filterParam: 'status',
|
|
225
|
+
filterComponent: 'filter/multi-option',
|
|
226
|
+
filterOptions: fleetOpsOptions('deviceStatuses'),
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
label: 'Last Seen',
|
|
230
|
+
valuePath: 'lastOnlineAt',
|
|
231
|
+
sortParam: 'last_online_at',
|
|
232
|
+
resizable: true,
|
|
233
|
+
sortable: true,
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
label: this.intl.t('column.updated-at'),
|
|
237
|
+
valuePath: 'updatedAt',
|
|
238
|
+
sortParam: 'updated_at',
|
|
239
|
+
resizable: true,
|
|
240
|
+
sortable: true,
|
|
241
|
+
hidden: true,
|
|
242
|
+
filterable: true,
|
|
243
|
+
filterComponent: 'filter/date',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
label: '',
|
|
247
|
+
cellComponent: 'table/cell/dropdown',
|
|
248
|
+
ddButtonText: false,
|
|
249
|
+
ddButtonIcon: 'ellipsis-h',
|
|
250
|
+
ddButtonIconPrefix: 'fas',
|
|
251
|
+
ddMenuLabel: this.intl.t('common.resource-actions', { resource: this.intl.t('resource.device') }),
|
|
252
|
+
cellClassNames: 'overflow-visible align-middle',
|
|
253
|
+
wrapperClass: 'flex items-center justify-end mx-2',
|
|
254
|
+
sticky: 'right',
|
|
255
|
+
width: 60,
|
|
256
|
+
actions: [
|
|
257
|
+
{
|
|
258
|
+
label: this.intl.t('common.view-resource', { resource: this.intl.t('resource.device') }),
|
|
259
|
+
fn: this.deviceActions.transition.view,
|
|
260
|
+
permission: 'fleet-ops view device',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
label: this.intl.t('common.edit-resource', { resource: this.intl.t('resource.device') }),
|
|
264
|
+
fn: this.deviceActions.transition.edit,
|
|
265
|
+
permission: 'fleet-ops update device',
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
label: 'Attach or change vehicle',
|
|
269
|
+
fn: this.openAttachDeviceModal,
|
|
270
|
+
permission: 'fleet-ops update device',
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
label: 'Review recent events',
|
|
274
|
+
fn: this.openDeviceEvents,
|
|
275
|
+
permission: 'fleet-ops view device-event',
|
|
276
|
+
},
|
|
277
|
+
],
|
|
278
|
+
sortable: false,
|
|
279
|
+
filterable: false,
|
|
280
|
+
resizable: false,
|
|
281
|
+
searchable: false,
|
|
282
|
+
},
|
|
283
|
+
];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
@action refresh() {
|
|
287
|
+
return this.hostRouter.refresh();
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
@action clearFilters() {
|
|
291
|
+
this.query = null;
|
|
292
|
+
this.status = null;
|
|
293
|
+
this.provider = null;
|
|
294
|
+
this.attachment_state = null;
|
|
295
|
+
this.device_id = null;
|
|
296
|
+
this.page = 1;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
@action openConnectionTestDialog() {
|
|
300
|
+
this.modalsManager.show('modals/telematic-connection-diagnostics', {
|
|
301
|
+
title: 'Test Connection',
|
|
302
|
+
acceptButtonText: 'Run Test',
|
|
303
|
+
acceptButtonIcon: 'plug',
|
|
304
|
+
declineButtonText: 'Close',
|
|
305
|
+
telematic: this.telematic,
|
|
306
|
+
onTested: () => this.hostRouter.refresh(),
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
@action openAttachmentsForUnassigned() {
|
|
311
|
+
return this.hostRouter.transitionTo('console.fleet-ops.connectivity.telematics.details.attachments', this.telematic, {
|
|
312
|
+
queryParams: { attachment_state: 'unattached' },
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
@action openDeviceEvents(device) {
|
|
317
|
+
return this.hostRouter.transitionTo('console.fleet-ops.connectivity.telematics.details.events', this.telematic, {
|
|
318
|
+
queryParams: { device_uuid: device.id },
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
@action openAttachDeviceModal(device) {
|
|
323
|
+
this.modalsManager.show('modals/attach-telematic-device', {
|
|
324
|
+
title: this.intl.t('device.prompts.attach-device-to-vehicle-title', { deviceName: device.displayName ?? device.name ?? device.device_id ?? this.intl.t('resource.device') }),
|
|
325
|
+
acceptButtonText: this.intl.t('device.actions.attach-to-vehicle'),
|
|
326
|
+
device,
|
|
327
|
+
selectedVehicle: null,
|
|
328
|
+
confirm: async (modal) => {
|
|
329
|
+
const selectedVehicle = modal.getOption('selectedVehicle');
|
|
330
|
+
if (!selectedVehicle) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
device.setProperties({
|
|
335
|
+
attachable_uuid: selectedVehicle.id,
|
|
336
|
+
attachable_type: 'fleet-ops:vehicle',
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
modal.startLoading();
|
|
340
|
+
|
|
341
|
+
try {
|
|
342
|
+
await device.save();
|
|
343
|
+
this.notifications.success(this.intl.t('device.prompts.attach-to-vehicle-success'));
|
|
344
|
+
await this.hostRouter.refresh();
|
|
345
|
+
modal.done();
|
|
346
|
+
} catch (error) {
|
|
347
|
+
device.rollbackAttributes();
|
|
348
|
+
this.notifications.serverError(error);
|
|
349
|
+
modal.stopLoading();
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
@action startDeviceSync() {
|
|
356
|
+
return this.syncDevices.perform();
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
@task *syncDevices() {
|
|
360
|
+
try {
|
|
361
|
+
yield this.fetch.post(`telematics/${this.telematic.id}/discover`);
|
|
362
|
+
this.notifications.success('Device sync queued.');
|
|
363
|
+
yield this.hostRouter.refresh();
|
|
364
|
+
} catch (error) {
|
|
365
|
+
this.notifications.serverError(error);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|