2023-11-05 11:33:45 -05:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { ref } from "vue";
|
|
|
|
|
import axios from "axios";
|
|
|
|
|
import { useStateStore } from "@/stores/StateStore";
|
|
|
|
|
|
|
|
|
|
interface SnapshotMetadata {
|
|
|
|
|
snapshotName: string;
|
|
|
|
|
cameraNickname: string;
|
|
|
|
|
streamType: "input" | "output";
|
|
|
|
|
timeCreated: Date;
|
|
|
|
|
}
|
|
|
|
|
const getSnapshotMetadataFromName = (snapshotName: string): SnapshotMetadata => {
|
|
|
|
|
snapshotName = snapshotName.replace(/\.[^/.]+$/, "");
|
|
|
|
|
|
|
|
|
|
const data = snapshotName.split("_");
|
|
|
|
|
|
|
|
|
|
const cameraName = data.slice(0, data.length - 2).join("_");
|
|
|
|
|
const streamType = data[data.length - 2] as "input" | "output";
|
|
|
|
|
const dateStr = data[data.length - 1];
|
|
|
|
|
|
|
|
|
|
const year = parseInt(dateStr.substring(0, 4), 10);
|
|
|
|
|
const month = parseInt(dateStr.substring(5, 7), 10) - 1; // Months are zero-based
|
|
|
|
|
const day = parseInt(dateStr.substring(8, 10), 10);
|
|
|
|
|
const hours = parseInt(dateStr.substring(11, 13), 10);
|
|
|
|
|
const minutes = parseInt(dateStr.substring(13, 15), 10);
|
|
|
|
|
const seconds = parseInt(dateStr.substring(15, 17), 10);
|
|
|
|
|
const milliseconds = parseInt(dateStr.substring(17), 10);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
snapshotName: snapshotName,
|
|
|
|
|
cameraNickname: cameraName,
|
|
|
|
|
streamType: streamType,
|
|
|
|
|
timeCreated: new Date(year, month, day, hours, minutes, seconds, milliseconds)
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
interface Snapshot {
|
|
|
|
|
index: number;
|
|
|
|
|
snapshotName: string;
|
|
|
|
|
snapshotShortName: string;
|
|
|
|
|
cameraUniqueName: string;
|
|
|
|
|
cameraNickname: string;
|
|
|
|
|
streamType: "input" | "output";
|
|
|
|
|
timeCreated: Date;
|
|
|
|
|
snapshotSrc: string;
|
|
|
|
|
}
|
|
|
|
|
const imgData = ref<Snapshot[]>([]);
|
|
|
|
|
const fetchSnapshots = () => {
|
|
|
|
|
axios
|
|
|
|
|
.get("/utils/getImageSnapshots")
|
|
|
|
|
.then((response) => {
|
|
|
|
|
imgData.value = response.data.map(
|
|
|
|
|
(snapshotData: { snapshotName: string; cameraUniqueName: string; snapshotData: string }, index) => {
|
|
|
|
|
const metadata = getSnapshotMetadataFromName(snapshotData.snapshotName);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
index: index,
|
|
|
|
|
snapshotName: snapshotData.snapshotName,
|
|
|
|
|
snapshotShortName: metadata.snapshotName,
|
|
|
|
|
cameraUniqueName: snapshotData.cameraUniqueName,
|
|
|
|
|
cameraNickname: metadata.cameraNickname,
|
|
|
|
|
streamType: metadata.streamType,
|
|
|
|
|
timeCreated: metadata.timeCreated,
|
|
|
|
|
snapshotSrc: "data:image/jpg;base64," + snapshotData.snapshotData
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
showSnapshotViewerDialog.value = true;
|
|
|
|
|
})
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
if (error.response) {
|
|
|
|
|
useStateStore().showSnackbarMessage({
|
|
|
|
|
color: "error",
|
|
|
|
|
message: error.response.data.text || error.response.data
|
|
|
|
|
});
|
|
|
|
|
} else if (error.request) {
|
|
|
|
|
useStateStore().showSnackbarMessage({
|
|
|
|
|
color: "error",
|
|
|
|
|
message: "Error while trying to process the request! The backend didn't respond."
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
useStateStore().showSnackbarMessage({
|
|
|
|
|
color: "error",
|
|
|
|
|
message: "An error occurred while trying to process the request."
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
const showSnapshotViewerDialog = ref(false);
|
|
|
|
|
const expanded = ref([]);
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<template>
|
2025-05-06 18:21:41 -04:00
|
|
|
<v-card style="background-color: #006492">
|
2023-11-05 11:33:45 -05:00
|
|
|
<v-card-title>Camera Control</v-card-title>
|
Clean up spacing and other things in various parts of the UI (#1972)
## Description
After the Vue 3 upgrade, the spacing for various UI elements was left
inconsistent in many places. Dialogs were hit especially hard and had
some very inconsistent spacing. Additionally, the 24 pixels of padding
around all cards was noted as a waste of space and unnecessary, so it
has been shrunk down to 20 pixels to make the UI a tiny bit more compact
and to make it visually closer to some parts of the UI that have 16
pixels of padding (the camera views are the most notable example).
Padding between input elements has also been reduced to 20 pixels (this
required some hackery to get consistent sizes on input elements, since
switches and sliders have different heights.)
Some other minor UI tweaks were made, such as removing the divider
between dialog contents and dialog buttons because it visually looks
better, shrinking the banner padding so it doesn't displace as much
content, making the banner background one uniform color instead of a
highlight around the icon, fixing the targets tab so that the columns
stop shifting around when the values change, preserving newlines in the
log view, cleaning up the object detection UI, and making the import
dialogs have consistently inset input elements.
Old dashboard:

New dashboard:

Old Camera tab:

New Camera tab:

Old Calibration Info:

New Calibration Info:

Old Log Viewer:

New Log Viewer:

Old Pipeline Creation Dialog:

New Pipeline Creation Dialog:

Old Factory Reset:

New Factory Reset:

Old Pipeline Change:

New Pipeline Change:

Old Import Dialog:

New Import Dialog:

## Meta
Merge checklist:
- [x] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [x] The description documents the _what_ and _why_
- [ ] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with settings back to v2024.3.1
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [ ] If this PR addresses a bug, a regression test for it is added
2025-07-12 00:02:23 -04:00
|
|
|
<v-card-text class="pt-0">
|
2025-01-07 08:45:39 -05:00
|
|
|
<v-btn color="secondary" @click="fetchSnapshots">
|
2025-05-06 18:21:41 -04:00
|
|
|
<v-icon start class="open-icon"> mdi-folder </v-icon>
|
2025-01-07 08:45:39 -05:00
|
|
|
<span class="open-label">Show Saved Snapshots</span>
|
|
|
|
|
</v-btn>
|
|
|
|
|
</v-card-text>
|
2023-11-05 11:33:45 -05:00
|
|
|
<v-dialog v-model="showSnapshotViewerDialog">
|
Clean up spacing and other things in various parts of the UI (#1972)
## Description
After the Vue 3 upgrade, the spacing for various UI elements was left
inconsistent in many places. Dialogs were hit especially hard and had
some very inconsistent spacing. Additionally, the 24 pixels of padding
around all cards was noted as a waste of space and unnecessary, so it
has been shrunk down to 20 pixels to make the UI a tiny bit more compact
and to make it visually closer to some parts of the UI that have 16
pixels of padding (the camera views are the most notable example).
Padding between input elements has also been reduced to 20 pixels (this
required some hackery to get consistent sizes on input elements, since
switches and sliders have different heights.)
Some other minor UI tweaks were made, such as removing the divider
between dialog contents and dialog buttons because it visually looks
better, shrinking the banner padding so it doesn't displace as much
content, making the banner background one uniform color instead of a
highlight around the icon, fixing the targets tab so that the columns
stop shifting around when the values change, preserving newlines in the
log view, cleaning up the object detection UI, and making the import
dialogs have consistently inset input elements.
Old dashboard:

New dashboard:

Old Camera tab:

New Camera tab:

Old Calibration Info:

New Calibration Info:

Old Log Viewer:

New Log Viewer:

Old Pipeline Creation Dialog:

New Pipeline Creation Dialog:

Old Factory Reset:

New Factory Reset:

Old Pipeline Change:

New Pipeline Change:

Old Import Dialog:

New Import Dialog:

## Meta
Merge checklist:
- [x] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [x] The description documents the _what_ and _why_
- [ ] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with settings back to v2024.3.1
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [ ] If this PR addresses a bug, a regression test for it is added
2025-07-12 00:02:23 -04:00
|
|
|
<v-card color="primary" flat>
|
2023-11-05 11:33:45 -05:00
|
|
|
<v-card-title> View Saved Frame Snapshots </v-card-title>
|
|
|
|
|
<v-divider />
|
|
|
|
|
<v-card-text v-if="imgData.length === 0" style="font-size: 18px; font-weight: 600" class="pt-4">
|
|
|
|
|
There are no snapshots saved
|
|
|
|
|
</v-card-text>
|
Clean up spacing and other things in various parts of the UI (#1972)
## Description
After the Vue 3 upgrade, the spacing for various UI elements was left
inconsistent in many places. Dialogs were hit especially hard and had
some very inconsistent spacing. Additionally, the 24 pixels of padding
around all cards was noted as a waste of space and unnecessary, so it
has been shrunk down to 20 pixels to make the UI a tiny bit more compact
and to make it visually closer to some parts of the UI that have 16
pixels of padding (the camera views are the most notable example).
Padding between input elements has also been reduced to 20 pixels (this
required some hackery to get consistent sizes on input elements, since
switches and sliders have different heights.)
Some other minor UI tweaks were made, such as removing the divider
between dialog contents and dialog buttons because it visually looks
better, shrinking the banner padding so it doesn't displace as much
content, making the banner background one uniform color instead of a
highlight around the icon, fixing the targets tab so that the columns
stop shifting around when the values change, preserving newlines in the
log view, cleaning up the object detection UI, and making the import
dialogs have consistently inset input elements.
Old dashboard:

New dashboard:

Old Camera tab:

New Camera tab:

Old Calibration Info:

New Calibration Info:

Old Log Viewer:

New Log Viewer:

Old Pipeline Creation Dialog:

New Pipeline Creation Dialog:

Old Factory Reset:

New Factory Reset:

Old Pipeline Change:

New Pipeline Change:

Old Import Dialog:

New Import Dialog:

## Meta
Merge checklist:
- [x] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [x] The description documents the _what_ and _why_
- [ ] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with settings back to v2024.3.1
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [ ] If this PR addresses a bug, a regression test for it is added
2025-07-12 00:02:23 -04:00
|
|
|
<v-card-text v-else>
|
2023-11-05 11:33:45 -05:00
|
|
|
<v-data-table
|
|
|
|
|
v-model:expanded="expanded"
|
|
|
|
|
:headers="[
|
2025-05-06 18:21:41 -04:00
|
|
|
{ title: 'Snapshot Name', key: 'snapshotShortName', sortable: false },
|
|
|
|
|
{ title: 'Camera Unique Name', key: 'cameraUniqueName' },
|
|
|
|
|
{ title: 'Camera Nickname', key: 'cameraNickname' },
|
|
|
|
|
{ title: 'Stream Type', key: 'streamType' },
|
|
|
|
|
{ title: 'Time Created', key: 'timeCreated' },
|
|
|
|
|
{ title: 'Actions', key: 'actions', sortable: false }
|
2023-11-05 11:33:45 -05:00
|
|
|
]"
|
|
|
|
|
:items="imgData"
|
2025-05-06 18:21:41 -04:00
|
|
|
:group-by="[{ key: 'cameraUniqueName' }]"
|
2023-11-05 11:33:45 -05:00
|
|
|
class="elevation-0"
|
2025-05-06 18:21:41 -04:00
|
|
|
item-value="index"
|
2023-11-05 11:33:45 -05:00
|
|
|
show-expand
|
|
|
|
|
>
|
2025-05-06 18:21:41 -04:00
|
|
|
<template #item.data-table-expand="{ internalItem, toggleExpand }">
|
|
|
|
|
<v-btn
|
|
|
|
|
icon="mdi-eye"
|
|
|
|
|
class="text-none"
|
|
|
|
|
color="medium-emphasis"
|
|
|
|
|
size="small"
|
|
|
|
|
variant="text"
|
|
|
|
|
slim
|
|
|
|
|
@click="toggleExpand(internalItem)"
|
|
|
|
|
></v-btn>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<template #expanded-row="{ item, columns }">
|
|
|
|
|
<td :colspan="columns.length">
|
2023-11-05 11:33:45 -05:00
|
|
|
<div style="display: flex; justify-content: center; width: 100%">
|
|
|
|
|
<img :src="item.snapshotSrc" alt="snapshot-image" class="snapshot-preview pt-2 pb-2" />
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</template>
|
|
|
|
|
<!-- eslint-disable-next-line vue/valid-v-slot-->
|
|
|
|
|
<template #item.actions="{ item }">
|
|
|
|
|
<div style="display: flex; justify-content: center">
|
|
|
|
|
<a :download="item.snapshotName" :href="item.snapshotSrc">
|
2025-05-06 18:21:41 -04:00
|
|
|
<v-icon size="small"> mdi-download </v-icon>
|
2023-11-05 11:33:45 -05:00
|
|
|
</a>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</v-data-table>
|
|
|
|
|
<span
|
|
|
|
|
>Snapshot Timestamps may be incorrect as they depend on when the coprocessor was last connected to the
|
|
|
|
|
internet</span
|
|
|
|
|
>
|
Clean up spacing and other things in various parts of the UI (#1972)
## Description
After the Vue 3 upgrade, the spacing for various UI elements was left
inconsistent in many places. Dialogs were hit especially hard and had
some very inconsistent spacing. Additionally, the 24 pixels of padding
around all cards was noted as a waste of space and unnecessary, so it
has been shrunk down to 20 pixels to make the UI a tiny bit more compact
and to make it visually closer to some parts of the UI that have 16
pixels of padding (the camera views are the most notable example).
Padding between input elements has also been reduced to 20 pixels (this
required some hackery to get consistent sizes on input elements, since
switches and sliders have different heights.)
Some other minor UI tweaks were made, such as removing the divider
between dialog contents and dialog buttons because it visually looks
better, shrinking the banner padding so it doesn't displace as much
content, making the banner background one uniform color instead of a
highlight around the icon, fixing the targets tab so that the columns
stop shifting around when the values change, preserving newlines in the
log view, cleaning up the object detection UI, and making the import
dialogs have consistently inset input elements.
Old dashboard:

New dashboard:

Old Camera tab:

New Camera tab:

Old Calibration Info:

New Calibration Info:

Old Log Viewer:

New Log Viewer:

Old Pipeline Creation Dialog:

New Pipeline Creation Dialog:

Old Factory Reset:

New Factory Reset:

Old Pipeline Change:

New Pipeline Change:

Old Import Dialog:

New Import Dialog:

## Meta
Merge checklist:
- [x] Pull Request title is [short, imperative
summary](https://cbea.ms/git-commit/) of proposed changes
- [x] The description documents the _what_ and _why_
- [ ] If this PR changes behavior or adds a feature, user documentation
is updated
- [ ] If this PR touches photon-serde, all messages have been
regenerated and hashes have not changed unexpectedly
- [ ] If this PR touches configuration, this is backwards compatible
with settings back to v2024.3.1
- [ ] If this PR touches pipeline settings or anything related to data
exchange, the frontend typing is updated
- [ ] If this PR addresses a bug, a regression test for it is added
2025-07-12 00:02:23 -04:00
|
|
|
</v-card-text>
|
2023-11-05 11:33:45 -05:00
|
|
|
</v-card>
|
|
|
|
|
</v-dialog>
|
|
|
|
|
</v-card>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.v-divider {
|
|
|
|
|
border-color: white !important;
|
|
|
|
|
}
|
|
|
|
|
.v-btn {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
2025-05-06 18:21:41 -04:00
|
|
|
.v-table {
|
2023-11-05 11:33:45 -05:00
|
|
|
text-align: center;
|
|
|
|
|
background-color: #006492 !important;
|
|
|
|
|
|
|
|
|
|
th,
|
|
|
|
|
td {
|
|
|
|
|
background-color: #005281 !important;
|
|
|
|
|
font-size: 1rem !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tbody :hover tr {
|
|
|
|
|
background-color: #005281 !important;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar {
|
|
|
|
|
width: 0;
|
|
|
|
|
height: 0.55em;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar-track {
|
|
|
|
|
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
::-webkit-scrollbar-thumb {
|
|
|
|
|
background-color: #ffd843;
|
|
|
|
|
border-radius: 10px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.snapshot-preview {
|
|
|
|
|
max-width: 55%;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@media only screen and (max-width: 512px) {
|
|
|
|
|
.snapshot-preview {
|
|
|
|
|
max-width: 100%;
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-01-02 11:03:16 -05:00
|
|
|
@media only screen and (max-width: 351px) {
|
|
|
|
|
.open-icon {
|
|
|
|
|
margin: 0 !important;
|
|
|
|
|
}
|
|
|
|
|
.open-label {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-05 11:33:45 -05:00
|
|
|
</style>
|