Skip to content

Commit

Permalink
- Add missing api function. (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
hardiesoft authored Nov 19, 2024
1 parent 7a83389 commit 53c9c75
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
33 changes: 32 additions & 1 deletion browse-next/src/api/Device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import type {
GroupId as ProjectId,
IsoFormattedDateString,
LatLng,
ScheduleId,
} from "@typedefs/api/common";
import type {
ApiDeviceHistorySettings,
ApiDeviceResponse,
ApiMaskRegionsData,
} from "@typedefs/api/device";
import type { ScheduleId } from "@typedefs/api/common";
import type {
DeviceConfigDetail,
DeviceEvent,
Expand All @@ -24,6 +24,7 @@ import type { DeviceEventType } from "@typedefs/api/consts";
import type { ApiStationResponse as ApiLocationResponse } from "@typedefs/api/station";
import type { ApiRecordingResponse } from "@typedefs/api/recording";
import type { ApiTrackResponse } from "@typedefs/api/track";

export const createProxyDevice = (
projectNameOrId: string,
deviceName: string
Expand Down Expand Up @@ -664,3 +665,33 @@ export const getLastKnownDeviceBatteryLevel = (
});
});
};

export const getDeviceModel = async (deviceId: DeviceId) => {
try {
const nodegroup = await getDeviceNodeGroup(deviceId);
if (nodegroup) {
const model = nodegroup.includes("tc2")
? "tc2"
: nodegroup.includes("pi")
? "pi"
: null;
if (model !== null) {
return model;
}
}
return await getLatestEventsByDeviceId(deviceId, {
type: "versionData",
limit: 1,
}).then((response) => {
if (response.success && response.result.rows.length) {
return response.result.rows[0].EventDetail.details["tc2-agent"]
? "tc2"
: "pi";
} else {
return null;
}
});
} catch (e) {
return null;
}
};
2 changes: 1 addition & 1 deletion browse-next/src/components/DeviceRecordingSetup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,10 @@ watch(customRecordingWindowStop, async () => {
<div
class="position-relative flex-fill rounded bg-light p-0"
:style="{ height: '1em' }"
v-if="audioMode !== 'AudioOnly'"
>
<!-- Thermal Recording Windows -->
<div
v-if="audioMode !== 'AudioOnly'"
v-for="(style, index) in thermalBarStyles"
:key="'thermal-' + index"
class="position-absolute h-100 bg-success p-0"
Expand Down

0 comments on commit 53c9c75

Please sign in to comment.