@fleetbase/fleetops-engine 0.6.54 → 0.6.55
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/addon/components/admin/routing-settings.hbs +2 -1
- package/addon/components/cell/attached-vehicle.hbs +10 -0
- package/addon/components/cell/attached-vehicle.js +58 -0
- package/addon/components/cell/device-identity.hbs +24 -0
- package/addon/components/cell/device-identity.js +129 -0
- package/addon/components/cell/driver-identity.hbs +33 -0
- package/addon/components/cell/driver-identity.js +143 -0
- package/addon/components/cell/equipment-identity.hbs +5 -0
- package/addon/components/cell/equipment-identity.js +48 -0
- package/addon/components/cell/part-identity.hbs +5 -0
- package/addon/components/cell/part-identity.js +63 -0
- package/addon/components/cell/telematic-device.hbs +38 -0
- package/addon/components/cell/telematic-device.js +44 -0
- package/addon/components/cell/telematic-provider.hbs +33 -16
- package/addon/components/cell/telematic-provider.js +50 -8
- package/addon/components/cell/vehicle-identity.hbs +33 -0
- package/addon/components/cell/vehicle-identity.js +138 -0
- package/addon/components/device/form.hbs +2 -2
- package/addon/components/device/form.js +7 -0
- package/addon/components/device/panel-header.hbs +45 -20
- package/addon/components/device/panel-header.js +49 -1
- package/addon/components/device/panel-tabs/events.hbs +30 -0
- package/addon/components/device/panel-tabs/events.js +128 -0
- package/addon/components/device/panel-tabs/sensors.hbs +30 -0
- package/addon/components/device/panel-tabs/sensors.js +93 -0
- package/addon/components/device/panel-tabs/vehicle.hbs +68 -0
- package/addon/components/device/panel-tabs/vehicle.js +90 -0
- package/addon/components/equipment/form.js +8 -1
- package/addon/components/layout/fleet-ops-sidebar.hbs +1 -1
- package/addon/components/layout/fleet-ops-sidebar.js +8 -0
- package/addon/components/map/drawer/device-event-listing.js +2 -0
- package/addon/components/map/drawer/driver-listing.js +2 -0
- package/addon/components/map/drawer/place-listing.js +2 -0
- package/addon/components/map/drawer/position-listing.hbs +11 -6
- package/addon/components/map/drawer/position-listing.js +17 -4
- package/addon/components/map/drawer/vehicle-listing.js +2 -0
- package/addon/components/sensor/panel-header.hbs +47 -15
- package/addon/components/sensor/panel-header.js +59 -1
- package/addon/components/table/cell/dropdown/action-item.hbs +31 -0
- package/addon/components/table/cell/dropdown/action-item.js +62 -0
- package/addon/components/table/cell/dropdown.hbs +28 -0
- package/addon/components/table/cell/dropdown.js +91 -0
- package/addon/components/vendor/panel-header.hbs +82 -0
- package/addon/components/vendor/panel-header.js +48 -0
- package/addon/controllers/connectivity/devices/index/details/vehicle.js +49 -1
- package/addon/controllers/connectivity/devices/index.js +144 -129
- package/addon/controllers/connectivity/events/details.js +3 -0
- package/addon/controllers/connectivity/events/index.js +187 -11
- package/addon/controllers/connectivity/sensors/index.js +156 -14
- package/addon/controllers/connectivity/telematics/details/devices.js +126 -134
- package/addon/controllers/maintenance/equipment/index.js +1 -2
- package/addon/controllers/maintenance/parts/index.js +1 -2
- package/addon/controllers/management/drivers/index.js +82 -42
- package/addon/controllers/management/fuel-reports/index.js +63 -4
- package/addon/controllers/management/issues/index.js +63 -4
- package/addon/controllers/management/vehicles/index.js +33 -6
- package/addon/routes/connectivity/devices/index/details/vehicle.js +24 -2
- package/addon/routes/connectivity/devices/index.js +7 -0
- package/addon/routes/connectivity/events/details.js +3 -0
- package/addon/routes/connectivity/events/index.js +6 -2
- package/addon/routes/connectivity/sensors/index.js +7 -2
- package/addon/routes/connectivity/telematics/details/devices.js +2 -0
- package/addon/services/device-actions.js +30 -0
- package/addon/services/device-event-actions.js +1 -1
- package/addon/services/equipment-actions.js +1 -0
- package/addon/services/sensor-actions.js +3 -0
- package/addon/services/service-rate-actions.js +39 -1
- package/addon/services/vehicle-actions.js +24 -12
- package/addon/services/vendor-actions.js +3 -0
- package/addon/styles/fleetops-engine.css +8 -0
- package/addon/templates/connectivity/devices/index/details/vehicle.hbs +64 -1
- package/addon/templates/management/vendors/index/details.hbs +2 -2
- package/addon/templates/settings/notifications.hbs +2 -1
- package/addon/templates/settings/routing.hbs +1 -0
- package/addon/utils/device-table-columns.js +288 -0
- package/addon/utils/identity-cell-resource.js +20 -0
- package/addon/utils/map-drawer-dropdown-position.js +47 -0
- package/addon/utils/trackable-option.js +93 -0
- package/app/components/cell/attached-vehicle.js +1 -0
- package/app/components/cell/device-identity.js +1 -0
- package/app/components/cell/driver-identity.js +1 -0
- package/app/components/cell/equipment-identity.js +1 -0
- package/app/components/cell/part-identity.js +1 -0
- package/app/components/cell/telematic-device.js +1 -0
- package/app/components/cell/vehicle-identity.js +1 -0
- package/app/components/device/panel-tabs/events.hbs +30 -0
- package/app/components/device/panel-tabs/events.js +128 -0
- package/app/components/device/panel-tabs/sensors.hbs +30 -0
- package/app/components/device/panel-tabs/sensors.js +93 -0
- package/app/components/device/panel-tabs/vehicle.hbs +68 -0
- package/app/components/device/panel-tabs/vehicle.js +90 -0
- package/app/components/table/cell/dropdown/action-item.js +1 -0
- package/app/components/table/cell/dropdown.js +1 -0
- package/app/components/vendor/panel-header.js +1 -0
- package/app/controllers/connectivity/events/{index/details.js → details.js} +1 -1
- package/app/routes/connectivity/events/{index/details.js → details.js} +1 -1
- package/app/templates/connectivity/events/{index/details.js → details.js} +1 -1
- package/app/utils/map-drawer-dropdown-position.js +1 -0
- package/app/utils/trackable-option.js +1 -0
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +4 -4
- package/server/src/Console/Commands/SyncTelematics.php +4 -4
- package/server/src/Http/Controllers/Internal/v1/DeviceController.php +18 -1
- package/server/src/Http/Controllers/Internal/v1/DeviceEventController.php +1 -1
- package/server/src/Http/Controllers/Internal/v1/LiveController.php +1 -1
- package/server/src/Http/Controllers/Internal/v1/ServiceRateController.php +82 -13
- package/server/src/Http/Filter/DeviceEventFilter.php +21 -0
- package/server/src/Http/Filter/DeviceFilter.php +24 -1
- package/server/src/Http/Resources/v1/Index/Vehicle.php +19 -0
- package/server/src/Models/Device.php +2 -0
- package/server/src/Models/DeviceEvent.php +81 -0
- package/server/src/Models/Equipment.php +55 -0
- package/server/src/Support/Telematics/Providers/AfaqyProvider.php +1 -0
- package/server/src/Support/Telematics/Providers/FlespiProvider.php +89 -15
- package/server/src/Support/Telematics/Providers/GeotabProvider.php +123 -35
- package/server/src/Support/Telematics/Providers/SafeeProvider.php +26 -2
- package/server/src/Support/Telematics/Providers/SamsaraProvider.php +122 -14
- package/server/src/routes.php +0 -1
- package/server/tests/DeviceFilterTest.php +9 -0
- package/server/tests/DriverVehicleStatusDefaultTest.php +19 -2
- package/server/tests/EquipmentAssignmentMorphTypeTest.php +35 -0
- package/server/tests/ServiceRateRouteValidationTest.php +101 -0
- package/server/tests/TelematicsHardeningTest.php +238 -7
- package/addon/controllers/connectivity/events/index/details.js +0 -3
- package/addon/routes/connectivity/events/index/details.js +0 -3
- /package/addon/templates/connectivity/events/{index/details.hbs → details.hbs} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/components/cell/equipment-identity';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/components/cell/part-identity';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/components/cell/telematic-device';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/components/cell/vehicle-identity';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<div class="flex flex-col gap-3 p-3" ...attributes>
|
|
2
|
+
<div class="flex items-start justify-between gap-3">
|
|
3
|
+
<div class="min-w-0">
|
|
4
|
+
<h2 class="text-base font-bold text-gray-900 dark:text-gray-100">Telemetry Events</h2>
|
|
5
|
+
<p class="mt-0.5 text-xs text-gray-500 dark:text-gray-300">Recent device events, warning signals, and processing state.</p>
|
|
6
|
+
</div>
|
|
7
|
+
<Button @icon="refresh" @size="xs" @onClick={{this.refreshEvents}} @isLoading={{this.loadEvents.isRunning}} />
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<Layout::Resource::Tabular
|
|
11
|
+
@resource="device-event"
|
|
12
|
+
@title="Telemetry Events"
|
|
13
|
+
@data={{this.events}}
|
|
14
|
+
@columns={{this.columns}}
|
|
15
|
+
@controller={{this}}
|
|
16
|
+
@pagination={{false}}
|
|
17
|
+
@withoutHeader={{true}}
|
|
18
|
+
@tableWrapperClass="no-table-extra-spacing"
|
|
19
|
+
@emptyStateComponent={{component
|
|
20
|
+
"table/empty-state"
|
|
21
|
+
variant="compact"
|
|
22
|
+
icon="bolt"
|
|
23
|
+
title="No telemetry events"
|
|
24
|
+
description="Events appear after this device reports provider activity."
|
|
25
|
+
primaryText="Refresh"
|
|
26
|
+
primaryIcon="refresh"
|
|
27
|
+
primaryAction=this.refreshEvents
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
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
|
+
|
|
7
|
+
const severityOptions = [
|
|
8
|
+
{ label: 'Info', value: 'info' },
|
|
9
|
+
{ label: 'Warning', value: 'warning' },
|
|
10
|
+
{ label: 'Error', value: 'error' },
|
|
11
|
+
{ label: 'Critical', value: 'critical' },
|
|
12
|
+
{ label: 'High', value: 'high' },
|
|
13
|
+
];
|
|
14
|
+
|
|
15
|
+
function toRecentList(records) {
|
|
16
|
+
const list = Array.from(records ?? []);
|
|
17
|
+
|
|
18
|
+
list.meta = {
|
|
19
|
+
current_page: 1,
|
|
20
|
+
last_page: 1,
|
|
21
|
+
per_page: list.length,
|
|
22
|
+
total: list.length,
|
|
23
|
+
from: list.length > 0 ? 1 : 0,
|
|
24
|
+
to: list.length,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return list;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default class DevicePanelTabsEventsComponent extends Component {
|
|
31
|
+
@service deviceEventActions;
|
|
32
|
+
@service store;
|
|
33
|
+
|
|
34
|
+
@tracked events = toRecentList();
|
|
35
|
+
|
|
36
|
+
constructor() {
|
|
37
|
+
super(...arguments);
|
|
38
|
+
this.loadEvents.perform();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get device() {
|
|
42
|
+
return this.args.resource ?? this.args.model;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get columns() {
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
sticky: true,
|
|
49
|
+
label: 'Event',
|
|
50
|
+
valuePath: 'event_type',
|
|
51
|
+
cellComponent: 'table/cell/anchor',
|
|
52
|
+
action: this.deviceEventActions.panel?.view ?? this.deviceEventActions.transition.view,
|
|
53
|
+
permission: 'fleet-ops view device-event',
|
|
54
|
+
resizable: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: 'Severity',
|
|
58
|
+
valuePath: 'severity',
|
|
59
|
+
cellComponent: 'table/cell/status',
|
|
60
|
+
filterOptions: severityOptions,
|
|
61
|
+
resizable: true,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: 'Message',
|
|
65
|
+
valuePath: 'message',
|
|
66
|
+
resizable: true,
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: 'Code',
|
|
70
|
+
valuePath: 'code',
|
|
71
|
+
resizable: true,
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: 'Processed',
|
|
75
|
+
valuePath: 'processedAt',
|
|
76
|
+
sortParam: 'processed_at',
|
|
77
|
+
resizable: true,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: 'Occurred',
|
|
81
|
+
valuePath: 'occurredAt',
|
|
82
|
+
sortParam: 'occurred_at',
|
|
83
|
+
resizable: true,
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
label: '',
|
|
87
|
+
cellComponent: 'table/cell/dropdown',
|
|
88
|
+
ddButtonText: false,
|
|
89
|
+
ddButtonIcon: 'ellipsis-h',
|
|
90
|
+
ddButtonIconPrefix: 'fas',
|
|
91
|
+
wrapperClass: 'flex items-center justify-end mx-2',
|
|
92
|
+
sticky: 'right',
|
|
93
|
+
width: 60,
|
|
94
|
+
actions: [
|
|
95
|
+
{
|
|
96
|
+
label: 'View event',
|
|
97
|
+
fn: this.deviceEventActions.panel?.view ?? this.deviceEventActions.transition.view,
|
|
98
|
+
permission: 'fleet-ops view device-event',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
label: 'Mark processed',
|
|
102
|
+
fn: this.markProcessed,
|
|
103
|
+
permission: 'fleet-ops update device-event',
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@action async markProcessed(deviceEvent) {
|
|
111
|
+
await this.deviceEventActions.markProcessed(deviceEvent);
|
|
112
|
+
await this.loadEvents.perform();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@action refreshEvents() {
|
|
116
|
+
return this.loadEvents.perform();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@task *loadEvents() {
|
|
120
|
+
if (!this.device?.id) {
|
|
121
|
+
this.events = toRecentList();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const events = yield this.store.query('device-event', { device_uuid: this.device.id, limit: 10, sort: '-created_at' });
|
|
126
|
+
this.events = toRecentList(events);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<div class="flex flex-col gap-3 p-3" ...attributes>
|
|
2
|
+
<div class="flex items-start justify-between gap-3">
|
|
3
|
+
<div class="min-w-0">
|
|
4
|
+
<h2 class="text-base font-bold text-gray-900 dark:text-gray-100">Sensor Inventory</h2>
|
|
5
|
+
<p class="mt-0.5 text-xs text-gray-500 dark:text-gray-300">Recent sensor readings and health for this device.</p>
|
|
6
|
+
</div>
|
|
7
|
+
<Button @icon="refresh" @size="xs" @onClick={{this.refreshSensors}} @isLoading={{this.loadSensors.isRunning}} />
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<Layout::Resource::Tabular
|
|
11
|
+
@resource="sensor"
|
|
12
|
+
@title="Device Sensors"
|
|
13
|
+
@data={{this.sensors}}
|
|
14
|
+
@columns={{this.columns}}
|
|
15
|
+
@controller={{this}}
|
|
16
|
+
@pagination={{false}}
|
|
17
|
+
@withoutHeader={{true}}
|
|
18
|
+
@tableWrapperClass="no-table-extra-spacing"
|
|
19
|
+
@emptyStateComponent={{component
|
|
20
|
+
"table/empty-state"
|
|
21
|
+
variant="compact"
|
|
22
|
+
icon="gauge-high"
|
|
23
|
+
title="No sensors connected"
|
|
24
|
+
description="Sensors appear here after provider telemetry links them to this device."
|
|
25
|
+
primaryText="Refresh"
|
|
26
|
+
primaryIcon="refresh"
|
|
27
|
+
primaryAction=this.refreshSensors
|
|
28
|
+
}}
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
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
|
+
|
|
7
|
+
function toRecentList(records) {
|
|
8
|
+
const list = Array.from(records ?? []);
|
|
9
|
+
|
|
10
|
+
list.meta = {
|
|
11
|
+
current_page: 1,
|
|
12
|
+
last_page: 1,
|
|
13
|
+
per_page: list.length,
|
|
14
|
+
total: list.length,
|
|
15
|
+
from: list.length > 0 ? 1 : 0,
|
|
16
|
+
to: list.length,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return list;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default class DevicePanelTabsSensorsComponent extends Component {
|
|
23
|
+
@service sensorActions;
|
|
24
|
+
@service store;
|
|
25
|
+
|
|
26
|
+
@tracked sensors = toRecentList();
|
|
27
|
+
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.loadSensors.perform();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
get device() {
|
|
34
|
+
return this.args.resource ?? this.args.model;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
get columns() {
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
sticky: true,
|
|
41
|
+
label: 'Sensor',
|
|
42
|
+
valuePath: 'name',
|
|
43
|
+
cellComponent: 'table/cell/anchor',
|
|
44
|
+
action: this.sensorActions.panel?.view ?? this.sensorActions.transition.view,
|
|
45
|
+
permission: 'fleet-ops view sensor',
|
|
46
|
+
resizable: true,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: 'Type',
|
|
50
|
+
valuePath: 'type',
|
|
51
|
+
cellComponent: 'table/cell/base',
|
|
52
|
+
humanize: true,
|
|
53
|
+
resizable: true,
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
label: 'Value',
|
|
57
|
+
valuePath: 'last_value',
|
|
58
|
+
resizable: true,
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: 'Unit',
|
|
62
|
+
valuePath: 'unit',
|
|
63
|
+
resizable: true,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
label: 'Status',
|
|
67
|
+
valuePath: 'status',
|
|
68
|
+
cellComponent: 'table/cell/status',
|
|
69
|
+
resizable: true,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: 'Last Reading',
|
|
73
|
+
valuePath: 'lastReadingAt',
|
|
74
|
+
sortParam: 'last_reading_at',
|
|
75
|
+
resizable: true,
|
|
76
|
+
},
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@action refreshSensors() {
|
|
81
|
+
return this.loadSensors.perform();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@task *loadSensors() {
|
|
85
|
+
if (!this.device?.id) {
|
|
86
|
+
this.sensors = toRecentList();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const sensors = yield this.store.query('sensor', { device_uuid: this.device.id, limit: 10, sort: '-updated_at' });
|
|
91
|
+
this.sensors = toRecentList(sensors);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<div class="flex flex-col gap-3 p-3" ...attributes>
|
|
2
|
+
<div class="flex items-start justify-between gap-3">
|
|
3
|
+
<div class="min-w-0">
|
|
4
|
+
<h2 class="text-base font-bold text-gray-900 dark:text-gray-100">Vehicle Attachment</h2>
|
|
5
|
+
<p class="mt-0.5 text-xs text-gray-500 dark:text-gray-300">Fleet context for telemetry from this device.</p>
|
|
6
|
+
</div>
|
|
7
|
+
<div class="flex flex-wrap items-center justify-end gap-2">
|
|
8
|
+
{{#if this.hasVehicle}}
|
|
9
|
+
{{#if this.canOpenVehicle}}
|
|
10
|
+
<Button @icon="eye" @text="Open Vehicle" @size="xs" @onClick={{this.openVehicle}} />
|
|
11
|
+
{{/if}}
|
|
12
|
+
{{#if this.canLocateVehicle}}
|
|
13
|
+
<Button @icon="location-dot" @text="Locate" @size="xs" @onClick={{this.locateVehicle}} />
|
|
14
|
+
{{/if}}
|
|
15
|
+
<Button @icon="shuffle" @text="Change Vehicle" @size="xs" @onClick={{this.attachToVehicle}} />
|
|
16
|
+
<Button @icon="unlink" @text="Detach" @size="xs" @type="danger" @onClick={{this.detachFromVehicle}} />
|
|
17
|
+
{{else}}
|
|
18
|
+
<Button @icon="link" @text="Attach Vehicle" @size="xs" @onClick={{this.attachToVehicle}} />
|
|
19
|
+
{{/if}}
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
{{#if this.hasVehicle}}
|
|
24
|
+
<section class="overflow-hidden rounded-md border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800">
|
|
25
|
+
<div class="flex gap-3 p-3">
|
|
26
|
+
<Image
|
|
27
|
+
src={{this.vehiclePhotoUrl}}
|
|
28
|
+
@fallbackSrc={{config "defaultValues.vehicleAvatar"}}
|
|
29
|
+
alt={{this.vehicleName}}
|
|
30
|
+
class="h-16 w-16 flex-shrink-0 rounded-md object-cover shadow-sm"
|
|
31
|
+
/>
|
|
32
|
+
<div class="min-w-0 flex-1">
|
|
33
|
+
<div class="flex flex-wrap items-center gap-2">
|
|
34
|
+
<h3 class="truncate text-base font-bold text-gray-900 dark:text-gray-100">{{this.vehicleName}}</h3>
|
|
35
|
+
{{#if this.vehicleStatus}}
|
|
36
|
+
<Badge @status={{this.vehicleStatus}} @size="xs">{{smart-humanize this.vehicleStatus}}</Badge>
|
|
37
|
+
{{/if}}
|
|
38
|
+
</div>
|
|
39
|
+
<div class="mt-1 text-xs text-gray-500 dark:text-gray-300">{{n-a this.vehicleSubtitle}}</div>
|
|
40
|
+
<div class="mt-3 grid grid-cols-1 gap-2 text-xs sm:grid-cols-3">
|
|
41
|
+
<div>
|
|
42
|
+
<div class="font-semibold uppercase text-gray-400 dark:text-gray-500">Driver</div>
|
|
43
|
+
<div class="truncate text-gray-800 dark:text-gray-100">{{n-a this.vehicleDriverName}}</div>
|
|
44
|
+
</div>
|
|
45
|
+
<div>
|
|
46
|
+
<div class="font-semibold uppercase text-gray-400 dark:text-gray-500">Attached Device</div>
|
|
47
|
+
<div class="truncate text-gray-800 dark:text-gray-100">{{n-a this.device.displayName this.device.name}}</div>
|
|
48
|
+
</div>
|
|
49
|
+
<div>
|
|
50
|
+
<div class="font-semibold uppercase text-gray-400 dark:text-gray-500">Device Last Seen</div>
|
|
51
|
+
<div class="truncate text-gray-800 dark:text-gray-100">{{n-a (format-date-fns this.device.last_online_at "dd MMM yyyy, HH:mm")}}</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</section>
|
|
57
|
+
{{else}}
|
|
58
|
+
<Telematic::TabEmptyState
|
|
59
|
+
@tone="warning"
|
|
60
|
+
@icon="link-slash"
|
|
61
|
+
@title="No vehicle attached"
|
|
62
|
+
@message="Attach this device to a vehicle so telemetry has fleet context."
|
|
63
|
+
@primaryText="Attach Vehicle"
|
|
64
|
+
@primaryIcon="link"
|
|
65
|
+
@primaryAction={{this.attachToVehicle}}
|
|
66
|
+
/>
|
|
67
|
+
{{/if}}
|
|
68
|
+
</div>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import Component from '@glimmer/component';
|
|
2
|
+
import { action } from '@ember/object';
|
|
3
|
+
import { inject as service } from '@ember/service';
|
|
4
|
+
|
|
5
|
+
export default class DevicePanelTabsVehicleComponent extends Component {
|
|
6
|
+
@service deviceActions;
|
|
7
|
+
@service hostRouter;
|
|
8
|
+
@service mapManager;
|
|
9
|
+
@service vehicleActions;
|
|
10
|
+
|
|
11
|
+
get device() {
|
|
12
|
+
return this.args.resource ?? this.args.model;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get vehicle() {
|
|
16
|
+
return this.device?.attachable;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get vehicleName() {
|
|
20
|
+
return this.device?.attached_to_name ?? this.vehicle?.displayName ?? this.vehicle?.display_name ?? this.vehicle?.name;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
get vehicleSubtitle() {
|
|
24
|
+
return this.vehicle?.plate_number ?? this.vehicle?.call_sign ?? this.vehicle?.vin ?? this.vehicle?.public_id ?? this.device?.attachable_uuid;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get vehiclePhotoUrl() {
|
|
28
|
+
return this.vehicle?.photo_url ?? this.vehicle?.avatar_url;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get vehicleStatus() {
|
|
32
|
+
return this.vehicle?.status ?? (this.vehicle?.online ? 'online' : null);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
get vehicleDriverName() {
|
|
36
|
+
return this.vehicle?.driver?.displayName ?? this.vehicle?.driver?.display_name ?? this.vehicle?.driver?.name ?? this.vehicle?.driver_name;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
get hasVehicle() {
|
|
40
|
+
return Boolean(this.vehicleName || this.device?.attachable_uuid);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
get canOpenVehicle() {
|
|
44
|
+
return Boolean(this.vehicle?.id);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get canLocateVehicle() {
|
|
48
|
+
return Boolean(this.vehicle?.id && (this.vehicle?.location || this.vehicle?.last_position));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@action attachToVehicle() {
|
|
52
|
+
return this.deviceActions.attachToVehicle(this.device, { callback: () => this.device?.reload?.() });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@action detachFromVehicle() {
|
|
56
|
+
return this.deviceActions.detachFromVehicle(this.device, { callback: () => this.device?.reload?.() });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
@action openVehicle() {
|
|
60
|
+
if (this.vehicle?.id) {
|
|
61
|
+
return this.vehicleActions.panel?.view
|
|
62
|
+
? this.vehicleActions.panel.view(this.vehicle)
|
|
63
|
+
: this.hostRouter.transitionTo('console.fleet-ops.management.vehicles.index.details', this.vehicle);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@action async locateVehicle() {
|
|
68
|
+
if (!this.vehicle?.id) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
await this.transitionToLiveMap();
|
|
73
|
+
await this.mapManager.waitForMap({ timeoutMs: 8000 });
|
|
74
|
+
|
|
75
|
+
this.mapManager.focusResource(this.vehicle, 16, {
|
|
76
|
+
paddingBottomRight: [300, 200],
|
|
77
|
+
moveend: () => {
|
|
78
|
+
this.vehicleActions.panel?.view?.(this.vehicle, { closeOnTransition: true });
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
async transitionToLiveMap() {
|
|
84
|
+
try {
|
|
85
|
+
await this.hostRouter.transitionTo('console.fleet-ops.operations.orders.index', { queryParams: { layout: 'map' } });
|
|
86
|
+
} catch (_) {
|
|
87
|
+
// Keep locate usable if another transition is already active.
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/components/table/cell/dropdown/action-item';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/components/table/cell/dropdown';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/components/vendor/panel-header';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@fleetbase/fleetops-engine/controllers/connectivity/events/
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/controllers/connectivity/events/details';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@fleetbase/fleetops-engine/routes/connectivity/events/
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/routes/connectivity/events/details';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { default } from '@fleetbase/fleetops-engine/templates/connectivity/events/
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/templates/connectivity/events/details';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from '@fleetbase/fleetops-engine/utils/map-drawer-dropdown-position';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@fleetbase/fleetops-engine/utils/trackable-option';
|
package/composer.json
CHANGED
package/extension.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetbase/fleetops-engine",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.55",
|
|
4
4
|
"description": "Fleet & Transport Management Extension for Fleetbase",
|
|
5
5
|
"fleetbase": {
|
|
6
6
|
"route": "fleet-ops"
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/core": "^7.23.2",
|
|
45
|
-
"@fleetbase/ember-core": "^0.3.
|
|
46
|
-
"@fleetbase/ember-ui": "^0.3.
|
|
47
|
-
"@fleetbase/fleetops-data": "^0.1.
|
|
45
|
+
"@fleetbase/ember-core": "^0.3.23",
|
|
46
|
+
"@fleetbase/ember-ui": "^0.3.37",
|
|
47
|
+
"@fleetbase/fleetops-data": "^0.1.40",
|
|
48
48
|
"@fleetbase/leaflet-routing-machine": "^3.2.17",
|
|
49
49
|
"@fortawesome/ember-fontawesome": "^2.0.0",
|
|
50
50
|
"@fortawesome/fontawesome-svg-core": "6.4.0",
|
|
@@ -13,7 +13,7 @@ class SyncTelematics extends Command
|
|
|
13
13
|
protected $signature = 'fleetops:sync-telematics
|
|
14
14
|
{--provider=* : Limit polling to one or more provider keys}
|
|
15
15
|
{--limit=500 : Maximum provider units to fetch per page}
|
|
16
|
-
{--
|
|
16
|
+
{--exclude-webhook-providers : Skip providers that support webhooks}
|
|
17
17
|
{--no-lock : Skip process locking}';
|
|
18
18
|
|
|
19
19
|
protected $description = 'Poll active telematics providers for device snapshots and positional telemetry.';
|
|
@@ -68,10 +68,10 @@ class SyncTelematics extends Command
|
|
|
68
68
|
protected function pollableProviderKeys(TelematicProviderRegistry $registry): array
|
|
69
69
|
{
|
|
70
70
|
$requestedProviders = array_filter((array) $this->option('provider'));
|
|
71
|
-
$
|
|
71
|
+
$excludeWebhookProviders = (bool) $this->option('exclude-webhook-providers');
|
|
72
72
|
|
|
73
73
|
return $registry->all()
|
|
74
|
-
->filter(function ($descriptor) use ($requestedProviders, $
|
|
74
|
+
->filter(function ($descriptor) use ($requestedProviders, $excludeWebhookProviders) {
|
|
75
75
|
if (!empty($requestedProviders) && !in_array($descriptor->key, $requestedProviders, true)) {
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
@@ -80,7 +80,7 @@ class SyncTelematics extends Command
|
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
return
|
|
83
|
+
return !$excludeWebhookProviders || !$descriptor->supportsWebhooks;
|
|
84
84
|
})
|
|
85
85
|
->keys()
|
|
86
86
|
->values()
|
|
@@ -28,6 +28,7 @@ class DeviceController extends FleetOpsController
|
|
|
28
28
|
public static function onQueryRecord($query, $request): void
|
|
29
29
|
{
|
|
30
30
|
$query->with(['telematic', 'warranty', 'attachable']);
|
|
31
|
+
$query->withCount('sensors');
|
|
31
32
|
|
|
32
33
|
if ($request->filled('attachment_state')) {
|
|
33
34
|
match ($request->input('attachment_state')) {
|
|
@@ -38,13 +39,17 @@ class DeviceController extends FleetOpsController
|
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
if ($request->filled('vehicle')) {
|
|
41
|
-
$query
|
|
42
|
+
static::applyVehicleFilter($query, $request->input('vehicle'));
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
if ($request->filled('device_id')) {
|
|
45
46
|
$query->where('device_id', 'like', '%' . $request->input('device_id') . '%');
|
|
46
47
|
}
|
|
47
48
|
|
|
49
|
+
if ($request->filled('serial_number')) {
|
|
50
|
+
$query->where('serial_number', 'like', '%' . $request->input('serial_number') . '%');
|
|
51
|
+
}
|
|
52
|
+
|
|
48
53
|
if ($request->filled('connection_status')) {
|
|
49
54
|
$statuses = Utils::arrayFrom($request->input('connection_status'));
|
|
50
55
|
|
|
@@ -80,6 +85,7 @@ class DeviceController extends FleetOpsController
|
|
|
80
85
|
public static function onFindRecord($query, $request): void
|
|
81
86
|
{
|
|
82
87
|
$query->with(['telematic', 'warranty', 'attachable']);
|
|
88
|
+
$query->withCount('sensors');
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
/**
|
|
@@ -183,6 +189,17 @@ class DeviceController extends FleetOpsController
|
|
|
183
189
|
}
|
|
184
190
|
}
|
|
185
191
|
|
|
192
|
+
protected static function applyVehicleFilter($query, string $vehicle): void
|
|
193
|
+
{
|
|
194
|
+
$query->where(function ($vehicleQuery) use ($vehicle) {
|
|
195
|
+
$vehicleQuery->where('attachable_uuid', $vehicle)
|
|
196
|
+
->orWhereIn('attachable_uuid', Vehicle::query()
|
|
197
|
+
->where('company_uuid', session('company'))
|
|
198
|
+
->where('public_id', $vehicle)
|
|
199
|
+
->pluck('uuid'));
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
|
|
186
203
|
protected function logDeviceAttachmentLookupFailure(string $action, string $missingResource, string $deviceId, ?string $vehicleId): void
|
|
187
204
|
{
|
|
188
205
|
Log::warning('Device attachment lookup failed', [
|
|
@@ -24,7 +24,7 @@ class DeviceEventController extends FleetOpsController
|
|
|
24
24
|
*/
|
|
25
25
|
public static function onQueryRecord($query, $request): void
|
|
26
26
|
{
|
|
27
|
-
$query->with(['device']);
|
|
27
|
+
$query->with(['device.telematic']);
|
|
28
28
|
|
|
29
29
|
if ($request->filled('telematic')) {
|
|
30
30
|
$query->whereHas('device', function ($deviceQuery) use ($request) {
|
|
@@ -148,7 +148,7 @@ class LiveController extends Controller
|
|
|
148
148
|
|
|
149
149
|
return LiveCacheService::remember('drivers', $cacheParams, function () use ($bounds, $limit) {
|
|
150
150
|
$query = Driver::where(['company_uuid' => session('company')])
|
|
151
|
-
->with(['user', 'vehicle'])
|
|
151
|
+
->with(['user', 'vehicle.devices'])
|
|
152
152
|
->applyDirectivesForPermissions('fleet-ops list driver');
|
|
153
153
|
|
|
154
154
|
$this->applyLiveLocationGuards($query);
|