Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Add missing api function. #101

Merged
merged 1 commit into from
Nov 19, 2024
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
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
Loading