Skip to content

Commit

Permalink
- Added the ability to customise which tags are filtered out from vis…
Browse files Browse the repository at this point in the history
…its on the Dashboard (4)
  • Loading branch information
hardiesoft committed Feb 11, 2025
1 parent 5107903 commit 9712500
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions api/classifications/classification.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"label": "all",
"version": "fdfe5a24-89fc-42ff-bc36-d8b799f5a5ea",
"version": "fdfe5a24-89fc-42ff-ac36-d8b799f5a5ea",
"children": [
{
"label": "mammal",
Expand Down Expand Up @@ -38,7 +38,7 @@
{
"label": "human",
"aliases": ["person"],
"display": "human speech"
"display": "human/human speech"
},
{
"label": "kangaroo",
Expand Down
2 changes: 1 addition & 1 deletion browse-next/src/components/MapWithPoints.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { rafFps } from "@models/LoggedInUser";
import type { NamedPoint } from "@models/mapUtils";
import { BSpinner } from "bootstrap-vue-next";
import type { LatLng } from "@typedefs/api/common";
import { useElementSize, useResizeObserver } from "@vueuse/core";
import { useElementSize } from "@vueuse/core";
const attribution = control.attribution;
Expand Down
33 changes: 16 additions & 17 deletions browse-next/src/views/DashboardView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,20 @@ const currentVisitsFilterComputed = computed<
(visit: ApiVisitResponse) => boolean
>(() => {
if (currentVisitsFilter.value === null) {
return (visit) => visitorIsIgnored(visit) && !visitIsTombstoned(visit);
return (visit) => !visitorIsIgnored(visit) && !visitIsTombstoned(visit);
} else {
return (visit) =>
(currentVisitsFilter.value as (visit: ApiVisitResponse) => boolean)(
visit
) &&
!visitIsTombstoned(visit) &&
visitorIsIgnored(visit);
!visitorIsIgnored(visit);
}
});
const dashboardVisits = computed<ApiVisitResponse[]>(() => {
return ((visitsContext.value || []) as ApiVisitResponse[]).filter(
(visit) => visitorIsIgnored(visit) && !visitIsTombstoned(visit)
(visit) => !visitorIsIgnored(visit) && !visitIsTombstoned(visit)
);
});
Expand Down Expand Up @@ -110,19 +110,19 @@ const ignoredTags = computed<string[]>(() => {
const visitorIsIgnored = (visit: ApiVisitResponse): boolean => {
if (visit && visit.classification) {
if (ignoredTags.value.includes(visit.classification)) {
return false;
return true;
}
const classification = getClassificationForLabel(visit.classification);
if (classification && typeof classification.path === "string") {
const parts = classification.path.split(".");
for (const part of parts) {
if (ignoredTags.value.includes(part)) {
return false;
return true;
}
}
}
}
return true;
return false;
};
const visitHasClassification =
Expand Down Expand Up @@ -283,8 +283,7 @@ const loadVisits = async () => {
}
};
const reloadDashboard = async (nextProject) => {
console.log("Reloading dashboard", nextProject);
const reloadDashboard = async (nextProject: SelectedProject | false) => {
if (nextProject) {
await Promise.all([loadLocations(), loadVisits()]);
}
Expand All @@ -303,9 +302,9 @@ onBeforeMount(async () => {
const locationsWithOnlineOrActiveDevicesInSelectedTimeWindow = computed<
ApiLocationResponse[]
>(() => {
const visitLocations = dashboardVisits.value.map(
(visit: ApiVisitResponse) => visit.stationId
);
// const visitLocations = dashboardVisits.value.map(
// (visit: ApiVisitResponse) => visit.stationId
// );
if (locations.value) {
return (locations.value as ApiLocationResponse[])
.filter(({ location }) => location.lng !== 0 && location.lat !== 0)
Expand All @@ -325,10 +324,10 @@ const locationsWithOnlineOrActiveDevicesInSelectedTimeWindow = computed<
new Date(location.lastThermalRecordingTime) > earliestDate.value)
);
}
})
.filter((location: ApiLocationResponse) =>
visitLocations.includes(location.id)
);
});
// .filter((location: ApiLocationResponse) =>
// visitLocations.includes(location.id)
// );
}
return [];
});
Expand Down Expand Up @@ -575,8 +574,8 @@ const hasVisitsForSelectedTimePeriod = computed<boolean>(() => {
><span v-else>day</span> for this project.
</span>
<span v-else>
There were no predator visits in any of the active locations in the
last
There were no visits for any target species in any of the active
locations in the last
<span v-if="timePeriodDays > 1">{{ timePeriodDays }} days</span
><span v-else>day</span> for this project.
</span>
Expand Down
4 changes: 2 additions & 2 deletions browse-next/src/views/ManageProjectSettingsSubView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,12 +219,12 @@ const reset = () => {
</div>
<b-modal
v-model="showAddCameraIgnoredTagModal"
title="Add project dashboard ignored classification"
title="Add project dashboard ignored tag"
@cancel="reset"
@close="reset"
@esc="reset"
@ok="addPendingIgnoredTag"
ok-title="Add ignored classification"
ok-title="Add ignored tag"
ok-variant="secondary"
cancel-variant="outline-secondary"
centered
Expand Down

0 comments on commit 9712500

Please sign in to comment.