Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Dataframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const DEFAULT_COLUMN_PATHS = [
"formattedDate",
"@type",
"lastlocation.rawlocationsensor",
"lastlocation.locationsensor",
"lastlocationResponse.locationsensor",
"response.vehiclestate",
"response.state",
"response.tripstatus",
Expand Down
5 changes: 3 additions & 2 deletions src/LogTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ function LogTable(props) {
className: "logtable-cell short-column",
solutionTypes: ["ODRD", "LMFS"],
},

{
Header: "Sensor",
accessor: "lastlocation.rawlocationsensor",
Expand All @@ -257,8 +258,8 @@ function LogTable(props) {
},
{
Header: "Location",
accessor: "lastlocation.locationsensor",
id: "lastlocation_locationsensor",
accessor: "lastlocationResponse.locationsensor",
id: "lastlocationResponse_locationsensor",
Cell: TrimCellRenderer,
trim: "_LOCATION_PROVIDER",
width: columnRegularWidth,
Expand Down
12 changes: 6 additions & 6 deletions src/MapToggles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const ALL_TOGGLES = [
id: "showGPSBubbles",
name: "Location Accuracy",
docLink: "https://github.com/googlemaps/fleet-debugger/blob/main/docs/GPSAccuracy.md",
columns: ["lastlocation.rawlocationaccuracy", "lastlocation.locationsensor"],
columns: ["lastlocationResponse.rawlocationaccuracy", "lastlocationResponse.locationsensor"],
solutionTypes: ["ODRD", "LMFS"],
},
{
Expand Down Expand Up @@ -134,10 +134,10 @@ export function getToggleHandlers({
bubbleMapRef.current[bubbleName] = tripLogs
.getLogs_(minDate, maxDate)
.map((le) => {
const rawloc = le.lastlocation?.rawlocation;
const rawloc = le.lastlocationResponse?.location || le.lastlocationResponse?.rawlocation;
if (rawloc && typeof rawloc.latitude === "number" && typeof rawloc.longitude === "number") {
const latLng = new window.google.maps.LatLng(rawloc.latitude, rawloc.longitude);
return cb(latLng, le.lastlocation, le);
return cb(latLng, le.lastlocationResponse, le);
}
return null;
})
Expand All @@ -147,9 +147,9 @@ export function getToggleHandlers({
};

return {
showGPSBubbles: GenerateBubbles("showGPSBubbles", (rawLocationLatLng, lastLocation) => {
showGPSBubbles: GenerateBubbles("showGPSBubbles", (rawLocationLatLng, lastlocationResponse) => {
let color;
switch (lastLocation.locationsensor) {
switch (lastlocationResponse.locationsensor) {
case "GPS":
color = "#11FF11";
break;
Expand All @@ -169,7 +169,7 @@ export function getToggleHandlers({
default:
color = "#000000";
}
const accuracy = lastLocation.rawlocationaccuracy;
const accuracy = lastlocationResponse.rawlocationaccuracy;
if (accuracy) {
const circ = new window.google.maps.Circle({
strokeColor: color,
Expand Down
10 changes: 10 additions & 0 deletions src/TripLogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ function processRawLogs(rawLogs, solutionType) {
newLog.lastlocationResponse.heading = lastKnownState.responseHeading;
}

const updateMask = _.get(newLog, "request.updatemask") || "";
if (
currentResponseLocation &&
!newLog.lastlocationResponse.locationsensor &&
!newLog.request?.header &&
updateMask.includes("last_location")
) {
newLog.lastlocationResponse.locationsensor = "API";
}

// Update lastKnownState for next iterations
const locToStore = currentLocation?.location || currentLocation?.rawlocation;
if (locToStore) {
Expand Down
Loading